@virusis/api-client 0.1.17 → 0.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/base.d.ts +10 -1
  2. package/dist/base.js +147 -1
  3. package/dist/container.d.ts +9 -0
  4. package/dist/generated/clients/diagnostics-service.d.ts +2 -0
  5. package/dist/generated/clients/diagnostics-service.js +2 -0
  6. package/dist/generated/clients/index.d.ts +3 -0
  7. package/dist/generated/clients/index.js +3 -0
  8. package/dist/generated/clients/portal-service.d.ts +2 -0
  9. package/dist/generated/clients/portal-service.js +2 -0
  10. package/dist/generated/clients/risk-service.d.ts +2 -0
  11. package/dist/generated/clients/risk-service.js +2 -0
  12. package/dist/generated/clients-rx/diagnostics-service-rx.d.ts +16 -0
  13. package/dist/generated/clients-rx/diagnostics-service-rx.js +12 -0
  14. package/dist/generated/clients-rx/index.d.ts +3 -0
  15. package/dist/generated/clients-rx/index.js +3 -0
  16. package/dist/generated/clients-rx/portal-service-rx.d.ts +16 -0
  17. package/dist/generated/clients-rx/portal-service-rx.js +12 -0
  18. package/dist/generated/clients-rx/risk-service-rx.d.ts +16 -0
  19. package/dist/generated/clients-rx/risk-service-rx.js +12 -0
  20. package/dist/generated/index.d.ts +303 -41
  21. package/dist/generated/index.js +529 -37
  22. package/dist/generated/models/access-token-i-data-result.d.ts +4 -0
  23. package/dist/generated/models/access-token-i-data-result.js +1 -0
  24. package/dist/generated/models/access-token.d.ts +4 -0
  25. package/dist/generated/models/access-token.js +1 -0
  26. package/dist/generated/models/application-click-event-batch-dto.d.ts +4 -0
  27. package/dist/generated/models/application-click-event-batch-dto.js +1 -0
  28. package/dist/generated/models/application-click-event-create-dto.d.ts +4 -0
  29. package/dist/generated/models/application-click-event-create-dto.js +1 -0
  30. package/dist/generated/models/feedback-category-dto-list-i-data-result.d.ts +4 -0
  31. package/dist/generated/models/feedback-category-dto-list-i-data-result.js +1 -0
  32. package/dist/generated/models/feedback-category-dto.d.ts +4 -0
  33. package/dist/generated/models/feedback-category-dto.js +1 -0
  34. package/dist/generated/models/index.d.ts +15 -0
  35. package/dist/generated/models/index.js +15 -0
  36. package/dist/generated/models/otp-generate-result.d.ts +4 -0
  37. package/dist/generated/models/otp-generate-result.js +1 -0
  38. package/dist/generated/models/queue-monitor-workers-response.d.ts +4 -0
  39. package/dist/generated/models/queue-monitor-workers-response.js +1 -0
  40. package/dist/generated/models/risk-flag-request-dto.d.ts +4 -0
  41. package/dist/generated/models/risk-flag-request-dto.js +1 -0
  42. package/dist/generated/models/risk-signal-avg-dto.d.ts +4 -0
  43. package/dist/generated/models/risk-signal-avg-dto.js +1 -0
  44. package/dist/generated/models/risk-signal-client-dto.d.ts +4 -0
  45. package/dist/generated/models/risk-signal-client-dto.js +1 -0
  46. package/dist/generated/models/risk-signal-counts-dto.d.ts +4 -0
  47. package/dist/generated/models/risk-signal-counts-dto.js +1 -0
  48. package/dist/generated/models/risk-signals-dto.d.ts +4 -0
  49. package/dist/generated/models/risk-signals-dto.js +1 -0
  50. package/dist/generated/models/risk-state-dto.d.ts +4 -0
  51. package/dist/generated/models/risk-state-dto.js +1 -0
  52. package/dist/generated/models/risk-verify-dto.d.ts +4 -0
  53. package/dist/generated/models/risk-verify-dto.js +1 -0
  54. package/dist/index.d.ts +1 -0
  55. package/dist/index.js +1 -0
  56. package/dist/rx.d.ts +18 -0
  57. package/dist/security/index.d.ts +4 -0
  58. package/dist/security/index.js +2 -0
  59. package/dist/security/input-security-policy.d.ts +23 -0
  60. package/dist/security/input-security-policy.js +5 -0
  61. package/dist/security/input-security-service.d.ts +3 -0
  62. package/dist/security/input-security-service.js +153 -0
  63. package/dist/security/request-sanitizer.d.ts +18 -0
  64. package/dist/security/request-sanitizer.js +242 -0
  65. package/package.json +9 -4
