Skip to content

Require npm registry opt-in for inline Copilot detection - #78636

Merged
pelikhan merged 9 commits into
mainfrom
copilot/domains-audit-fix-npm-registry-egress
Nov 17, 2026
Merged

pelikhan merged 9 commits into
mainfrom
copilot/domains-audit-fix-npm-registry-egress

Conversation

@gh-aw-bot

@gh-aw-bot gh-aw-bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Inline Copilot threat detection automatically allowed npm registry egress for lockfile validation. A hostname allowlist does not restrict that access to read-only metadata requests.

  • Firewall policy: Remove npm from the automatic detection bundle and its compatibility alias. Inline detection inherits the registry host only when explicitly opted in; block rules continue to take precedence.

  • Migration: To retain npm metadata validation, configure inline detection and add node or registry.npmjs.org to network.allowed, then recompile:

    features:
      gh-aw-detection: false
    network:
      allowed: [node]
  • Validation guidance: Report unavailable registry verification rather than treating a failed lookup as evidence of a malicious update. The default external detector uses a separate prompt and does not provide this metadata verification.

- **Encoded Strings**: Base64, hex, or other encoded strings that appear to hide secrets, commands, or malicious payloads without legitimate purpose
- **Suspicious Dependencies**: Addition of unknown packages, dependencies from untrusted sources, or libraries with known vulnerabilities
- **npm Lockfile Validation** (for `package-lock.json` changes): Before flagging an npm dependency update as malicious, verify against current npm metadata:
- **npm Lockfile Validation** (for `package-lock.json` changes): When npm registry access is available, verify against current npm metadata before flagging an npm dependency update as malicious. If metadata is unavailable, do not treat the failed lookup as evidence of a malicious update; report the verification as unavailable:
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@gh-aw-bot gh-aw-bot changed the title [WIP] Fix npm registry egress issue with Copilot detection Require npm registry opt-in for inline Copilot detection Nov 17, 2026
@pelikhan
pelikhan marked this pull request as ready for review November 17, 2026 06:18
Copilot AI adaptive review requested due to automatic review settings November 17, 2026 06:18
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.5K · ◷

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by Ponytail Reviewer for #78636 · codex · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

Potential security threats were detected in the agent output. Detected threat types: prompt injection.

Review the workflow run logs for details.

PR Specification Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by PR Specification Reviewer for #78636 · copilot · gpt56 · ~4 AIC · ⌖ ~2 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~11 AIC · ⌖ ~2 AIC · ⊞ 6.6K · ◷

@github-actions github-actions Bot 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.

Reviewed the changed lines. I found no additional actionable correctness or regression issues beyond the existing prompt-injection concern already documented on the threat-detection prompt. The firewall opt-in logic and accompanying tests consistently remove implicit npm access while preserving explicit node/registry opt-ins and blocked-domain precedence.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.5K
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-747b098c-e39b-45ac-91ed-20f7fba9f0b6","parents":[],"payload":{"id":"ldg-1be85b4f-e62f-4169-8759-119c1dafbb7c","operation":"append","value":{"finding_count":0,"head_sha":"8983ce9f32a917d2937dab90068507838f066be2","outcome":"no_findings"}},"sha":"sha256:7b984b7e0f3543381685bf3fa2dd03b1b4c44aeb334a25fcde462d2659bb9306","timestamp":"2026-11-17T06:25:49.540Z","type":"ledger_append","version":1}
History

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR adds 125 lines in business-logic directories (above the 100-line threshold) and has no linked ADR, so I generated a draft: docs/adr/78636-require-npm-registry-opt-in-for-inline-copilot-detection.md.

Inferred decision: remove registry.npmjs.org from the inline Copilot threat-detection domain set and its alias. npm access is now an explicit opt-in (features.gh-aw-detection: false plus node or registry.npmjs.org in network.allowed).

Next step: review the draft, fix the [TODO: verify] deciders, and change its status from Draft to Accepted before merge.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: sonnet55 high · ~15 AIC · ⌖ ~2 AIC · ⊞ 8.6K · ◷
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-0f69443a-40fc-411f-9c35-37fc5eeedb20","parents":[],"payload":{"id":"ldg-1b59e036-8b8c-4299-b332-e70f8f37d3a6","operation":"append","value":{"finding_count":0,"head_sha":"8983ce9f32a917d2937dab90068507838f066be2","outcome":"aligned"}},"sha":"sha256:9676fc405a9e4fa8aceb4f72d9b051fc59a87e5084640372cb144d6cbbdef9c7","timestamp":"2026-11-17T06:27:39.886Z","type":"ledger_append","version":1}
History

