🛡️ Sentinel: [CRITICAL/HIGH] Fix local code execution via git in tests - #131
🛡️ Sentinel: [CRITICAL/HIGH] Fix local code execution via git in tests#131tachyon-beep wants to merge 1 commit into
Conversation
The tests/unit/core/test_gitignore.py file invoked git via subprocess against the project root without disabling core.fsmonitor. This could allow local code execution via a malicious .git/config if a user ran tests in an untrusted cloned repository. We fix this by passing `_SAFE_GIT_CONFIG`. Co-authored-by: tachyon-beep <544926+tachyon-beep@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Pull request overview
Hardens the git subprocess usage inside the test_gitignore unit test to prevent config-driven local code execution when running tests in an untrusted repository checkout, aligning test behavior with existing mitigations already used in src/wardline/core/*.
Changes:
- Introduce
_SAFE_GIT_CONFIG = ("-c", "core.fsmonitor=false")intests/unit/core/test_gitignore.py. - Apply
_SAFE_GIT_CONFIGto thegit rev-parseandgit check-ignoresubprocess calls used by the repository-policy test. - Document the security learning in
.jules/sentinel.md.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/unit/core/test_gitignore.py | Adds and uses a safe git config override to disable core.fsmonitor for git subprocess calls in the test. |
| .jules/sentinel.md | Records the rationale and prevention guidance for applying safe git config overrides in tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
🚨 Severity: HIGH
💡 Vulnerability: The
tests/unit/core/test_gitignore.pyfile invokedgitviasubprocessagainst the project root without overriding git config.🎯 Impact: This could allow local code execution via a malicious
.git/confighook (e.g.core.fsmonitor) if a developer ran the test suite inside an untrusted cloned repository (like a malicious PR or fork).🔧 Fix: We explicitly define and pass
_SAFE_GIT_CONFIG = ("-c", "core.fsmonitor=false")into thesubprocess.runcalls, mirroring the mitigation applied insrc/wardline/core/.✅ Verification: Ran
make testlocally to ensure the test still functions correctly.Added a critical learning to
.jules/sentinel.md.PR created automatically by Jules for task 14974807385088975155 started by @tachyon-beep