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.
Filter Runner-Guard RGS-012 false positives for local Copilot allow-tools #54341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Filter Runner-Guard RGS-012 false positives for local Copilot allow-tools #54341
Changes from all commits
4078cd72ce893c77c9ab47eae2ed3c94815d9ba5e21c5c0e598b8387File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[/diagnosing-bugs] The fast path in
findingInCopilotLocalCurlAllowToolsuppresses findings on a matching line without verifying the line is inside a Copilot execution step — inconsistent with the stricter step-scoped check below it.💡 Details and suggested fix
The fast path fires for any file that has
# --allow-tool shell(curl (localhost/redacted) even in non-Copilot steps. The slow path guards against this withisStepNameLine(lines[stepStart], copilotExecutionStepNameMarker)`, but the fast path bypasses that guard:An attacker (or an accidental workflow) can silence an RGS-012 finding simply by placing `# --allow-tool shell(curl (localhost/redacted) in any step.
Simplest fix: remove the fast path entirely. The slow path already handles these lines correctly since
lineIndex < runIndexplaces them beforerun:.@copilot please address this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L126-157: yagni: two near-identical curl-host extractors (comment-single vs line-multi). One regex/loop over
shell(curl ...)occurrences handles both; comment form is just the multi-host loop with 1 match expected.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[/diagnosing-bugs]
curlTargetHoststrips port wildcards (*) and digits but not other wildcard patterns (e.g.(localhost/redacted) The path is already stripped by the/check, but a URL like(localhost/redacted) (unusual but not impossible from a crafted allow-tool line) would leave the port stripping silently skipping:allDigits("3*00")is false andport == "*"is false, so the port stays in the host string, causingisLocalCurlAllowToolHostto returnfalseand the finding to be preserved unexpectedly.💡 Suggested fix
The risk is low in practice but worth a comment or an additional
strings.HasPrefix(port, "*")guard:Or simply document that wildcard ports other than
*are out of scope.@copilot please address this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L186-196: stdlib: hand-rolled digit-only check.
_, err := strconv.Atoi(port); err == nil, 1 line.Uh oh!
There was an error while loading. Please reload this page.