@@ -0,0 +1,4 @@
1
+ import type { AccessTokenIDataResult as __AccessTokenIDataResult } from "../index.js";
2
+ export declare const AccessTokenIDataResult: __AccessTokenIDataResult;
3
+ export type AccessTokenIDataResult = __AccessTokenIDataResult;
4
+ export type accessTokenIDataResult = __AccessTokenIDataResult;
@@ -0,0 +1 @@
1
+ export const AccessTokenIDataResult = {};
@@ -0,0 +1,4 @@
1
+ import type { AccessToken as __AccessToken } from "../index.js";
2
+ export declare const AccessToken: __AccessToken;
3
+ export type AccessToken = __AccessToken;
4
+ export type accessToken = __AccessToken;
@@ -0,0 +1 @@
1
+ export const AccessToken = {};
@@ -0,0 +1,4 @@
1
+ import type { ApplicationClickEventBatchDto as __ApplicationClickEventBatchDto } from "../index.js";
2
+ export declare const ApplicationClickEventBatchDto: __ApplicationClickEventBatchDto;
3
+ export type ApplicationClickEventBatchDto = __ApplicationClickEventBatchDto;
4
+ export type applicationClickEventBatchDto = __ApplicationClickEventBatchDto;
@@ -0,0 +1 @@
1
+ export const ApplicationClickEventBatchDto = {};
@@ -0,0 +1,4 @@
1
+ import type { ApplicationClickEventCreateDto as __ApplicationClickEventCreateDto } from "../index.js";
2
+ export declare const ApplicationClickEventCreateDto: __ApplicationClickEventCreateDto;
3
+ export type ApplicationClickEventCreateDto = __ApplicationClickEventCreateDto;
4
+ export type applicationClickEventCreateDto = __ApplicationClickEventCreateDto;
@@ -0,0 +1 @@
1
+ export const ApplicationClickEventCreateDto = {};
@@ -0,0 +1,4 @@
1
+ import type { FeedbackCategoryDtoListIDataResult as __FeedbackCategoryDtoListIDataResult } from "../index.js";
2
+ export declare const FeedbackCategoryDtoListIDataResult: __FeedbackCategoryDtoListIDataResult;
3
+ export type FeedbackCategoryDtoListIDataResult = __FeedbackCategoryDtoListIDataResult;
4
+ export type feedbackCategoryDtoListIDataResult = __FeedbackCategoryDtoListIDataResult;
@@ -0,0 +1 @@
1
+ export const FeedbackCategoryDtoListIDataResult = {};
@@ -0,0 +1,4 @@
1
+ import type { FeedbackCategoryDto as __FeedbackCategoryDto } from "../index.js";
2
+ export declare const FeedbackCategoryDto: __FeedbackCategoryDto;
3
+ export type FeedbackCategoryDto = __FeedbackCategoryDto;
4
+ export type feedbackCategoryDto = __FeedbackCategoryDto;
@@ -0,0 +1 @@
1
+ export const FeedbackCategoryDto = {};
@@ -1,3 +1,5 @@
1
+ export * from "./access-token.js";
2
+ export * from "./access-token-i-data-result.js";
1
3
  export * from "./aggregate-exception.js";
2
4
  export * from "./app-state-log.js";
3
5
  export * from "./app-state-log-for-table-dto.js";
@@ -9,6 +11,8 @@ export * from "./app-state-log-for-table-filter-data-table-query.js";
9
11
  export * from "./app-state-log-i-data-result.js";
10
12
  export * from "./app-state-log-list-i-data-result.js";
11
13
  export * from "./application.js";
14
+ export * from "./application-click-event-batch-dto.js";
15
+ export * from "./application-click-event-create-dto.js";
12
16
  export * from "./application-for-table-dto.js";
13
17
  export * from "./application-for-table-dto-list-i-data-result.js";
14
18
  export * from "./application-for-table-dto-list-result-filter.js";
@@ -56,6 +60,8 @@ export * from "./device-list-i-data-result.js";
56
60
  export * from "./event-attributes.js";
57
61
  export * from "./event-info.js";
58
62
  export * from "./exception.js";
63
+ export * from "./feedback-category-dto.js";
64
+ export * from "./feedback-category-dto-list-i-data-result.js";
59
65
  export * from "./field-attributes.js";
60
66
  export * from "./field-info.js";
