Skip to content

Commit d57570e

Browse files
Merge pull request #186 from AikidoSec/earlier-return-on-file-collector
do a context check in FileCollector itself
2 parents 1165a3a + 48e1b48 commit d57570e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

agent_api/src/main/java/dev/aikido/agent_api/collectors/FileCollector.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package dev.aikido.agent_api.collectors;
22

3+
import dev.aikido.agent_api.context.Context;
34
import dev.aikido.agent_api.helpers.logging.LogManager;
45
import dev.aikido.agent_api.helpers.logging.Logger;
56
import dev.aikido.agent_api.storage.statistics.OperationKind;
@@ -22,6 +23,11 @@ public static void report(Object filePath, String operation, int depth) {
2223
if (filePath == null) {
2324
return; // Make sure filePath is defined
2425
}
26+
if (Context.get() == null) {
27+
// The FileCollector tries to extract file paths from the `Object filePath`, so we don't want to wait
28+
// for a context check in `scanForGivenVulnerability`
29+
return;
30+
}
2531
logger.trace("Scan on %s for file: %s", operation, filePath);
2632
StatisticsStore.registerCall(operation, OperationKind.FS_OP);
2733

0 commit comments

Comments
 (0)