Repository navigation
Require npm registry opt-in for inline Copilot detection - #78636
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
| - **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]>
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: 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.
|
This comment has been minimized.
This comment has been minimized.
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: 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.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: 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.
|
|
✅ PR Specification Reviewer completed successfully! Caution agentic threat detected DetailsPotential security threats were detected in the agent output. Detected threat types: prompt injection. Review the workflow run logs for details. PR Specification ReviewerOutcome: 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.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
There was a problem hiding this comment.
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
Comment MemoryPeek at saved memory (review-history)History |
🏗️ Design Decision Gate — ADR RequiredThis PR adds 125 lines in business-logic directories (above the 100-line threshold) and has no linked ADR, so I generated a draft: Inferred decision: remove Next step: review the draft, fix the
|
Comment MemoryPeek at saved memory (spec-review-history)History |
There was a problem hiding this comment.
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.ymlfiles still grantregistry.npmjs.orgin theirdetectionjob. This PR changes compiled output but commits no lock updates. Regenerate them withmake recompile. - Unaddressed prompt-injection concern:
actions/setup/md/threat_detection.md(around line 71) still tells the detector to runnpm viewon 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:
TestCompiledCopilotDetectionNpmRegistryOptIncompiles a temporary workflow, so it cannot detect drift in committed locks.
Positive Highlights
- ✅ Removing
registry.npmjs.orgfrom thethreat-detectionengine set and the default ecosystem sets closes the default exposure. - ✅ Explicit
network.blockedstill 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
| // 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; |
There was a problem hiding this comment.
[/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.
There was a problem hiding this comment.
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")) && |
There was a problem hiding this comment.
[/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.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
[/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.
There was a problem hiding this comment.
Added an assertion against the committed default-network smoke-copilot-small lockfile to catch stale registry access. See 27f692a.
There was a problem hiding this comment.
🔵 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.allowedincludesnodeorregistry.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)
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
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"
}
|
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]>
Merged latest |
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
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"
}
|
…-fix-npm-registry-egress Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Merged latest |
| - **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: |
|
🎉 This pull request is included in a new release. Release: |
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
nodeorregistry.npmjs.orgtonetwork.allowed, then recompile: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.