@j3r3mcdev/oast-server 1.1.4 → 1.1.6

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 (93) hide show
  1. package/.github/workflows/ci.yml +29 -29
  2. package/.github/workflows/publish.yml +31 -31
  3. package/README.md +192 -192
  4. package/jest.config.js +14 -14
  5. package/package.json +45 -45
  6. package/sadmin list shadows +9 -9
  7. package/src/api/controllers/__tests__/tasks.controller.test.ts +74 -74
  8. package/src/api/controllers/events.controller.ts +10 -10
  9. package/src/api/controllers/health.controller.ts +7 -7
  10. package/src/api/controllers/tasks.controller.ts +41 -41
  11. package/src/api/dto/__tests__/create-task.dto.test.ts +41 -41
  12. package/src/api/dto/__tests__/filter-tasks.dto.test.ts +35 -35
  13. package/src/api/dto/create-task.dto.ts +33 -33
  14. package/src/api/dto/filter-tasks.dto.ts +33 -33
  15. package/src/api/services/__tests__/events.service.test.ts +41 -41
  16. package/src/api/services/__tests__/tasks.service.test.ts +41 -41
  17. package/src/api/services/events.service.ts +17 -17
  18. package/src/api/services/tasks.service.ts +79 -79
  19. package/src/api/sse/events.stream.ts +90 -90
  20. package/src/bootstrap.ts +89 -89
  21. package/src/core/__tests__/core-router.test.ts +30 -30
  22. package/src/core/__tests__/core-server.test.ts +44 -44
  23. package/src/core/__tests__/event.normalizer.test.ts +56 -56
  24. package/src/core/__tests__/event.router.test.ts +89 -89
  25. package/src/core/__tests__/logger.test.ts +32 -32
  26. package/src/core/__tests__/storage-manager.test.ts +74 -74
  27. package/src/core/event.normalizer.ts +147 -147
  28. package/src/core/event.router.ts +13 -13
  29. package/src/core/http/__tests__/adapter-node.test.ts +52 -52
  30. package/src/core/http/__tests__/body-parser-multipart.test.ts +41 -41
  31. package/src/core/http/__tests__/body-parser-raw.test.ts +28 -28
  32. package/src/core/http/__tests__/body-parser-text.test.ts +28 -28
  33. package/src/core/http/__tests__/compile-path.test.ts +39 -39
  34. package/src/core/http/__tests__/middleware-pipeline.test.ts +51 -51
  35. package/src/core/http/__tests__/request.test.ts +34 -34
  36. package/src/core/http/__tests__/response.test.ts +35 -35
  37. package/src/core/http/__tests__/router-match.test.ts +171 -171
  38. package/src/core/http/adapter-node.ts +51 -51
  39. package/src/core/http/buildRequest.ts +18 -18
  40. package/src/core/http/compile-path.ts +32 -32
  41. package/src/core/http/errors.ts +37 -37
  42. package/src/core/http/http-server.ts +52 -52
  43. package/src/core/http/middleware.ts +160 -160
  44. package/src/core/http/request.ts +55 -55
  45. package/src/core/http/response.ts +93 -93
  46. package/src/core/http/router.ts +138 -138
  47. package/src/core/id-generator.ts +8 -8
  48. package/src/core/logger.ts +113 -113
  49. package/src/core/router.ts +44 -44
  50. package/src/core/server.ts +85 -85
  51. package/src/core/storage.ts +64 -64
  52. package/src/index.ts +14 -12
  53. package/src/listeners/api/__tests__/api.controller.test.ts +116 -116
  54. package/src/listeners/api/__tests__/api.extractor.test.ts +46 -46
  55. package/src/listeners/api/__tests__/api.listener.test.ts +82 -82
  56. package/src/listeners/api/__tests__/api.routes.test.ts +155 -155
  57. package/src/listeners/api/__tests__/api.sse.test.ts +105 -105
  58. package/src/listeners/api/api.controllers.ts +67 -67
  59. package/src/listeners/api/api.extractor.ts +43 -43
  60. package/src/listeners/api/api.listener.ts +50 -50
  61. package/src/listeners/api/api.routes.ts +76 -76
  62. package/src/listeners/api/api.sse.ts +38 -38
  63. package/src/listeners/dns/__tests__/dns.test.ts +118 -118
  64. package/src/listeners/dns/dns.extractor.ts +14 -14
  65. package/src/listeners/dns/dns.listener.ts +61 -61
  66. package/src/listeners/http/__tests__/http.extractor.test.ts +59 -59
  67. package/src/listeners/http/__tests__/http.listener.test.ts +133 -133
  68. package/src/listeners/http/http.extractor.ts +15 -15
  69. package/src/listeners/http/http.listener.ts +110 -110
  70. package/src/listeners/listener.interface.ts +4 -4
  71. package/src/listeners/smtp/__tests__/smtp.extractor.test.ts +69 -69
  72. package/src/listeners/smtp/__tests__/smtp.listener.test.ts +150 -150
  73. package/src/listeners/smtp/smtp.extractor.ts +18 -18
  74. package/src/listeners/smtp/smtp.listener.ts +60 -60
  75. package/src/listeners/ssrf/__tests__/ssrf.extractor.test.ts +41 -41
  76. package/src/listeners/ssrf/__tests__/ssrf.listener.test.ts +87 -87
  77. package/src/listeners/ssrf/ssrf.extractor.ts +14 -14
  78. package/src/listeners/ssrf/ssrf.listener.ts +37 -37
  79. package/src/listeners/tcp/tcp.extractor.ts +16 -16
  80. package/src/listeners/tcp/tcp.listener.ts +61 -61
  81. package/src/listeners/webhook/__tests__/webhook.extractor.test.ts +35 -35
  82. package/src/listeners/webhook/__tests__/webhook.listener.test.ts +122 -122
  83. package/src/listeners/webhook/webhook.extractor.ts +12 -12
  84. package/src/listeners/webhook/webhook.listener.ts +58 -58
  85. package/src/listeners/websocket/__tests__/websocket.extractor.test.ts +33 -33
  86. package/src/listeners/websocket/__tests__/websocket.listener.test.ts +90 -90
  87. package/src/listeners/websocket/websocket.extractor.ts +11 -11
  88. package/src/listeners/websocket/websocket.listener.ts +40 -40
  89. package/src/storage-adapters/adapters/__tests__/memory.storage.test.ts +75 -75
  90. package/src/storage-adapters/adapters/memory.storage.ts +64 -64
  91. package/src/storage-adapters/storage.interface.ts +26 -26
  92. package/src/types/event.types.ts +147 -147
  93. package/tsconfig.json +21 -21