61
67
  export * from "./field-mapping-result-paginate-dto.js";
@@ -135,12 +141,21 @@ export * from "./operation-claim-for-table-filter.js";
135
141
  export * from "./operation-claim-for-table-filter-data-table-query.js";
136
142
  export * from "./operation-claim-i-data-result.js";
137
143
  export * from "./operation-claim-list-i-data-result.js";
144
+ export * from "./otp-generate-result.js";
138
145
  export * from "./parameter-attributes.js";
139
146
  export * from "./parameter-info.js";
140
147
  export * from "./process-scan-scores-request.js";
141
148
  export * from "./process-scan-static-result-request.js";
142
149
  export * from "./property-attributes.js";
143
150
  export * from "./property-info.js";
151
+ export * from "./queue-monitor-workers-response.js";
152
+ export * from "./risk-flag-request-dto.js";
153
+ export * from "./risk-signal-avg-dto.js";
154
+ export * from "./risk-signal-client-dto.js";
155
+ export * from "./risk-signal-counts-dto.js";
156
+ export * from "./risk-signals-dto.js";
157
+ export * from "./risk-state-dto.js";
158
+ export * from "./risk-verify-dto.js";
144
159
  export * from "./runtime-field-handle.js";
145
160
  export * from "./runtime-method-handle.js";
146
161
  export * from "./runtime-type-handle.js";
@@ -1,3 +1,5 @@
1
+ export * from "./access-token.js";
2
+ export * from "./access-token-i-data-result.js";
1
3
  export * from "./aggregate-exception.js";
2
4
  export * from "./app-state-log.js";
3
5
  export * from "./app-state-log-for-table-dto.js";
@@ -9,6 +11,8 @@ export * from "./app-state-log-for-table-filter-data-table-query.js";
9
11
  export * from "./app-state-log-i-data-result.js";
10
12
  export * from "./app-state-log-list-i-data-result.js";
11
13
  export * from "./application.js";
14
+ export * from "./application-click-event-batch-dto.js";
15
+ export * from "./application-click-event-create-dto.js";
12
16
  export * from "./application-for-table-dto.js";
13
17
  export * from "./application-for-table-dto-list-i-data-result.js";
14
18
  export * from "./application-for-table-dto-list-result-filter.js";
@@ -56,6 +60,8 @@ export * from "./device-list-i-data-result.js";
56
60
  export * from "./event-attributes.js";
57
61
  export * from "./event-info.js";
58
62
  export * from "./exception.js";
63
+ export * from "./feedback-category-dto.js";
64
+ export * from "./feedback-category-dto-list-i-data-result.js";
59
65
  export * from "./field-attributes.js";
60
66
  export * from "./field-info.js";
61
67
  export * from "./field-mapping-result-paginate-dto.js";
@@ -135,12 +141,21 @@ export * from "./operation-claim-for-table-filter.js";
135
141
  export * from "./operation-claim-for-table-filter-data-table-query.js";
136
142
  export * from "./operation-claim-i-data-result.js";
137
143
  export * from "./operation-claim-list-i-data-result.js";
144
+ export * from "./otp-generate-result.js";
138
145
  export * from "./parameter-attributes.js";
139
146
  export * from "./parameter-info.js";
140
147
  export * from "./process-scan-scores-request.js";
141
148
  export * from "./process-scan-static-result-request.js";
142
149
  export * from "./property-attributes.js";
143
150
  export * from "./property-info.js";
151
+ export * from "./queue-monitor-workers-response.js";
152
+ export * from "./risk-flag-request-dto.js";
153
+ export * from "./risk-signal-avg-dto.js";
154
+ export * from "./risk-signal-client-dto.js";
155
+ export * from "./risk-signal-counts-dto.js";
156
+ export * from "./risk-signals-dto.js";
157
+ export * from "./risk-state-dto.js";
158
+ export * from "./risk-verify-dto.js";
144
159
  export * from "./runtime-field-handle.js";
145
160
  export * from "./runtime-method-handle.js";
146
161
  export * from "./runtime-type-handle.js";
