Commit f0e201d
fix(app): use tempfile for test state repos to clear CodeQL path-injection
Both `seeded_repo()` test helpers (settings.rs, pre-existing; debug_mode.rs,
new in this PR) hand-rolled a temp directory via
`std::env::temp_dir().join(format!("...{nonce}-{:p}...", ...))` before
passing it to `SqliteStateRepo::open`. That is exactly the pattern
`rust/path-injection` flags in this repo (driven-ci-flakes memory, PR 151
precedent; also documented at src-tauri/Cargo.toml's `tempfile` dependency
comment) - CodeQL's dataflow can see straight through the inline `format!`
call, and the pointer-formatted nonce reads as attacker-observable data.
Switched both to `tempfile::tempdir().keep()` (an opaque external call
CodeQL's analysis does not see into, so the taint chain never forms),
keeping the `(SqliteStateRepo, PathBuf)` return shape unchanged so every
existing `cleanup(dir)` call site round-trips with no other edits. This is
the repo's established FIX (not a dismissal) for this exact pattern.
Also explains the refingerprinted `crates/driven-core/src/state/sqlite.rs`
alert this PR's CI run surfaced as "new": that file's `SqliteStateRepo::open`
sink is unchanged, but adding new callers (via the two seeded_repo() sites)
to the analyzed call graph re-triggers CodeQL's whole-program dataflow scan
and re-mints the alert number. Fixing the source pattern at both call sites
resolves it without a dismissal.
Verified: cargo test -p driven-app --lib (494 passed), cargo clippy
--workspace --all-targets -- -D warnings (clean), cargo fmt --all --check
(clean).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019xKUm9vH4ifb5LHR5szy1v1 parent aa7b8d7 commit f0e201d
2 files changed
Lines changed: 18 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3790 | 3790 | | |
3791 | 3791 | | |
3792 | 3792 | | |
3793 | | - | |
3794 | | - | |
3795 | | - | |
3796 | | - | |
3797 | | - | |
3798 | | - | |
| 3793 | + | |
| 3794 | + | |
| 3795 | + | |
| 3796 | + | |
| 3797 | + | |
| 3798 | + | |
| 3799 | + | |
| 3800 | + | |
| 3801 | + | |
3799 | 3802 | | |
3800 | 3803 | | |
3801 | 3804 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
184 | 187 | | |
185 | 188 | | |
186 | 189 | | |
| |||
0 commit comments