@@ -1,147 +1,147 @@
1
- //
2
- // RAW EVENTS
3
- //
4
- export interface RawEvent {
5
- ip: string;
6
- method: string;
7
- path: string;
8
- headers: Record<string, string | string[] | undefined>;
9
- query: Record<string, any>;
10
- body: any;
11
- raw: any;
12
- }
13
-
14
- export interface RawDnsEvent {
15
- ip: string;
16
- query: string;
17
- recordType: string;
18
- raw: any;
19
- }
20
-
21
- export interface RawSmtpEvent {
22
- ip: string;
23
- from: string;
24
- to: string[];
25
- subject: string;
26
- body: string;
27
- raw: any;
28
- }
29
-
30
- export interface RawTcpEvent {
31
- ip: string;
32
- port: number;
33
- data: string;
34
- raw: any;
35
- }
36
-
37
- export interface RawSsrfEvent {
38
- ip: string;
39
- method: string | undefined;
40
- path: string | undefined;
41
- headers: Record<string, string | string[] | undefined>;
42
- query: Record<string, any>;
43
- raw: any;
44
- }
45
-
46
- export interface RawWebhookEvent {
47
- ip: string;
48
- headers: Record<string, string | string[] | undefined>;
49
- body: any;
50
- raw: any;
51
- }
52
-
53
- export interface RawWebSocketEvent {
54
- ip: string;
55
- message: string;
56
- raw: any;
57
- }
58
-
59
- //
60
- // NORMALIZED EVENTS
61
- //
62
- export interface NormalizedHttpEvent {
63
- id: string;
64
- type: "http";
65
- timestamp: number;
66
- sourceIp: string;
67
- request: {
68
- method: string;
69
- path: string;
70
- headers: Record<string, string | string[] | undefined>;
71
- query: Record<string, any>;
72
- body: any;
73
- };
74
- }
75
-
76
- export interface NormalizedDnsEvent {
77
- id: string;
78
- type: "dns";
79
- timestamp: number;
80
- ip: string;
81
- query: string;
82
- recordType: string;
83
- raw: any;
84
- }
85
-
86
- export interface NormalizedSmtpEvent {
87
- id: string;
88
- type: "smtp";
89
- timestamp: number;
90
- ip: string;
91
- from: string;
92
- to: string[];
93
- subject: string;
94
- body: string;
95
- raw: any;
96
- }
97
-
98
- export interface NormalizedTcpEvent {
99
- id: string;
100
- type: "tcp";
101
- timestamp: number;
102
- ip: string;
103
- port: number;
104
- data: string;
105
- raw: any;
106
- }
107
- export interface NormalizedSsrfEvent {
108
- id: string;
109
- type: "ssrf";
110
- timestamp: number;
111
- sourceIp: string;
112
- request: {
113
- method: string | undefined;
114
- path: string | undefined;
115
- headers: Record<string, string | string[] | undefined>;
116
- query: Record<string, any>;
117
- };
118
- }
119
-
120
- export interface NormalizedWebhookEvent {
121
- id: string;
122
- type: "webhook";
123
- timestamp: number;
124
- sourceIp: string;
125
- headers: Record<string, string | string[] | undefined>;
126
- body: any;
127
- }
128
-
129
- export interface NormalizedWebSocketEvent {
130
- id: string;
131
- type: "websocket";
132
- timestamp: number;
133
- sourceIp: string;
134
- message: string;
135
- }
136
-
137
- //
138
- // UNION
139
- //
140
- export type AnyNormalizedEvent =
141
- | NormalizedHttpEvent
142
- | NormalizedDnsEvent
143
- | NormalizedSmtpEvent
144
- | NormalizedTcpEvent
145
- | NormalizedSsrfEvent
146
- | NormalizedWebhookEvent
147
- | NormalizedWebSocketEvent;
1
+ //
2
+ // RAW EVENTS
3
+ //
4
+ export interface RawEvent {
5
+ ip: string;
6
+ method: string;
7
+ path: string;
8
+ headers: Record<string, string | string[] | undefined>;
9
+ query: Record<string, any>;
10
+ body: any;
11
+ raw: any;
12
+ }
13
+
14
+ export interface RawDnsEvent {
15
+ ip: string;
16
+ query: string;
17
+ recordType: string;
18
+ raw: any;
19
+ }
20
+
21
+ export interface RawSmtpEvent {
22
+ ip: string;
23
+ from: string;
24
+ to: string[];
25
+ subject: string;
26
+ body: string;
27
+ raw: any;
28
+ }
29
+
30
+ export interface RawTcpEvent {
31
+ ip: string;
32
+ port: number;
33
+ data: string;
34
+ raw: any;
35
+ }
36
+
37
+ export interface RawSsrfEvent {
38
+ ip: string;
39
+ method: string | undefined;
40
+ path: string | undefined;
41
+ headers: Record<string, string | string[] | undefined>;
42
+ query: Record<string, any>;
43
+ raw: any;
44
+ }
45
+
46
+ export interface RawWebhookEvent {
47
+ ip: string;
48
+ headers: Record<string, string | string[] | undefined>;
49
+ body: any;
50
+ raw: any;
51
+ }
52
+
53
+ export interface RawWebSocketEvent {
54
+ ip: string;
55
+ message: string;
56
+ raw: any;
57
+ }
58
+
59
+ //
60
+ // NORMALIZED EVENTS
61
+ //
62
+ export interface NormalizedHttpEvent {
63
+ id: string;
64
+ type: "http";
65
+ timestamp: number;
66
+ sourceIp: string;
67
+ request: {
68
+ method: string;
69
+ path: string;
70
+ headers: Record<string, string | string[] | undefined>;
71
+ query: Record<string, any>;
72
+ body: any;
73
+ };
74
+ }
75
+
76
+ export interface NormalizedDnsEvent {
77
+ id: string;
78
+ type: "dns";
79
+ timestamp: number;
80
+ ip: string;
81
+ query: string;
82
+ recordType: string;
83
+ raw: any;
84
+ }
85
+
86
+ export interface NormalizedSmtpEvent {
87
+ id: string;
88
+ type: "smtp";
89
+ timestamp: number;
90
+ ip: string;
91
+ from: string;
92
+ to: string[];
93
+ subject: string;
94
+ body: string;
95
+ raw: any;
96
+ }
97
+
98
+ export interface NormalizedTcpEvent {
99
+ id: string;
100
+ type: "tcp";
101
+ timestamp: number;
102
+ ip: string;
103
+ port: number;
104
+ data: string;
105
+ raw: any;
106
+ }
107
+ export interface NormalizedSsrfEvent {
108
+ id: string;
109
+ type: "ssrf";
110
+ timestamp: number;
111
+ sourceIp: string;
112
+ request: {
113
+ method: string | undefined;
114
+ path: string | undefined;
115
+ headers: Record<string, string | string[] | undefined>;
116
+ query: Record<string, any>;
117
+ };
118
+ }
119
+
120
+ export interface NormalizedWebhookEvent {
121
+ id: string;
122
+ type: "webhook";
123
+ timestamp: number;
124
+ sourceIp: string;
125
+ headers: Record<string, string | string[] | undefined>;
126
+ body: any;
127
+ }
128
+
129
+ export interface NormalizedWebSocketEvent {
130
+ id: string;
131
+ type: "websocket";
132
+ timestamp: number;
133
+ sourceIp: string;
134
+ message: string;
135
+ }
136
+
137
+ //
138
+ // UNION
139
+ //
140
+ export type AnyNormalizedEvent =
141
+ | NormalizedHttpEvent
142
+ | NormalizedDnsEvent
143
+ | NormalizedSmtpEvent
144
+ | NormalizedTcpEvent
145
+ | NormalizedSsrfEvent
146
+ | NormalizedWebhookEvent
147
+ | NormalizedWebSocketEvent;
package/tsconfig.json CHANGED
@@ -1,21 +1,21 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "CommonJS",
5
-
6
- "rootDir": "src",
7
- "outDir": "dist",
8
-
9
- "declaration": true,
10
- "declarationDir": "dist",
11
- "emitDeclarationOnly": false,
12
-
13
- "strict": true,
14
- "esModuleInterop": true,
15
- "forceConsistentCasingInFileNames": true,
16
- "skipLibCheck": true,
17
- "resolveJsonModule": true
18
- },
19
- "include": ["src/**/*"],
20
- "exclude": ["node_modules", "dist"]
21
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "CommonJS",
5
+
6
+ "rootDir": "src",
7
+ "outDir": "dist",
8
+
9
+ "declaration": true,
10
+ "declarationDir": "dist",
11
+ "emitDeclarationOnly": false,
12
+
13
+ "strict": true,
14
+ "esModuleInterop": true,
15
+ "forceConsistentCasingInFileNames": true,
16
+ "skipLibCheck": true,
17
+ "resolveJsonModule": true
18
+ },
19
+ "include": ["src/**/*"],
20
+ "exclude": ["node_modules", "dist"]
21
+ }