Address sink-visibility runtime check review feedback#8907
Merged
Conversation
- Skip runtime check when sink-visibility is omitted (empty string), preserving backward-compatible behavior for legacy configs - Remove duplicate logging from VerifySinkVisibility helper; let the caller (verifySinkVisibilityAtRuntime) handle all logging with serverID context - Return configured value when no override is needed, instead of returning the actual API value which could drift from compiler config (e.g. configured='private' but actual='internal' no longer returns 'internal') Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines the sink-visibility runtime verification behavior to align with review feedback from #8903 and preserve backward compatibility when sink-visibility is omitted.
Changes:
- Skip the runtime GitHub API visibility check entirely when
sink-visibilityis omitted (empty string). - Centralize override/pass logging in
verifySinkVisibilityAtRuntime(removing duplicate logging from the helper). - Adjust
VerifySinkVisibilityto only override in the security-critical case (actual repo is public but config isn’t “public”), and otherwise keep the configured value.
Show a summary per file
| File | Description |
|---|---|
| internal/server/guard_init.go | Skips runtime sink-visibility verification when sink-visibility is omitted; retains existing skip behavior for missing repo/token. |
| internal/githubhttp/visibility.go | Narrows override behavior to the public-repo mismatch case and removes helper-side warning logging. |
| internal/githubhttp/visibility_test.go | Updates unit expectation so configured “private” remains “private” when actual is “internal”. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Low
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This was referenced Jul 8, 2026
This was referenced Jul 8, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Addresses the three review feedback items from #8903 for the sink-visibility runtime verification.
Changes
1. Skip runtime check when sink-visibility is omitted
When
sink-visibilityis not explicitly configured (empty string), the runtime API check is now skipped entirely. This preserves the documented backward-compatible behavior where omitted sink-visibility uses accept patterns without any surprise upgrade to "public".Before: Omitted config + public repo → runtime check overrides to "public" (breaking backward compat)
After: Omitted config → runtime check skipped, accept patterns used as-is
2. Remove duplicate logging from
VerifySinkVisibilityThe helper function no longer logs override warnings via
logger.LogWarn. All logging is now handled by the caller (verifySinkVisibilityAtRuntime) which has theserverIDcontext for proper correlation.3. Return configured value when no override needed
VerifySinkVisibilitynow returns the configured value unchanged in all non-override cases, instead of returning the actual API visibility. This prevents policy drift whereconfigured="private"butactual="internal"would have returned "internal".Before: configured="private", actual="internal" → returns "internal"
After: configured="private", actual="internal" → returns "private" (unchanged)
The only case that changes the return value is the security-critical one: repo is actually public but config doesn't say "public".
Testing
All integration tests and unit tests pass, including the existing sink-visibility test suite.
Related