@@ -0,0 +1,4 @@
1
+ import type { OtpGenerateResult as __OtpGenerateResult } from "../index.js";
2
+ export declare const OtpGenerateResult: __OtpGenerateResult;
3
+ export type OtpGenerateResult = __OtpGenerateResult;
4
+ export type otpGenerateResult = __OtpGenerateResult;
@@ -0,0 +1 @@
1
+ export const OtpGenerateResult = {};
@@ -0,0 +1,4 @@
1
+ import type { QueueMonitorWorkersResponse as __QueueMonitorWorkersResponse } from "../index.js";
2
+ export declare const QueueMonitorWorkersResponse: __QueueMonitorWorkersResponse;
3
+ export type QueueMonitorWorkersResponse = __QueueMonitorWorkersResponse;
4
+ export type queueMonitorWorkersResponse = __QueueMonitorWorkersResponse;
@@ -0,0 +1 @@
1
+ export const QueueMonitorWorkersResponse = {};
@@ -0,0 +1,4 @@
1
+ import type { RiskFlagRequestDto as __RiskFlagRequestDto } from "../index.js";
2
+ export declare const RiskFlagRequestDto: __RiskFlagRequestDto;
3
+ export type RiskFlagRequestDto = __RiskFlagRequestDto;
4
+ export type riskFlagRequestDto = __RiskFlagRequestDto;
@@ -0,0 +1 @@
1
+ export const RiskFlagRequestDto = {};
@@ -0,0 +1,4 @@
1
+ import type { RiskSignalAvgDto as __RiskSignalAvgDto } from "../index.js";
2
+ export declare const RiskSignalAvgDto: __RiskSignalAvgDto;
3
+ export type RiskSignalAvgDto = __RiskSignalAvgDto;
4
+ export type riskSignalAvgDto = __RiskSignalAvgDto;
@@ -0,0 +1 @@
1
+ export const RiskSignalAvgDto = {};
@@ -0,0 +1,4 @@
1
+ import type { RiskSignalClientDto as __RiskSignalClientDto } from "../index.js";
2
+ export declare const RiskSignalClientDto: __RiskSignalClientDto;
3
+ export type RiskSignalClientDto = __RiskSignalClientDto;
4
+ export type riskSignalClientDto = __RiskSignalClientDto;
@@ -0,0 +1 @@
1
+ export const RiskSignalClientDto = {};
@@ -0,0 +1,4 @@
1
+ import type { RiskSignalCountsDto as __RiskSignalCountsDto } from "../index.js";
2
+ export declare const RiskSignalCountsDto: __RiskSignalCountsDto;
3
+ export type RiskSignalCountsDto = __RiskSignalCountsDto;
4
+ export type riskSignalCountsDto = __RiskSignalCountsDto;
@@ -0,0 +1 @@
1
+ export const RiskSignalCountsDto = {};
@@ -0,0 +1,4 @@
1
+ import type { RiskSignalsDto as __RiskSignalsDto } from "../index.js";
2
+ export declare const RiskSignalsDto: __RiskSignalsDto;
3
+ export type RiskSignalsDto = __RiskSignalsDto;
4
+ export type riskSignalsDto = __RiskSignalsDto;
@@ -0,0 +1 @@
1
+ export const RiskSignalsDto = {};
@@ -0,0 +1,4 @@
1
+ import type { RiskStateDto as __RiskStateDto } from "../index.js";
2
+ export declare const RiskStateDto: __RiskStateDto;
3
+ export type RiskStateDto = __RiskStateDto;
4
+ export type riskStateDto = __RiskStateDto;
@@ -0,0 +1 @@
1
+ export const RiskStateDto = {};
@@ -0,0 +1,4 @@
1
+ import type { RiskVerifyDto as __RiskVerifyDto } from "../index.js";
2
+ export declare const RiskVerifyDto: __RiskVerifyDto;
3
+ export type RiskVerifyDto = __RiskVerifyDto;
4
+ export type riskVerifyDto = __RiskVerifyDto;
@@ -0,0 +1 @@
1
+ export const RiskVerifyDto = {};
package/dist/index.d.ts CHANGED
@@ -5,3 +5,4 @@ export * from "./generated/models/index.js";
5
5
  export * from "./rx.js";
6
6
  export * from "./container.js";
7
7
  export * from "./base-models.js";
8
+ export * as security from "./security/index.js";
package/dist/index.js CHANGED
@@ -5,3 +5,4 @@ export * from "./generated/models/index.js";
5
5
  export * from "./rx.js";
6
6
  export * from "./container.js";
7
7
  export * from "./base-models.js";