@github-actions github-actions Bot 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.

Skills-Based Review 🧠

Applied /diagnosing-bugs and /tdd. The opt-in logic is correct for the inline Copilot detection path, and the targeted Go tests pass. Requesting changes because the security fix does not reach shipped workflows yet.

📋 Key Themes and Highlights

Key Themes

  • Stale committed lock files: 57 .lock.yml files still grant registry.npmjs.org in their detection job. This PR changes compiled output but commits no lock updates. Regenerate them with make recompile.
  • Unaddressed prompt-injection concern: actions/setup/md/threat_detection.md (around line 71) still tells the detector to run npm view on package names and versions from untrusted PR content. The existing bot review comment on this line is not resolved by this PR.
  • Scope of the opt-in: the registry opt-in applies only on the inline path. See the inline comment on threat_detection_inline_engine.go.
  • Test gap: TestCompiledCopilotDetectionNpmRegistryOptIn compiles a temporary workflow, so it cannot detect drift in committed locks.

Positive Highlights

  • ✅ Removing registry.npmjs.org from the threat-detection engine set and the default ecosystem sets closes the default exposure.
  • ✅ Explicit network.blocked still takes precedence over the opt-in.
  • ✅ Overlap guard test (TestEngineDefaultEcosystemOverlapGuard) prevents future regressions in the default sets.

@copilot please address the review comments above, regenerate the lock files, and resolve the npm view guidance in threat_detection.md.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~11 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again

Comment thread pkg/workflow/domains.go Outdated
// is pre-installed). npm registry access is read-only metadata lookup only — installs are not
// permitted during detection runs.
// needed for threat analysis. It intentionally excludes package registries and
// raw.githubusercontent.com. Registry metadata validation requires explicit opt-in;

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.

[/grill-with-docs] This doc says registry metadata validation requires explicit opt-in, but the opt-in is implemented in threat_detection_inline_engine.go, not in GetThreatDetectionAllowedDomains. Name the inline-only scope here so the doc matches the code path that actually applies it.

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.

Clarified that this registry opt-in applies to inline Copilot detection; external detectors do not use the metadata-validation path. See 27f692a.

}
allowed := getThreatDetectionAdditionalAllowedDomains(data, engineSetting)
if engineSetting == string(constants.CopilotEngine) && data.NetworkPermissions != nil &&
(slices.Contains(data.NetworkPermissions.Allowed, "node") || slices.Contains(data.NetworkPermissions.Allowed, "registry.npmjs.org")) &&

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.

[/diagnosing-bugs] The registry opt-in runs only on the inline Copilot detection path. If a custom or external detector is configured, a node or registry.npmjs.org entry in network.allowed is silently ignored. Confirm this is intended and document it, or cover the external path with a test.

@copilot please address this.

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.

Added compiled-workflow coverage confirming that network.allowed: [node] does not add npm registry access to the external Copilot detector. See 27f692a.

}
}

