Commit 1d83cfe
authored
ci(check-file-contents): exclude OAuth scope URLs from endpoint scan (#4)
The "Check for hardcoded googleapis.com endpoints" step in
.github/workflows/check-file-contents.yml uses
grep -lE 'https?://[a-zA-Z0-9.-]+\.googleapis\.com'
to find files that should also declare an `.mtls.googleapis.com`
counterpart for dynamic endpoint selection. The regex matches any
googleapis.com URL — including OAuth 2.0 scope URLs like
https://www.googleapis.com/auth/cloud-platform and
.../auth/bigquery — which are identity strings, not API endpoints.
They don't have mTLS counterparts and never will. Any file that
legitimately declares an OAuth scope (very common for ADK plugins
integrating Google APIs) trips the gate even when no real endpoint
is hardcoded.
Fix: add a second pass that filters the candidate set down to files
that have at least one googleapis.com URL OUTSIDE the OAuth scope
namespace (i.e. not matching `googleapis.com/auth/`). The mTLS check
runs only against that filtered set.
Verified against four synthesized cases:
only_oauth.py (only OAuth scopes) → ignored ✓
real_endpoint.py (endpoint, no mTLS) → flagged ✓
real_endpoint_with_mtls (endpoint + mTLS) → passes ✓
mixed.py (OAuth + endpoint, no mTLS)→ flagged ✓
No effect on the surrounding `logger`, `from __future__`, or
`cli` import checks. CI policy intent unchanged: real hardcoded
googleapis.com endpoints still must declare their `.mtls`
counterpart.
Refs:
- #2 (the BQAA Storage Write regional routing
fix that surfaced this false positive)
- GoogleCloudPlatform/BigQuery-Agent-Analytics-SDK#2621 parent bc3a4fa commit 1d83cfe
1 file changed
Lines changed: 21 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
116 | | - | |
117 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
118 | 135 | | |
119 | 136 | | |
120 | 137 | | |
| |||
0 commit comments