fix(cli): stop labeling shadowed lazy-target dists as venv - #92558
Open
gokay-ai wants to merge 1 commit into
Open
fix(cli): stop labeling shadowed lazy-target dists as venv#92558gokay-ai wants to merge 1 commit into
gokay-ai wants to merge 1 commit into
Conversation
hermes security audit walked importlib.metadata.distributions() and deduped on (name, version), tagging every hit source=venv. On Docker durable lazy installs that left a stale aiohttp in HERMES_LAZY_INSTALL_TARGET (append-only on sys.path) failing --fail-on high after the sealed venv was already patched. Classify by install path vs the lazy target and sys.path precedence so the imported copy stays venv/lazy and the shadowed copy is lazy-shadowed, which is reported but ignored by --fail-on. Co-authored-by: GokayAI <gokay-ai@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes hermes security audit component source classification so distributions found under the durable lazy-install target (HERMES_LAZY_INSTALL_TARGET) are no longer mislabeled as source: "venv" when they are shadowed by an earlier sys.path entry (the sealed venv). Shadowed lazy-target copies remain visible in output as lazy-shadowed, but no longer keep --fail-on high (or similar) failing when the effective/importable dependency is already patched.
Changes:
- Classify installed PyPI distributions by installation root +
sys.pathprecedence intovenv,lazy, andlazy-shadowed, and exclude non-effective duplicates from the active scan set. - Update
--fail-onbehavior to apply only to importable sources (excludinglazy-shadowed). - Add regression + unit tests covering shadowed lazy copies, lazy-only packages, inverted
sys.path, and_discover_venv()wiring withHERMES_LAZY_INSTALL_TARGET.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
hermes_cli/security_audit.py |
Adds lazy-target detection + import-precedence classification and ensures --fail-on ignores lazy-shadowed findings. |
hermes_cli/subcommands/security.py |
Clarifies --fail-on help text to reflect importable-only threshold behavior. |
tests/hermes_cli/test_security_audit.py |
Adds coverage for venv vs lazy-target classification and fail-on threshold behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Fixes #92549
hermes security auditwas calling the leftover lazy-packages aiohttp a venv dep, so--fail-on highstayed red after the sealed venv was already patched.shadowed copy is
lazy-shadowednow and doesn't trip fail-on. the one you actually import still does.thx