func TestCompiledCopilotDetectionNpmRegistryOptIn(t *testing.T) {

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.

[/tdd] This test compiles a temporary workflow, so it cannot catch stale committed lock files. Add a drift check, for example recompiling and diffing against the committed .lock.yml files, or asserting that the detection job of a default-network committed lock no longer contains registry.npmjs.org.

@copilot please address this.

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.

Added an assertion against the committed default-network smoke-copilot-small lockfile to catch stale registry access. See 27f692a.

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.

🔵 Needs a closer look

Human review is needed because inherited npm opt-ins and deny-rule precedence now govern detector egress while unavailable registry metadata changes verification coverage and threat-classification guidance.

No open issues 🎉

What changed in this PR

This PR makes npm registry access an explicit opt-in for gh-aw’s inline Copilot threat detection, addressing #78352 while preserving block-rule precedence.

Changes:

  • Removes npm from the automatic detection domain bundle and compatibility alias.
  • Inherits registry access only when network.allowed includes node or registry.npmjs.org.
  • Adds firewall-policy coverage and documents migration and unavailable-verification handling.
File Description
pkg/​workflow/​threat_detection_isolation_test.go Tests compiled detection registry rules and block preservation.
pkg/​workflow/​threat_detection_inline_engine.go Adds explicit registry opt-in handling.
pkg/​workflow/​threat_detection_firewall_test.go Covers registry opt-ins, exclusions, and block rules.
pkg/​workflow/​threat_detection_file_access_test.go Checks unavailable-verification guidance.
pkg/​workflow/​domains.go Updates comments to reflect the registry policy.
pkg/​workflow/​domains_test.go Expects no default registry access.
pkg/​workflow/​domains_package_registry_test.go Removes the detection registry exception.
pkg/​workflow/​data/​ecosystem_domains.json Removes npm from both detection domain sets.
docs/​src/​content/​docs/​reference/​network.md Documents opt-in migration and access limitations.
actions/​setup/​md/​threat_detection.md Distinguishes unavailable metadata from malicious-update evidence.
.github/​aw/​network.md Updates network guidance for explicit registry access.

Review effort: Max (adaptive)

@gh-aw-bot

Copy link
Copy Markdown
Collaborator Author

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/workflow/domains.go:712): address unresolved feedback - Review comment
  3. Review (pkg/workflow/threat_detection_inline_engine.go:121): address unresolved feedback - Review comment
  4. Review (pkg/workflow/threat_detection_isolation_test.go:1154): address unresolved feedback - Review comment

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "eff95b851669e136fcc2360f33419cba38ca395e",
  "kind": "requested",
  "schema_version": "1",
  "state": "b5f15a77711b77f55d23439743185d2bbbd0e527a9b1e8c8a30d31c34dfb9594",
  "work": [
    "34cef64de580b3adbb8d86e0df5578a5f3e86be08cd1f59e11715a88dfea0089",
    "b1319a7b269838f9c60fafb834d83982404bc06c51fbbe7db1bb72b4ef2ebad0",
    "bd36b34e42335ddeb59c010de8282dd9fff543a7057dd083315195902452dde6"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 7K · ◷
Comment /souschef to run again

gh-aw-bot and others added 3 commits November 17, 2026 07:11
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…-fix-npm-registry-egress

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:...

Merged latest main and addressed the three linked review comments in 27f692a. The focused registry tests pass. The final local gate reports pre-existing custom-linter findings in unchanged domains.go and the existing TestParseIntValueOverflow failure; the latest PR CGO run also fails on that overflow test. No unrelated code was changed.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator Author

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Fix failing check impacted-go-tests (FAILURE): Check run.

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "27f692ae4b5ed4f8456bb7b94ea720adf42ae168",
  "kind": "requested",
  "schema_version": "1",
  "state": "ae00b579c94ce505e898bb06136930a711be17964b319b847d33f0f24f0d505b",
  "work": [
    "42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 7K · ◷
Comment /souschef to run again

gh-aw-bot and others added 2 commits November 17, 2026 08:02
…-fix-npm-registry-egress

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:...

Merged latest main in 9eb75c0 and corrected the overflow assertions in f218337. Focused and impacted tests pass. The final gate still reports pre-existing custom-linter findings in domains.go; no CI was triggered.

- **Encoded Strings**: Base64, hex, or other encoded strings that appear to hide secrets, commands, or malicious payloads without legitimate purpose
- **Suspicious Dependencies**: Addition of unknown packages, dependencies from untrusted sources, or libraries with known vulnerabilities
- **npm Lockfile Validation** (for `package-lock.json` changes): Before flagging an npm dependency update as malicious, verify against current npm metadata:
- **npm Lockfile Validation** (for `package-lock.json` changes): When npm registry access is available, verify against current npm metadata before flagging an npm dependency update as malicious. If metadata is unavailable, do not treat the failed lookup as evidence of a malicious update; report the verification as unavailable:
- **Encoded Strings**: Base64, hex, or other encoded strings that appear to hide secrets, commands, or malicious payloads without legitimate purpose
- **Suspicious Dependencies**: Addition of unknown packages, dependencies from untrusted sources, or libraries with known vulnerabilities
- **npm Lockfile Validation** (for `package-lock.json` changes): Before flagging an npm dependency update as malicious, verify against current npm metadata:
- **npm Lockfile Validation** (for `package-lock.json` changes): When npm registry access is available, verify against current npm metadata before flagging an npm dependency update as malicious. If metadata is unavailable, do not treat the failed lookup as evidence of a malicious update; report the verification as unavailable:
@pelikhan
pelikhan merged commit 0114567 into main Nov 17, 2026
105 checks passed
@pelikhan
pelikhan deleted the copilot/domains-audit-fix-npm-registry-egress branch November 17, 2026 16:54
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.3.1

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[domains-audit] Copilot detection automatically grants npm registry egress without a Node opt-in

5 participants