Skip to content

fix(security): audit remediation - path traversal, wiki unification, dead code, complexity - #47

Merged
Cipher208 merged 2 commits into
masterfrom
fix/audit-remediation
Jul 4, 2026
Merged

Cipher208 merged 2 commits into
masterfrom
fix/audit-remediation

Conversation

@Cipher208

Copy link
Copy Markdown
Owner

Summary

  • Path traversal guard: shared/path_safety.py with safe_resolve() protects FileWiki, backup restore, import_export from crafted paths
  • Wiki unification: Merged file_wiki/user_wiki/agent_wiki into single WikiManager with layer separation (~900 lines duplication removed)
  • Dead code wiring: Connected saga_crypto.read_state_legacy_or_encrypted to saga.py and backup_cron.py
  • Complexity reduction: Extracted helpers from saga._compensate and emotion_trigger.should_save

Security

  • All 8 SQL injection findings: false positives (standard SQLite pattern)
  • 4 real path traversal vulns fixed (backup, backup_cron, import_export, file_wiki)

Tests

  • 372 tests pass (+34 new)
  • New: path_safety, wiki_manager, backup_path_safety, import_export_path_safety, saga_crypto_wiring

Files

  • 22 files changed, +522/-588
  • New: shared/path_safety.py, wiki/manager.py, 7 test files
  • Deleted: wiki/file_wiki.py, wiki/user_wiki.py, wiki/agent_wiki.py

Ariel Memory added 2 commits July 4, 2026 04:55
…reduce complexity

Security:
- Add shared/path_safety.py with safe_resolve() for path traversal prevention
- Add path validation to FileWiki (now WikiManager) update/get/delete
- Add path validation to backup.py and backup_cron.py restore
- Add path validation to import_export.py import_user
- All 8 SQL injection findings are false positives (standard SQLite pattern)

Wiki unification:
- Create wiki/manager.py WikiManager with layer-based separation (user/agent/shared)
- Remove wiki/file_wiki.py, wiki/user_wiki.py, wiki/agent_wiki.py (~900 lines duplication)
- Update all imports in server.py, dashboard.py, backup_cron.py, tests

Dead code wiring:
- Wire saga_crypto.read_state_legacy_or_encrypted into saga.py and backup_cron.py

Complexity reduction:
- Extract _compensate_inner_saga and _compensate_step from saga._compensate
- Extract 5 helper methods from emotion_trigger.should_save

Tests: 372 passed (was 338, +34 new)
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 75.49020% with 25 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
shared/saga.py 56.00% 11 Missing ⚠️
lifecycle/emotion_trigger.py 78.37% 8 Missing ⚠️
features/backup_cron.py 16.66% 5 Missing ⚠️
wiki/manager.py 90.90% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Cipher208
Cipher208 merged commit a823180 into master Jul 4, 2026
18 checks passed
@Cipher208
Cipher208 deleted the fix/audit-remediation branch July 4, 2026 02:05
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