- ALM used: GitLab
- CI system used: GitLab CI
- Scanner command used when applicable:
sonar-scanner
- Languages of the repository: TypeScript/JavaScript (most are TS)
- LOC: ~150k lines
Hi, I’m currently facing an issue with SonarCloud scanning within my repository. Recently, the scan duration has ballooned from approximately 5 minutes to a considerably slower 20-30 minutes. Upon review, it appears that the JsSecuritySensor
is the main culprit for the additional time spent.
The SonarCloud logs show the following before getting stuck:
INFO: Sensor JsSecuritySensor [security]
INFO: Reading type hierarchy from: /my_repo/[MASKED]/.scannerwork/ucfg2/js
INFO: Read 0 type definitions
INFO: Reading UCFGs from: /my_repo/[MASKED]/.scannerwork/ucfg2/js
INFO: Cache loaded: SecuritySensorCache{ucfgsHashes.count=14102, typeDefinitionsHashes.count=0}
INFO: 08:18:02.416565 Building Runtime Type propagation graph
INFO: 08:18:03.583675 Running Tarjan on 195140 nodes
INFO: 08:18:03.838945 Tarjan found 195136 components
INFO: 08:18:04.299394 Variable type analysis: done
INFO: 08:18:04.310375 Building Runtime Type propagation graph
INFO: 08:18:05.654968 Running Tarjan on 195140 nodes
INFO: 08:18:05.812659 Tarjan found 195136 components
INFO: 08:18:06.177978 Variable type analysis: done
INFO: Analyzing 14086 ucfgs to detect vulnerabilities.
INFO: Taint analysis starting. Entrypoints: 2541
INFO: Running symbolic analysis for 'JS'
It then pauses for approximately 15 minutes before completing:
INFO: Taint analysis: done.
INFO: Sensor JsSecuritySensor [security] (done) | time=939479ms
For comparison, here are logs from several weeks ago (June 14), where the JsSecuritySensor
process was significantly faster:
INFO: Sensor JsSecuritySensor [security]
INFO: Reading type hierarchy from: /my_repo/[MASKED]/.scannerwork/ucfg2/js
INFO: Read 0 type definitions
INFO: Reading UCFGs from: /my_repo/[MASKED]/.scannerwork/ucfg2/js
INFO: 09:17:11.472807 Building Runtime Type propagation graph
INFO: 09:17:11.961254 Running Tarjan on 100953 nodes
INFO: 09:17:12.078573 Tarjan found 100949 components
INFO: 09:17:12.258211 Variable type analysis: done
INFO: 09:17:12.261047 Building Runtime Type propagation graph
INFO: 09:17:12.764111 Running Tarjan on 100953 nodes
INFO: 09:17:12.838845 Tarjan found 100949 components
INFO: 09:17:12.991821 Variable type analysis: done
INFO: Analyzing 13775 ucfgs to detect vulnerabilities.
INFO: Taint analysis starting. Entrypoints: 2483
INFO: Running symbolic analysis for 'JS'
INFO: Taint analysis: done.
INFO: Sensor JsSecuritySensor [security] (done) | time=15999ms
Despite the very similar logs, the execution time has ballooned from 16 seconds to 15 minutes.
I’ve browsed the forum and attempted the following solutions:
- Add TypeScript tsconfig.json location to project (Slow Automatic Analysis of Javascript/Typescript - #7 by victor.diez)
- Deactive all the “Vulnerability” rules in TypeScript and JavaScript (Sonar scanner has started to take too much time to run analysis)
Unfortunately, neither approach has improved the situation; the scanning time remains at around 20-30 minutes. Additionally, I attempted to use debug mode (sonar-scanner -x
), but this created such an extensive output that GitLab CI couldn’t display it in its entirety.
Any suggestions or insights on how to address this problem would be greatly appreciated.