Repository navigation
Description
Problem to solve
When Semgrep reports a syntax error for a file, Code Risk Analysis marks Semgrep as an incomplete scan, even when Semgrep returns results and the other scanners complete.
In validators/code_risk.py, any nonempty Semgrep errors list causes mark_scan_incomplete("semgrep"). The validator keeps Semgrep findings, but it reports only the first three errors and truncates each message to 100 characters. That makes it hard to identify every affected file, and to tell a partial scan from a Semgrep invocation that failed entirely.
I hit this with public skills containing shell or JavaScript files that Semgrep failed to parse:
trailofbits/skillsate4dd0bb5b15535f7c5a0834187dffba6ac37e4ff: Semgrep reported a syntax error at line 6 ofscripts/run-scans.sh, which containsset -euo pipefail.Leonxlnx/taste-skillatf6b76575f949707b4e3c37cd86cb44b0b98643e8,skills/taste-skill: Semgrep reportedSyntax error at line …/scripts/copy-lint.mjs:85: '(/' was unexpected, near a regex literal.
In a catalog of 166 public skills, nine reported Semgrep as incomplete. For all nine, the Semgrep errors shown (up to the first three per check) were syntax errors. Six Code Risk Analysis checks had the status incomplete. The other three had the status failed, because Bandit reported findings.
Proposed approach
An unparsed executable file can be a genuine security coverage gap, so keeping the check incomplete may be intentional. Either way, it would help to:
- Distinguish a partial scan caused by file-level parse errors from an invocation that failed entirely.
- Report the affected paths, with enough detail to investigate them, including when there are more than three errors.
- Document the intended status, and suggest how users can resolve the parse errors or check whether they come from Semgrep or its rule configuration.
PR #453 made reference-only caveats visible when SkillSpector's file and analyzer coverage was otherwise complete. A Semgrep parse error may be a real coverage gap, so I'm not assuming it should get the same status. I'm asking whether a similar distinction in reporting would be useful.
Additional context
To reproduce:
-
Check out
trailofbits/skillsate4dd0bb5b15535f7c5a0834187dffba6ac37e4ff. -
Copy the
plugins/static-analysis/skills/semgrepfolder out of the checkout. -
Run Tier 1 on the copy, in the Tier 1 image pinned by the 0.8.0 bundle:
skillevaluator tier1 <copy-of-semgrep-skill> --no-llm -r json -o <reports-dir>
-
Inspect the Code Risk Analysis result. Semgrep is listed in
incomplete_scans, with a syntax error forscripts/run-scans.sh.
I saw the same behaviour with and without network access. I haven't tested running it inside the full repository checkout.
Version: the Tier 1 image pinned by the 0.8.0 bundle.
ghcr.io/nvidia/skillevaluator-tier1@sha256:9d5483243918937be4f2178f74cf7c622a531dee41e3176906994d52fa14950a
Semgrep 1.182.0
The error handling described above is unchanged on main at 43a66115.
Before submitting
- I agree to follow this project's Code of Conduct
- I have searched the open issues and found no duplicate of this request
Activity
Report Semgrep file-level parse errors as a partial scan
lucas-saldanha-werneck commentedon Nov 13, 2026
A second public repro, this time for a valid bash construct that Semgrep's bash parser does not accept.
skills/web-unlock/bin/chrome-real.shin https://github.com/lucas-saldanha-werneck/web-unlock containsexec 3<>"/dev/tcp/127.0.0.1/$PORT".bash -nand ShellCheck accept the script. With Semgrep 1.182.0 (the version in the 0.8.0 Tier 1 image) and the repository'ssemgrep_rules.yaml, the JSONerrorslist has one entry:{"code": 3, "level": "warn", "type": ["PartialParsing", [{"path": "...", "start": {"line": 3, "col": 8}, "end": {"line": 3, "col": 9}}]], "message": "Syntax error at line ...:3:\n `>` was unexpected"}Two details from this output that may help the design:
typeis a list,["PartialParsing", [spans]], not a string, andleveliswarn. Semgrep recovered and scanned the rest of the file (the scan summary says about 50% of lines parsed for a two-line file). Code that readstypeas a string will not see this.<>operator fails on any bash file (exec 3<>/dev/null,cat <>file), so the cause is the parser and not the skill. I reported that upstream: Bash parser: syntax error on read-write redirection<>(e.g. exec 3<>/dev/tcp/host/port) semgrep/semgrep#12084.So a
PartialParsingentry can be reported as a coverage warning naming the file and span, while other error types can keep the scan incomplete. I'm preparing a small PR along those lines.chrisknvidia commentedon Nov 13, 2026
Thanks for the reports and the extra repro. #475 is merged: Semgrep file-level parse errors, including the
PartialParsingentries wheretypeis a list, are now reported as one partial-scan message that names every unparsed file and line, and the full list is kept in the report metadata. The check staysincompletebecause those files were not scanned. If you thinkPartialParsingalone should be a warning instead, say so here and we can look at it.chrisknvidia commentedon Nov 13, 2026
The fix is merged in #475 and will ship with the next release. File-level Semgrep parse errors now give one partial-scan error that names up to 20 unparsed files, relative to the skill and with the line of the first error. The JSON report lists every file in
semgrep_unparsed_files(up to 1,000, withsemgrep_unparsed_files_omittedcounting the rest). The check staysincomplete, because Semgrep skips the code it cannot parse, and findings for the other files are kept.@enes-alatas, could you check it against the public skills you hit this with? I reopened this (it closed automatically when the PR merged) and will leave it open for a day or two so you can confirm. If it works for you I'll close it.
Report Semgrep file-level parse errors as a partial scan (NVIDIA#475)
rng1995 commentedon Nov 13, 2026
Addressed on
mainby #475 (957e8ff6).Code Risk Analysis now reports Semgrep file-level parse errors as a single partial-scan error that names up to 20 unparsed files, each relative to the skill and carrying the line of its first error, instead of the first three messages truncated to 100 characters. That makes every affected file identifiable, which was the core of this request.
On the part of the request about telling a partial scan from a failed invocation: the check still reports
incomplete, deliberately. Semgrep genuinely skips the code it cannot parse, so the scan did not cover everything, and reporting it as complete would overstate the coverage. What changed is that the record now says which files were skipped and why, so a partial scan is distinguishable from a Semgrep run that failed outright by reading the error rather than by the status alone.Closing as resolved. If the
incompletestatus itself is still a problem for your workflow — for example if it blocks a gate you need to pass — that is worth a separate issue, since it is a policy question rather than a reporting one.enes-alatas commentedon Nov 14, 2026
@chrisknvidia Thanks for the quick solution! I confirmed #475 on main against both skills from the report, running
skillevaluator tier1 <skill> --no-llmwith Semgrep 1.182.0:trailofbits/skillsplugins/static-analysis/skills/semgrepate4dd0bb5: one partial-scan message namingscripts/run-scans.sh:6, andsemgrep_unparsed_fileslists it. 0.8.0 gave a truncated message with an absolute path.Leonxlnx/taste-skillskills/taste-skillatf6b76575: one message namingscripts/copy-lint.mjs:85andscripts/moments.mjs:484, and both are insemgrep_unparsed_files.@rng1995 Keeping the check
incompletesounds fair enough to me. Those files really weren't scanned, and the record now says which ones and why, which is what I needed.