@@ -35,26 +35,38 @@ t.test(
3535 const hooks = new Hooks ( ) ;
3636
3737 let modifyCalled = false ;
38- hooks . addGlobal ( "fetch" , {
39- modifyArgs : ( args ) => {
40- modifyCalled = true ;
41- return args ;
38+ hooks . addGlobal (
39+ "fetch" ,
40+ {
41+ modifyArgs : ( args ) => {
42+ modifyCalled = true ;
43+ return args ;
44+ } ,
4245 } ,
43- } ) ;
46+ "outgoing_http_op"
47+ ) ;
4448
4549 let inspectCalled = false ;
46- hooks . addGlobal ( "atob" , {
47- inspectArgs : ( args ) => {
48- inspectCalled = true ;
50+ hooks . addGlobal (
51+ "atob" ,
52+ {
53+ inspectArgs : ( args ) => {
54+ inspectCalled = true ;
55+ } ,
4956 } ,
50- } ) ;
57+ "outgoing_http_op"
58+ ) ;
5159
5260 // Unknown global
53- hooks . addGlobal ( "unknown" , {
54- inspectArgs : ( args ) => {
55- return ;
61+ hooks . addGlobal (
62+ "unknown" ,
63+ {
64+ inspectArgs : ( args ) => {
65+ return ;
66+ } ,
5667 } ,
57- } ) ;
68+ "outgoing_http_op"
69+ ) ;
5870
5971 // Without name
6072 // @ts -expect-error Test with invalid arguments
@@ -90,11 +102,17 @@ t.test("it ignores route if force protection off is on", async (t) => {
90102
91103 const hooks = new Hooks ( ) ;
92104 hooks . addBuiltinModule ( "dns/promises" ) . onRequire ( ( exports , pkgInfo ) => {
93- wrapExport ( exports , "lookup" , pkgInfo , {
94- inspectArgs : ( args , agent ) => {
95- inspectionCalls . push ( { args } ) ;
105+ wrapExport (
106+ exports ,
107+ "lookup" ,
108+ pkgInfo ,
109+ {
110+ inspectArgs : ( args , agent ) => {
111+ inspectionCalls . push ( { args } ) ;
112+ } ,
96113 } ,
97- } ) ;
114+ "outgoing_http_op"
115+ ) ;
98116 } ) ;
99117
100118 applyHooks ( hooks ) ;
@@ -156,18 +174,24 @@ t.test("it ignores route if force protection off is on", async (t) => {
156174t . test ( "it does not report attack if IP is allowed" , async ( t ) => {
157175 const hooks = new Hooks ( ) ;
158176 hooks . addBuiltinModule ( "os" ) . onRequire ( ( exports , pkgInfo ) => {
159- wrapExport ( exports , "hostname" , pkgInfo , {
160- inspectArgs : ( args , agent ) => {
161- return {
162- operation : "os.hostname" ,
163- source : "body" ,
164- pathsToPayload : [ "path" ] ,
165- payload : "payload" ,
166- metadata : { } ,
167- kind : "path_traversal" ,
168- } ;
177+ wrapExport (
178+ exports ,
179+ "hostname" ,
180+ pkgInfo ,
181+ {
182+ inspectArgs : ( args , agent ) => {
183+ return {
184+ operation : "os.hostname" ,
185+ source : "body" ,
186+ pathsToPayload : [ "path" ] ,
187+ payload : "payload" ,
188+ metadata : { } ,
189+ kind : "path_traversal" ,
190+ } ;
191+ } ,
169192 } ,
170- } ) ;
193+ "path_op"
194+ ) ;
171195 } ) ;
172196
173197 applyHooks ( hooks ) ;
0 commit comments