Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

security: gate agent-requested npm installs by package release age#2749

Open
boazdori wants to merge 2 commits into
nanocoai:main from
boazdori:security/npm-release-age-gate
Open

security: gate agent-requested npm installs by package release age #2749
boazdori wants to merge 2 commits into
nanocoai:main from
boazdori:security/npm-release-age-gate

Conversation

@boazdori

@boazdori boazdori commented Jun 12, 2026

Copy link
Copy Markdown

Summary

  • When an admin approves an agent install_packages request, requested npm packages are now checked against the same 3-day minimumReleaseAge the host's pnpm policy already enforces (pnpm-workspace.yaml). Packages whose selected version was published less than 3 days ago are blocked unless an exact-pinned name@version override is supplied (human sign-off).
  • Fail-closed: packages the registry can't verify (404, fetch error, missing publish time) are also blocked. The npm-registry fetch is wrapped in a 10s AbortController timeout so the approval handler can't hang on a slow/unreachable registry.
  • apt packages are unaffected (no clean release-age concept; the existing pnpm policy is npm-only too).

Why

The host source tree already enforces minimumReleaseAge for supply-chain safety, but agent-requested container packages bypassed it entirely — a freshly-published malicious version could be installed into an agent container on a single approval. This closes that gap by reusing the same threshold, and the gate runs before any config mutation or image rebuild, so a blocked request changes nothing.

Test Plan

  • checkNpmReleaseAge unit tests: old version passes, too-new flagged, exact-pinned override exempts, registry failure → unverifiable (fail-closed), scoped package resolves end-to-end
  • parseSpec unit tests for scoped/unscoped, versioned/unversioned specs
  • Gate placement verified: blocked installs never reach updateContainerConfigJson / buildAgentGroupImage
  • pnpm run build clean; full host test suite green

🤖 Generated with Claude Code

boazdori and others added 2 commits June 12, 2026 16:22
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Review follow-up to Task 3: 10s AbortController timeout so the approval
handler can't hang on a slow registry (abort → fail-closed); honor only
exact-pinned name@version overrides (drop bare-name bypass); hoist NpmMeta
type; add scoped-package coverage.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copy link
Copy Markdown

Adopted on our production fork today — this closes a gap we'd documented but never wired: our root supply-chain policy (3-day minimumReleaseAge, exact-pin-only exclusions with human sign-off) governed the host tree's pnpm installs while agent-requested container packages sailed past it on a single approval tap. Gate placement before any config mutation / image rebuild is right, and fail-closed on unverifiable packages matches how the pnpm policy behaves. The exact-pinned allowReleaseAge override mirroring minimumReleaseAgeExclude semantics is a nice touch — same mental model both places. Tests transplanted and pass against our tree. +1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gavrielc gavrielc Awaiting requested review from gavrielc gavrielc is a code owner

@gabi-simons gabi-simons Awaiting requested review from gabi-simons gabi-simons is a code owner

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /