Repository navigation
fix: prevent git flag injection in getChangedFiles and correct converse edge alias direction - #719
Open
dajiaohuang wants to merge 2 commits into
Conversation
…se edge alias direction - Fix VULN-001: getChangedFiles() now resolves lastCommitHash via git rev-parse --verify --end-of-options before diffing, matching the secure pattern already used in evaluateGraphFreshness. Prevents malicious commit hashes from injecting git flags (e.g. --output=path/to/target). - Fix Egonex-AI#653: documented_by (and related converse aliases written_by, created_by, example_of) now swap source/target when normalizing to their canonical types (documents, authored_by, exemplifies). Previously only the type was rewritten, silently reversing edge direction. - Update staleness tests to cover the two-call rev-parse + diff pattern. Fixes Egonex-AI#656 Fixes Egonex-AI#653
This branch has not been deployed
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
Fix #653 by reversing endpoints only for
documented_bywhen normalizing todocuments.written_byandcreated_byalready have the same direction asauthored_by;example_ofhas the same direction asexemplifies. Their endpoints must remain unchanged. Added four alias-direction regression cases.Retain the original revision-resolution boundary change, but put
--name-onlybefore--end-of-optionsin the subsequent Git diff invocation. The previous ordering causes real Git to fail even for ordinary valid revisions, which then produces an empty changed-file list. Updated the mocked command expectation.Validation
An isolated Node 24 harness runs the actual extracted normalization and changed-file functions, not a reimplementation. Four alias cases pass; real Git 2.51.2 in a fresh two-commit fixture returns the changed tracked file. The previous PR source fails three alias cases and the real-Git case. No hostile-project or additional security testing performed or claimed.
The added Vitest cases were not run here, and the previously reported 1013-test/full TypeScript build applied to the older head. Upstream full suite/typecheck remains required. No dependency or toolchain installation.