Repository navigation
feat(allowlist): exclude secret paths from review - #1244
katepallewarprathmesh-sketch wants to merge 1 commit into
Conversation
|
🔍 OpenCodeReview found 3 issue(s) in this PR.
|
| case ExcludeUserRule, ExcludeExtension, ExcludeDefaultPath, ExcludeSecretPath: | ||
| fmt.Fprintf(stdout.Writer(), "[ocr] Skipping %s — filtered by path/extension rules\n", effectivePath(dec.Diff)) |
There was a problem hiding this comment.
The log message "filtered by path/extension rules" is misleading for ExcludeSecretPath. Secret-file exclusion is a security measure, not a path/extension filter. The comment above this switch explicitly warns against silently inheriting the path/extension wording for new reasons, yet ExcludeSecretPath does exactly that.
Consider giving ExcludeSecretPath its own case with a more accurate message, e.g.:
case ExcludeSecretPath:
fmt.Fprintf(stdout.Writer(), "[ocr] Skipping %s — matches known secret/credential path\n", effectivePath(dec.Diff))| if allowedext.IsSecretPath(path) { | ||
| return ExcludeSecretPath | ||
| } |
There was a problem hiding this comment.
ExcludeSecretPath is checked before the user-include gate (lines 85–87), which means an explicit user include rule cannot override this exclusion. This matches the semantics of ExcludeProviderDirectory (which is documented as unconditional), but unlike that constant, ExcludeSecretPath has no comment explaining that it is intentionally immune to user includes.
Consider adding a doc comment on the ExcludeSecretPath constant in internal/model/preview.go similar to the one on ExcludeProviderDirectory, e.g.:
// ExcludeSecretPath is an unconditional exclusion for files matching
// built-in credential-path patterns. Unlike default_path, an include
// rule cannot make the file reviewable.Without this, a future maintainer may inadvertently move the check below the user-include gate or assume the omission was accidental.
|
Your solution is not bad, nor concise, there is definitely a way to simplify it. |
|
@wu21-web Thanks for reviewing. I’m happy to simplify the implementation if there’s a cleaner approach. Could you point me to the specific parts you think can be simplified, or describe the approach you have in mind? I’d like to make sure the implementation stays aligned with the agreed selection-only scope while keeping the secret-path protection unconditional. Also, if your concern is around the original issue/finding, would you be open to assigning the issue to me? I’m genuinely very interested in contributing to this repository and would be happy to take responsibility for implementing and refining the fix based on your feedback. |
|
That is what you gotta figure out 🤔 |
|
Got it I’ll dig into it and see if I can come up with a cleaner approach while keeping the agreed selection-only scope and the unconditional secret-path protection. |
| ExcludeUserRule ExcludeReason = "user_exclude" | ||
| ExcludeExtension ExcludeReason = "unsupported_ext" | ||
| ExcludeDefaultPath ExcludeReason = "default_path" | ||
| ExcludeSecretPath ExcludeReason = "secret_exclude" |
There was a problem hiding this comment.
In your own words without using LLM:
Do you consider secret excludetions as on the same level as all the others?
|
I don’t think they’re exactly at the same level. Secret exclusions are security-related, so I think they should have higher precedence and shouldn’t be overridden by user include rules. I see the same |
8a182ae to
420897e
Compare
|
@katepallewarprathmesh-sketch CI / test (pull_request)Failing after 15s |
|
CI formatting issue resolved. Ran Pushed formatting-only commit |
|
@katepallewarprathmesh-sketch merge conflict,please rebase main |
6c3d42a to
0277a7a
Compare
|
The merge conflict has been resolved. I rebased The conflict in Validation completed successfully:
The PR branch is now updated and ready for CI. |
| "BATCH_SIZE": 50, | ||
| "DEDUP_MIN_COMMENTS": 4 | ||
| "PLAN_MODE_LINE_THRESHOLD": 200, | ||
| "DEDUP_MIN_COMMENTS": 4, |
There was a problem hiding this comment.
@katepallewarprathmesh-sketch It looks like there are some problems with your merge. Please rebase onto the latest main and separate out the unrelated changes regarding plan-mode and scan thresholds—the current diff overlaps and conflicts with main, and it introduces undeclared changes to scan behavior.
style: format scan coverage test
0277a7a to
80c85ce
Compare
* feat(allowlist): exclude secret paths from review * docs(review-rules): document secret exclusions Built on the security finding by @wu21-web and the initial implementation in #1244 by @katepallewarprathmesh-sketch. Co-authored-by: Prathmesh Katepallewar <[email protected]> Co-authored-by: Tao Xin <[email protected]>
* feat(allowlist): exclude secret paths from review * docs(review-rules): document secret exclusions Built on the security finding by @wu21-web and the initial implementation in #1244 by @katepallewarprathmesh-sketch. Co-authored-by: Prathmesh Katepallewar <[email protected]> Co-authored-by: Tao Xin <[email protected]>
|
Thank you for the implementation — it addressed the same problem as #1262 and covered the core requirements from #1240 well. After reviewing both PRs, I chose to merge #1262 as it had a slightly more complete implementation (rename-path checking, scan-side parity, and localized doc updates). To credit your contribution, I added you as a co-author in the merge commit: Closing this in favor of #1262. Thanks again for the work! |
* feat(allowlist): exclude secret paths from review * docs(review-rules): document secret exclusions Built on the security finding by @wu21-web and the initial implementation in alibaba#1244 by @katepallewarprathmesh-sketch. Co-authored-by: Prathmesh Katepallewar <[email protected]> Co-authored-by: Tao Xin <[email protected]>
Summary
Fixes #1240.
Adds a built-in secret-path exclusion layer so common credential files are not included in review or full-scan prompts by default.
Changes
.env,.ssh, SSH private key names,.netrc,.npmrc,.pypirc, and.dockercfg.includerules so configuration cannot override it.secret_exclude.file_readunchanged, matching the agreed scope..env.example,.env.sample, and.env.templateare not matched by the secret patterns; existing extension filtering remains unchanged for those files.Validation
Focused tests pass for:
internal/config/allowlistinternal/modelinternal/agentinternal/scanThe full repository test suite was not run.
Disclosure
This change was investigated and implemented with AI assistance using GitHub Copilot. The generated changes and focused test results were manually reviewed.