Skip to content

fix: prevent git flag injection in getChangedFiles and correct converse edge alias direction - #719

Open
dajiaohuang wants to merge 2 commits into
Egonex-AI:mainfrom
dajiaohuang:fix/security-git-injection-and-edge-direction
Open

dajiaohuang wants to merge 2 commits into
Egonex-AI:mainfrom
dajiaohuang:fix/security-git-injection-and-edge-direction

Conversation

@dajiaohuang

@dajiaohuang dajiaohuang commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fix #653 by reversing endpoints only for documented_by when normalizing to documents. written_by and created_by already have the same direction as authored_by; example_of has the same direction as exemplifies. Their endpoints must remain unchanged. Added four alias-direction regression cases.

Retain the original revision-resolution boundary change, but put --name-only before --end-of-options in 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.

dajiaohuang and others added 2 commits October 8, 2026 13:19
…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

No deployments
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.

[BUG] EDGE_TYPE_ALIASES maps documented_by to documents without swapping endpoints, silently reversing the edge

1 participant