Skip to content

fix(code-scanner): close the same TOCTOU gap in sast - #53

Merged
ralyodio merged 1 commit into
masterfrom
fix/sast-toctou
Jul 28, 2026
Merged

fix(code-scanner): close the same TOCTOU gap in sast#53
ralyodio merged 1 commit into
masterfrom
fix/sast-toctou

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Follow-up to #52.

The secrets subsystem's stat(path)readFile(path) gap was fixed there; sast had the identical pattern and CodeQL flagged it on the next scan of master.

Same fix: one file handle for the size check and the read, so the bytes analysed are the bytes measured. A path can be swapped between a separate stat and read, which on a host where an attacker can write to a scanned directory is a way to feed the scanner something other than what it approved.

90 tests, build clean.

The secrets subsystem's stat-then-read gap was fixed in #52; sast had the
identical pattern and CodeQL flagged it on the next scan. Same fix: one file
handle for the size check and the read, so the bytes analysed are the bytes
measured.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

vu1nz Security Review

0 finding(s) in PR #?

No security issues found.

@ralyodio
ralyodio merged commit fbd3a4f into master Jul 28, 2026
9 checks passed
@ralyodio
ralyodio deleted the fix/sast-toctou branch July 28, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant