Restrict Google Discovery bundle URLs#1105
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-marketing | f275c2c | Commit Preview URL Branch Preview URL |
Jun 23 2026, 06:13 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-cloud | f275c2c | Jun 23 2026, 06:16 PM |
Cloudflare previewTorn down — the PR is closed. |
@executor-js/cli
@executor-js/config
@executor-js/execution
@executor-js/sdk
@executor-js/codemode-core
@executor-js/runtime-quickjs
@executor-js/plugin-file-secrets
@executor-js/plugin-graphql
@executor-js/plugin-keychain
@executor-js/plugin-mcp
@executor-js/plugin-onepassword
@executor-js/plugin-openapi
executor
commit: |
f46a78f to
e747baa
Compare
be395f6 to
94c590f
Compare
e747baa to
8f3481d
Compare
94c590f to
7a69015
Compare
8f3481d to
9e508f9
Compare
7a69015 to
e9aff2c
Compare
e9aff2c to
54782a5
Compare
Greptile SummaryThis PR hardens the Google Discovery bundle flow by replacing broad
Confidence Score: 5/5Safe to merge — the change adds defence-in-depth URL allowlisting with no regressions to the existing fetch or detect flows. All three entry points now validate and canonicalize Discovery URLs before any network activity. The two-branch normalization is idempotent (canonical URLs round-trip cleanly), preset lookups and audience warnings are correctly updated, and the new tests exercise both the happy path and lookalike-host rejection. No pre-existing flows are broken, and the new guard is consistently applied. No files require special attention; discovery.ts carries the most logic and has solid test coverage. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Caller-supplied URL] --> B[normalizeGoogleDiscoveryUrl]
B --> C{protocol === https:\nno userinfo/hash?}
C -->|No| D[return null]
C -->|Yes| E{host === www.googleapis.com?}
E -->|Yes| F{any search params?}
F -->|Yes| D
F -->|No| G{pathname matches\n/discovery/v1/apis/service/version/rest?}
G -->|No| D
G -->|Yes| H[canonical www.googleapis.com URL]
E -->|No| I{serviceFromGoogleApisHost\nhost.endsWith .googleapis.com\nno subdots, valid chars}
I -->|null| D
I -->|service| J{pathname /$discovery/rest\nonly version= param\nversion passes RE?}
J -->|No| D
J -->|Yes| H
H --> K[uniqueUrls dedup by canonical form]
H --> L[fetchGoogleDiscoveryDocument\npreflight re-validates]
H --> M[detect: store canonical endpoint]
H --> N[presets: audience-warning lookup]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[Caller-supplied URL] --> B[normalizeGoogleDiscoveryUrl]
B --> C{protocol === https:\nno userinfo/hash?}
C -->|No| D[return null]
C -->|Yes| E{host === www.googleapis.com?}
E -->|Yes| F{any search params?}
F -->|Yes| D
F -->|No| G{pathname matches\n/discovery/v1/apis/service/version/rest?}
G -->|No| D
G -->|Yes| H[canonical www.googleapis.com URL]
E -->|No| I{serviceFromGoogleApisHost\nhost.endsWith .googleapis.com\nno subdots, valid chars}
I -->|null| D
I -->|service| J{pathname /$discovery/rest\nonly version= param\nversion passes RE?}
J -->|No| D
J -->|Yes| H
H --> K[uniqueUrls dedup by canonical form]
H --> L[fetchGoogleDiscoveryDocument\npreflight re-validates]
H --> M[detect: store canonical endpoint]
H --> N[presets: audience-warning lookup]
Reviews (2): Last reviewed commit: "Restrict Google Discovery bundle URLs" | Re-trigger Greptile |
54782a5 to
f275c2c
Compare
f2e5bc2 to
5865d0c
Compare
|
Superseded by batch merge #1106. |
What changed
www.googleapis.com/discovery/v1/apis/.../restand documented{service}.googleapis.com/$discovery/rest?version=...endpoints.Why
The Google bundle flow accepted caller-supplied Discovery URLs and only checked for broad
googleapis.comstrings, which allowed lookalike hosts and untrusted fetch targets.Validation
bun --bun vitest run src/sdk/discovery.test.ts src/sdk/plugin.test.ts src/sdk/product-picker-scopes.test.tsfrompackages/plugins/googlebun run --cwd packages/plugins/google typecheckgit diff --checkStack
Base:
fix/openapi-hosted-origin-guardPrevious: #1104
Next:
fix/microsoft-graph-url-allowlist