ci: Ignore OAuth scopes in endpoint check#6245
Open
h-tsuboi918 wants to merge 1 commit into
Open
Conversation
9 tasks
e95f652 to
ab3c9e7
Compare
The googleapis.com endpoint compliance check treated OAuth scope URLs as service endpoints and required an mTLS counterpart. Exclude https://www.googleapis.com/auth/ URLs before checking for mTLS endpoint variants. Fixes google#6238
ab3c9e7 to
f03a5e8
Compare
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.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
2. Or, if no issue exists, describe the change:
Problem:
The
File Content ComplianceCI check treats any changed Python file containing agoogleapis.comURL as a file with a hardcoded service endpoint. This causes false positives for OAuth scope URLs such ashttps://www.googleapis.com/auth/cloud-platform, which are not service endpoints and do not have.mtls.googleapis.comcounterparts.Solution:
Update the CI check to classify matches at the URL level before building
FILES_WITH_ENDPOINTS. The check now excludes OAuth scopes underhttps://www.googleapis.com/auth/, while still checking non-scopegoogleapis.comURLs for an mTLS counterpart.Update after rebase: after this PR was opened, commit 8a7656b moved the compliance check from inline GitHub Actions bash into
scripts/compliance_checks.py. This PR has been rebased and now applies the same URL-level OAuth scope exclusion incheck_mtls().Testing Plan
Unit Tests:
No Python unit tests were added because, at the time this PR was opened, this change only updated a GitHub Actions shell check. After the check moved into
scripts/compliance_checks.py, I kept the conservative approach because there are currently no unit tests for repository-level scripts underscripts/. I verified the changed behavior through the script CLI and thecompliance-checkspre-commit hook.Local shell verification:
https://www.googleapis.com/auth/cloud-platformis not included inFILES_WITH_ENDPOINTS.https://example.googleapis.com/v1/projectsis included inFILES_WITH_ENDPOINTS.https://example.googleapis.com/v1/projectswithout.mtls.googleapis.comis reported inFILES_MISSING_MTLS.https://example.googleapis.com/v1/projectsandhttps://example.mtls.googleapis.com/v1/projectsis not reported inFILES_MISSING_MTLS.Test fixtures used locally:
Command:
Output:
Additional verification after rebasing onto the script-based implementation:
Commands:
Expected failing-case output:
Manual End-to-End (E2E) Tests:
Not run. This change affects a GitHub Actions workflow check, and local shell verification was used to validate the changed matching behavior.
Update after rebase: the check now runs through the repository compliance hook in
scripts/compliance_checks.py; local CLI and pre-commit hook verification were used to validate the updated implementation.Checklist
Additional context
This was observed while investigating PR #6201, where the CI check flagged
src/google/adk/tools/mcp_tool/mcp_session_manager.pybecause it contains the OAuth scopehttps://www.googleapis.com/auth/cloud-platform.Related prior PR: #5931 attempted to fix the same false positive in the older
.github/workflows/check-file-contents.ymlworkflow, but it was closed without being merged. The check later moved to.github/workflows/continuous-integration.yml.After this PR was opened, commit 8a7656b moved the compliance check again, from inline GitHub Actions bash into
scripts/compliance_checks.py. This PR has been updated to target the new script-based implementation while preserving the original fix intent.