8
+ export * as security from "./security/index.js";
package/dist/rx.d.ts CHANGED
@@ -36,6 +36,9 @@ export declare function createAllClients(cfg: ApiClientConfig, baseUrl?: string,
36
36
  DevicesClient: ClientCtors.DevicesClient;
37
37
  DevicesService: ClientCtors.DevicesClient;
38
38
  devicesService: ClientCtors.DevicesClient;
39
+ DiagnosticsClient: ClientCtors.DiagnosticsClient;
40
+ DiagnosticsService: ClientCtors.DiagnosticsClient;
41
+ diagnosticsService: ClientCtors.DiagnosticsClient;
39
42
  FeedbacksClient: ClientCtors.FeedbacksClient;
40
43
  FeedbacksService: ClientCtors.FeedbacksClient;
41
44
  feedbacksService: ClientCtors.FeedbacksClient;
@@ -60,6 +63,9 @@ export declare function createAllClients(cfg: ApiClientConfig, baseUrl?: string,
60
63
  OperationClaimsClient: ClientCtors.OperationClaimsClient;
61
64
  OperationClaimsService: ClientCtors.OperationClaimsClient;
62
65
  operationClaimsService: ClientCtors.OperationClaimsClient;
66
+ PortalClient: ClientCtors.PortalClient;
67
+ PortalService: ClientCtors.PortalClient;
68
+ portalService: ClientCtors.PortalClient;
63
69
  QueueMonitorClient: ClientCtors.QueueMonitorClient;
64
70
  QueueMonitorService: ClientCtors.QueueMonitorClient;
65
71
  queueMonitorService: ClientCtors.QueueMonitorClient;
@@ -69,6 +75,9 @@ export declare function createAllClients(cfg: ApiClientConfig, baseUrl?: string,
69
75
  HealthClient: ClientCtors.HealthClient;
70
76
  HealthService: ClientCtors.HealthClient;
71
77
  healthService: ClientCtors.HealthClient;
78
+ RiskClient: ClientCtors.RiskClient;
79
+ RiskService: ClientCtors.RiskClient;
80
+ riskService: ClientCtors.RiskClient;
72
81
  ScanApiBusSourcesClient: ClientCtors.ScanApiBusSourcesClient;
73
82
  ScanApiBusSourcesService: ClientCtors.ScanApiBusSourcesClient;
74
83
  scanApiBusSourcesService: ClientCtors.ScanApiBusSourcesClient;
@@ -266,6 +275,9 @@ export declare function createAllRxClients(cfg: ApiClientConfig, baseUrl?: strin
266
275
  DevicesClient: Rxified<ClientCtors.DevicesClient>;
267
276
  DevicesService: Rxified<ClientCtors.DevicesClient>;
268
277
  devicesService: Rxified<ClientCtors.DevicesClient>;
278
+ DiagnosticsClient: Rxified<ClientCtors.DiagnosticsClient>;
279
+ DiagnosticsService: Rxified<ClientCtors.DiagnosticsClient>;
280
+ diagnosticsService: Rxified<ClientCtors.DiagnosticsClient>;
269
281
  FeedbacksClient: Rxified<ClientCtors.FeedbacksClient>;
270
282
  FeedbacksService: Rxified<ClientCtors.FeedbacksClient>;
271
283
  feedbacksService: Rxified<ClientCtors.FeedbacksClient>;
@@ -290,6 +302,9 @@ export declare function createAllRxClients(cfg: ApiClientConfig, baseUrl?: strin
290
302
  OperationClaimsClient: Rxified<ClientCtors.OperationClaimsClient>;
291
303
  OperationClaimsService: Rxified<ClientCtors.OperationClaimsClient>;
292
304
  operationClaimsService: Rxified<ClientCtors.OperationClaimsClient>;
305
+ PortalClient: Rxified<ClientCtors.PortalClient>;
306
+ PortalService: Rxified<ClientCtors.PortalClient>;
307
+ portalService: Rxified<ClientCtors.PortalClient>;
293
308
  QueueMonitorClient: Rxified<ClientCtors.QueueMonitorClient>;
294
309
  QueueMonitorService: Rxified<ClientCtors.QueueMonitorClient>;
295
310
  queueMonitorService: Rxified<ClientCtors.QueueMonitorClient>;
@@ -299,6 +314,9 @@ export declare function createAllRxClients(cfg: ApiClientConfig, baseUrl?: strin
299
314
  HealthClient: Rxified<ClientCtors.HealthClient>;
300
315
  HealthService: Rxified<ClientCtors.HealthClient>;
301
316
  healthService: Rxified<ClientCtors.HealthClient>;
317
+ RiskClient: Rxified<ClientCtors.RiskClient>;
318
+ RiskService: Rxified<ClientCtors.RiskClient>;
319
+ riskService: Rxified<ClientCtors.RiskClient>;
302
320
  ScanApiBusSourcesClient: Rxified<ClientCtors.ScanApiBusSourcesClient>;
303
321
  ScanApiBusSourcesService: Rxified<ClientCtors.ScanApiBusSourcesClient>;
304
322
  scanApiBusSourcesService: Rxified<ClientCtors.ScanApiBusSourcesClient>;
@@ -0,0 +1,4 @@
1
+ export type { InputPolicyKind, ThreatType, ThreatDetail, InputSecurityResult, InputSecurityPolicy, } from "./input-security-policy.js";
2
+ export { sanitize, detect } from "./input-security-service.js";
3
+ export { validatePath, validateAbsoluteUrl, sanitizeBody, sanitizeFormDataFileName, sanitizeHeaderValue, } from "./request-sanitizer.js";
4
+ export type { SanitizeBodyResult } from "./request-sanitizer.js";
@@ -0,0 +1,2 @@
1
+ export { sanitize, detect } from "./input-security-service.js";
2
+ export { validatePath, validateAbsoluteUrl, sanitizeBody, sanitizeFormDataFileName, sanitizeHeaderValue, } from "./request-sanitizer.js";
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Input Security Policy types for the API client.
3
+ * Aligned with VirusProof-main Core InputPolicyKind.
4
+ */
5
+ export type InputPolicyKind = "scanName" | "url" | "ip" | "sha256" | "sha1" | "md5" | "email" | "freeTextShort" | "freeTextLong" | "scanDisplayName" | "otp" | "captchaToken" | "password" | "enum" | "date" | "fileName" | "routeSegment" | "queryText" | "headerValue" | "guid" | "scanMode" | "engineIdsJson" | "analysisIdsJson" | "workerPayload" | "jsonPayload";
6
+ export type ThreatType = "xss" | "sql-injection" | "nosql-injection" | "ssti" | "command-injection" | "path-traversal" | "log-injection" | "header-injection" | "ssrf" | "prototype-pollution";
7
+ export interface ThreatDetail {
8
+ type: ThreatType;
9
+ severity: "low" | "medium" | "high" | "critical";
10
+ message: string;
11
+ }
12
+ export interface InputSecurityResult {
13
+ sanitized: string;
14
+ modified: boolean;
15
+ blocked: boolean;
16
+ detectedThreats: ThreatDetail[];
17
+ }
18
+ export interface InputSecurityPolicy {
19
+ kind: InputPolicyKind;
20
+ maxLength: number;
21
+ sanitizerChain: ThreatType[];
22
+ blockOnDetection: boolean;
23
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Input Security Policy types for the API client.
3
+ * Aligned with VirusProof-main Core InputPolicyKind.
4
+ */
5
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { InputPolicyKind, InputSecurityResult, ThreatDetail } from "./input-security-policy.js";
2
+ export declare function sanitize(kind: InputPolicyKind, value: string | null | undefined, fieldName?: string): InputSecurityResult;
3
+ export declare function detect(kind: InputPolicyKind, value: string): ThreatDetail[];
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Lightweight client-side input security service.
3
+ * NOT authoritative — server is the trust boundary.
4
+ * This provides early rejection and UX feedback.
5
+ */
6
+ // ─── Pattern definitions ────────────────────────────────────────
7
+ const XSS_PATTERNS = [
8
+ /<script\b/i,
9
+ /javascript\s*:/i,
10
+ /on(?:load|error|click|mouse|focus|blur|change|submit)\s*=/i,
11
+ /<\s*(?:iframe|object|embed|svg|math|form|input)\b/i,
12
+ /expression\s*\(/i,
13
+ ];
14
+ const SQL_PATTERNS = [
15
+ /'\s*(?:OR|AND)\s+.+?(?:=|--|;)/i,
16
+ /;\s*(?:DROP|ALTER|DELETE|INSERT|UPDATE|EXEC)\b/i,
17
+ /\bUNION\s+(?:ALL\s+)?SELECT\b/i,
18
+ /\b(?:WAITFOR\s+DELAY|BENCHMARK\s*\(|SLEEP\s*\()/i,
19
+ /\bINFORMATION_SCHEMA\b/i,
20
+ /\b(?:OrderBy|Where|FromSqlRaw|ExecuteSqlRaw)\s*\(/i,
21
+ ];
22
+ const NOSQL_PATTERNS = [
23
+ /\$\s*(?:ne|gt|gte|lt|lte|in|nin|exists|regex|where|or|and)\b/i,
24
+ /\{\s*"\$/,
25
+ ];
26
+ const SSTI_PATTERNS = [/\{\{.*?\}\}/, /\$\{.*?\}/, /\{%.*?%\}/];
27
+ const CMD_PATTERNS = [
28
+ /[;&|`]/,
29
+ /\$\(/,
30
+ /\b(?:whoami|cat|wget|curl|bash|sh|rm|nc)\b/i,
31
+ ];
32
+ const PATH_PATTERNS = [
33
+ /\.\.[/\\]/,
34
+ /%2e%2e[%2f%5c/\\]/i,
35
+ /%00/,
36
+ /\x00/,
37
+ ];
38
+ const CRLF_PATTERN = /[\r\n]/;
39
+ const CONTROL_CHARS = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/;
40
+ const PROTOTYPE_POLLUTION_PATTERNS = [
41
+ /"__proto__"\s*:/,
42
+ /"constructor"\s*:/,
43
+ /"prototype"\s*:/,
44
+ /__proto__/,
45
+ ];
46
+ const SSRF_PATTERNS = [
47
+ /^(?:javascript|data|file|vbscript|ftp|gopher|dict|ldap):/i,
48
+ /:\/\/(?:localhost|127\.0\.0\.1|\[::1\])/i,
49
+ /:\/\/169\.254\.169\.254/,
50
+ /:\/\/100\.100\.100\.200/,
51
+ /:\/\/metadata\.google\.internal/i,
52
+ /:\/\/10\.\d{1,3}\.\d{1,3}\.\d{1,3}/,
53
+ /:\/\/172\.(?:1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3}/,
54
+ /:\/\/192\.168\.\d{1,3}\.\d{1,3}/,
55
+ /:\/\/[^/]*@/, // user:pass@host
56
+ ];
57
+ const POLICIES = {
58
+ scanName: { maxLength: 128, block: true, checks: ["xss", "sql-injection", "command-injection", "ssti", "path-traversal", "log-injection", "header-injection"] },
59
+ url: { maxLength: 2048, block: true, checks: ["xss", "command-injection", "path-traversal", "header-injection", "ssrf"] },
60
+ ip: { maxLength: 45, block: true, checks: ["command-injection", "log-injection"] },
61
+ sha256: { maxLength: 64, block: true, checks: ["xss", "sql-injection", "command-injection", "path-traversal", "log-injection"] },
62
+ sha1: { maxLength: 40, block: true, checks: ["xss", "sql-injection", "command-injection", "path-traversal", "log-injection"] },
63
+ md5: { maxLength: 32, block: true, checks: ["xss", "sql-injection", "command-injection", "path-traversal", "log-injection"] },
64
+ email: { maxLength: 254, block: true, checks: ["xss", "sql-injection", "command-injection", "header-injection"] },
65
+ freeTextShort: { maxLength: 256, block: false, checks: ["xss", "sql-injection", "nosql-injection", "ssti", "command-injection", "path-traversal", "log-injection", "header-injection"] },
66
+ freeTextLong: { maxLength: 5000, block: false, checks: ["xss", "sql-injection", "nosql-injection", "ssti", "command-injection", "path-traversal", "log-injection", "header-injection"] },
67
+ scanDisplayName: { maxLength: 512, block: false, checks: ["xss", "sql-injection", "nosql-injection", "ssti", "command-injection", "path-traversal", "log-injection", "header-injection"] },
68
+ otp: { maxLength: 10, block: true, checks: ["sql-injection", "header-injection"] },
69
+ captchaToken: { maxLength: 4096, block: false, checks: [] },
70
+ password: { maxLength: 256, block: false, checks: [] },
71
+ enum: { maxLength: 64, block: true, checks: ["sql-injection", "command-injection", "log-injection"] },
72
+ date: { maxLength: 32, block: true, checks: ["sql-injection", "command-injection"] },
73
+ fileName: { maxLength: 255, block: true, checks: ["path-traversal", "command-injection", "xss", "log-injection"] },
74
+ routeSegment: { maxLength: 256, block: true, checks: ["path-traversal", "sql-injection", "command-injection", "header-injection"] },
75
+ queryText: { maxLength: 512, block: false, checks: ["xss", "sql-injection", "nosql-injection", "ssti", "command-injection", "path-traversal"] },
76
+ headerValue: { maxLength: 8192, block: true, checks: ["header-injection", "log-injection"] },
77
+ guid: { maxLength: 36, block: true, checks: ["sql-injection", "log-injection"] },
78
+ scanMode: { maxLength: 16, block: true, checks: ["sql-injection", "command-injection", "log-injection"] },
79
+ engineIdsJson: { maxLength: 4096, block: true, checks: ["nosql-injection", "sql-injection", "xss", "command-injection", "log-injection", "prototype-pollution"] },
80
+ analysisIdsJson: { maxLength: 8192, block: true, checks: ["nosql-injection", "sql-injection", "xss", "command-injection", "log-injection", "prototype-pollution"] },
81
+ workerPayload: { maxLength: 65536, block: true, checks: ["sql-injection", "nosql-injection", "command-injection", "xss", "ssti", "log-injection", "header-injection", "prototype-pollution"] },
82
+ jsonPayload: { maxLength: 65536, block: false, checks: ["sql-injection", "nosql-injection", "xss", "ssti", "command-injection", "log-injection", "prototype-pollution"] },
83
+ };
84
+ // ─── Core logic ─────────────────────────────────────────────────
85
+ function checkPatterns(input, type) {
86
+ const patterns = type === "xss" ? XSS_PATTERNS
87
+ : type === "sql-injection" ? SQL_PATTERNS
88
+ : type === "nosql-injection" ? NOSQL_PATTERNS
89
+ : type === "ssti" ? SSTI_PATTERNS
90
+ : type === "command-injection" ? CMD_PATTERNS
91
+ : type === "path-traversal" ? PATH_PATTERNS
92
+ : type === "log-injection" ? [CRLF_PATTERN]
93
+ : type === "header-injection" ? [CRLF_PATTERN, CONTROL_CHARS]
94
+ : type === "ssrf" ? SSRF_PATTERNS
95
+ : type === "prototype-pollution" ? PROTOTYPE_POLLUTION_PATTERNS
96
+ : [];
97
+ for (const p of patterns) {
98
+ if (p.test(input)) {
99
+ return {
100
+ type,
101
+ severity: type === "sql-injection" || type === "command-injection" || type === "ssrf" || type === "prototype-pollution" ? "critical" : "high",
102
+ message: `${type} pattern detected`,
103
+ };
104
+ }
105
+ }
106
+ return null;
107
+ }
108
+ export function sanitize(kind, value, fieldName = "") {
109
+ if (!value) {
110
+ return { sanitized: value ?? "", modified: false, blocked: false, detectedThreats: [] };
111
+ }
112
+ const policy = POLICIES[kind];
113
+ let current = value.trim();
114
+ let modified = false;
115
+ // Max length
116
+ if (current.length > policy.maxLength) {
117
+ current = current.slice(0, policy.maxLength);
118
+ modified = true;
119
+ }
120
+ // CR/LF sanitize for all
121
+ if (CRLF_PATTERN.test(current)) {
122
+ current = current.replace(/[\r\n]/g, " ");
123
+ modified = true;
124
+ }
125
+ if (CONTROL_CHARS.test(current)) {
126
+ current = current.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g, "");
127
+ modified = true;
128
+ }
129
+ // Run checks
130
+ const threats = [];
131
+ for (const check of policy.checks) {
132
+ const threat = checkPatterns(current, check);
133
+ if (threat)
134
+ threats.push(threat);
135
+ }
136
+ const blocked = policy.block && threats.length > 0;
137
+ return {
138
+ sanitized: blocked ? "" : current,
139
+ modified: modified || current !== value,
140
+ blocked,
141
+ detectedThreats: threats,
142
+ };
143
+ }
144
+ export function detect(kind, value) {
145
+ const policy = POLICIES[kind];
146
+ const threats = [];
147
+ for (const check of policy.checks) {
148
+ const threat = checkPatterns(value, check);
149
+ if (threat)
150
+ threats.push(threat);
151
+ }
152
+ return threats;
153
+ }
@@ -0,0 +1,18 @@
1
+ import type { InputSecurityResult } from "./input-security-policy.js";
2
+ export declare function validatePath(path: string): {
3
+ safe: boolean;
4
+ sanitized: string;
5
+ };
6
+ export declare function validateAbsoluteUrl(url: string, trustedHosts: string[]): {
7
+ safe: boolean;
8
+ reason?: string;
9
+ };
10
+ export interface SanitizeBodyResult {
11
+ body: Record<string, unknown>;
12
+ modified: boolean;
13
+ blocked: boolean;
14
+ threats: InputSecurityResult[];
15
+ }
16
+ export declare function sanitizeBody(body: Record<string, unknown>, depth?: number, visited?: WeakSet<object>): SanitizeBodyResult;
17
+ export declare function sanitizeFormDataFileName(filename: string): string;
18
+ export declare function sanitizeHeaderValue(value: string): string;