Skip to content

fix(cli): stop labeling shadowed lazy-target dists as venv - #92558

Open
gokay-ai wants to merge 1 commit into
NousResearch:mainfrom
gokay-ai:cursor/fix-security-audit-shadowed-lazy-packages-48a5
Open

fix(cli): stop labeling shadowed lazy-target dists as venv#92558
gokay-ai wants to merge 1 commit into
NousResearch:mainfrom
gokay-ai:cursor/fix-security-audit-shadowed-lazy-packages-48a5

Conversation

@gokay-ai

Copy link
Copy Markdown

Fixes #92549

hermes security audit was calling the leftover lazy-packages aiohttp a venv dep, so --fail-on high stayed red after the sealed venv was already patched.

shadowed copy is lazy-shadowed now and doesn't trip fail-on. the one you actually import still does.

thx

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>
Copilot AI lite review requested due to automatic review settings August 22, 2026 23:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.path precedence into venv, lazy, and lazy-shadowed, and exclude non-effective duplicates from the active scan set.
  • Update --fail-on behavior to apply only to importable sources (excluding lazy-shadowed).
  • Add regression + unit tests covering shadowed lazy copies, lazy-only packages, inverted sys.path, and _discover_venv() wiring with HERMES_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.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard labels Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

security audit reports shadowed stale lazy-packages version as active venv dependency

4 participants