fix(aidlc-traceability): harden report generation, file reads, and discovery#481
Merged
Merged
Conversation
…scovery Defensive hardening across the traceability CLI: - HTML report: neutralize "</" -> "<\/" in the embedded artifact-data JSON so artifact titles/descriptions cannot terminate the surrounding <script> block. Complements the existing html.escape()/escapeHtml() paths. - AI agent file reads: replace the unbounded read_source_code_file() with make_source_code_reader(project_root), a factory that binds the project root and confines all reads to it, rejecting traversal, absolute-path, and symlink escapes. Mirrors the _resolve_safe() pattern in aidlc-evaluator. - Source discovery: skip symlinks and verify each discovered file resolves within the project root, so links pointing outside the project are not read. Update threat-model.md to match the implemented mitigations and add regression tests for each path (131 tests pass). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
All the scanning issies are in code the PR did not touch except the markdown lint |
Re-pad threat and mitigation tables so pipes align with headers, satisfying markdownlint MD060 (aligned table style). Whitespace-only; no content change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
spraja08
approved these changes
Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updates across the
aidlc-traceabilityCLI, covering three code paths and updating the threat model to match the implemented mitigations.Testing
pytest— 131 passed (120 existing + 11 new regression tests).test_discovery.py, script-block containment intest_generators.py, and a newtest_agent_security.pycovering path resolution and read-boundary enforcement (traversal, absolute path, symlink escape).By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.