Skip to content

test: path traversal adversarial corpus + prompt trust annotation#74

Open
Nelson Spence (Fieldnote-Echo) wants to merge 1 commit intomainfrom
test/L4-tb-anchored-assurance
Open

test: path traversal adversarial corpus + prompt trust annotation#74
Nelson Spence (Fieldnote-Echo) wants to merge 1 commit intomainfrom
test/L4-tb-anchored-assurance

Conversation

@Fieldnote-Echo
Copy link
Member

Summary

  • F-CB-002: Adversarial path traversal corpus for CodebaseToolkit — parametrized tests covering:
    • Unix/Windows traversal patterns, absolute paths, symlink traversal, null bytes
    • Both read_file and list_files rejection paths
  • F-PR-002: Updated system-core.md trust annotation — graph-derived file context now explicitly labeled as non-privileged reference material (not [UNTRUSTED] HTML comment)

Audit Context

  • Findings: F-CB-002 (LOW, TB-4 anchor), F-PR-002 (LOW, TB-3)
  • Lane: L4 (TB-Anchored Assurance) — Priority 4 in remediation plan

Test plan

  • uv run pytest tests/test_grippy_codebase.py -v — all pass
  • uv run pytest tests/ -v — full suite passes
  • Pre-commit hooks pass

🤖 Generated with Claude Code

Add parametrized adversarial path corpus testing 10+ traversal vectors:
- Unix multi-level traversal (../../, ../../../)
- Windows backslash traversal (..\..\)
- Mid-path breakout (src/../../../)
- Absolute paths (/etc/passwd, /tmp/evil.py)
- Symlink traversal (symlink pointing outside repo root)
- Null byte injection (main\x00.py)
- Both read_file and list_files tools covered

Also annotate graph-derived file context as non-privileged in system-core.md
prompt (F-PR-002) — explicit prompt text, not HTML comment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Collaborator

@project-navi-bot project-navi-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All required CI checks passed. Auto-approved by navi-bot.

Copy link
Collaborator

@project-navi-bot project-navi-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All required CI checks passed. Auto-approved by navi-bot.

@@ -346,6 +346,91 @@ def test_read_file_rejects_prefix_bypass(self, tmp_path: Path) -> None:
assert "path traversal not allowed" in result.lower()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 LOW: Extensive adversarial path traversal corpus added to tests

Confidence: 95%

A new class of parametrized tests for adversarial path traversal was added, covering Unix/Windows traversal, absolute/symlink paths, and null byte handling. These tests validate that the core path safety checks in read_file and list_files adequately reject traversal attempts or error safely. This helps future-proof against regression but also highlights attack vectors developers should remain vigilant about.

Suggestion: Continue maintaining and expanding these adversarial path tests as new codebase access features are introduced, and adapt them if rejection logic changes. Periodically audit for new traversal patterns or bypasses as the code or OS support evolves.

— Not wrong, but there's a simpler way. Still�3this hardening is worth the slight verbosity.

@@ -62,10 +62,10 @@ You will receive:
- **Governance rules** (YAML) — trusted, from version-controlled config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 LOW: Prompt trust annotation updated for file context

Confidence: 93%

The documentation for file context in the primary system prompt has been updated: file context is now clearly annotated as non-privileged reference material rather than trusted input. This is important for prompt governance, as it enforces clear trust boundaries between sources of evidence used in analysis versus privileged, version-controlled configuration.

Suggestion: Make sure all tooling and documentation referencing 'file context' reflect this annotation. Continue differentiating between trusted and non-trusted sources across documentation to avoid privilege escalation vulnerabilities via prompt injection.

— Minor governance note. Not blocking. The rules say trust, you say reference. Reference is safer.

@github-actions
Copy link
Contributor

✅ Grippy Review — PASS

Score: 96/100 | Findings: 2

Delta: 2 new


Commit: 8268a01

Copy link
Collaborator

@project-navi-bot project-navi-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All required CI checks passed. Auto-approved by navi-bot.

Copy link
Collaborator

@project-navi-bot project-navi-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All required CI checks passed. Auto-approved by navi-bot.

@codecov
Copy link

codecov bot commented Mar 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Collaborator

@project-navi-bot project-navi-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All required CI checks passed. Auto-approved by navi-bot.

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.

2 participants