Skip to content

pup: enable OAuth for DDSQL editor commands - #756

Merged
platinummonkey merged 4 commits into
DataDog:mainfrom
srosenthal-dd:stephen.rosenthal/oauth-ddsql-editor
Sep 3, 2026
Merged

pup: enable OAuth for DDSQL editor commands#756
platinummonkey merged 4 commits into
DataDog:mainfrom
srosenthal-dd:stephen.rosenthal/oauth-ddsql-editor

Conversation

@srosenthal-dd

@srosenthal-dd srosenthal-dd commented Aug 24, 2026

Copy link
Copy Markdown
Member

Summary

Remove 3 ddsql-editor tool endpoints from OAUTH_EXCLUDED_ENDPOINTS so raw_get/raw_post send the OAuth bearer token for ddsql::spec, ddsql::schema_tables, and ddsql::schema_columns commands.

Server-side dependency

Depended on a server-side change adding ValidOAuthAccessToken to the 3 ddsql-editor routes (graphing-backend). Confirmed deployed to prod (verified via Lambo, all 3 routes now show {ValidFullAPIUser,ValidOAuthAccessToken}).

Changes

  • src/raw_client.rs: removed 3 ddsql-editor entries from OAUTH_EXCLUDED_ENDPOINTS, replaced the old positive fallback-required test with a negative one confirming OAuth is no longer excluded for these routes
  • src/auth/types.rs: added ddsql_editor_read to default_scopes() and read_only_scopes() -- without this, OAuth sessions get a 403 (not a 401) on these routes even with the exclusion removed, since the scope was never requested at login. Confirmed against prod: old session (missing the scope) -> 403; fresh session (with the scope) -> 200 on all 3 routes.
  • src/main.rs: dropped stale help text claiming these commands require DD_API_KEY/DD_APP_KEY

Validation

  • cargo test --bin pup -- 1912 passed
  • cargo fmt --check -- passed
  • Live e2e against prod (pup ddsql spec, pup ddsql schema tables, pup ddsql schema columns, and a direct pup api call to /api/unstable/ddsql-editor/tools/table-names) -- all 200 with a fresh OAuth session including ddsql_editor_read

Remove 3 dsql-editor tool endpoints from OAUTH_EXCLUDED_ENDPOINTS
so raw_get/raw_post send the OAuth bearer token for ddsql::spec,
ddsql::schema_tables, and ddsql::schema_columns commands.

Depends on server-side PR: dd-source#66615
…th-ddsql-editor

# Conflicts:
#	src/raw_client.rs
platinummonkey pushed a commit that referenced this pull request Aug 27, 2026
…nd CCM

Remove 32 entries from OAUTH_EXCLUDED_ENDPOINTS for endpoint groups
whose server-side routes already accept OAuth:

- Fleet Automation (15): v2 routes already have ValidOAuthAccessToken
- Cost/Billing (3): server already accepts OAuth (DAL-959)
- Cloud Cost Management config (14): server already accepts OAuth (DAL-959)

Also remove the brittle OAUTH_EXCLUDED_ENDPOINTS count assertion
(test_oauth_excluded_count) which was prone to merge conflicts and
tested no actual behavior. Update test_requires_api_key_fallback_fleet
to test_no_fallback_for_fleet, and switch the
test_other_oauth_excluded_endpoints example from Fleet to Profiling
(which remains excluded).

Remaining excluded entries (8): DDSQL editor (3, handled by #756),
Profiling (4, no OAuth scope), Events intake (1, SDK codegen issue).
@nmuldavin

Copy link
Copy Markdown
Contributor

Hey @srosenthal-dd I need this done for other DDSQL pup stuff I'm doing. Planning to move out of draft soon?

@srosenthal-dd

Copy link
Copy Markdown
Member Author

Hey @srosenthal-dd I need this done for other DDSQL pup stuff I'm doing. Planning to move out of draft soon?

Yes was just waiting for the corresponding server side change to deploy.

…th-ddsql-editor

# Conflicts:
#	src/raw_client.rs
Without this, OAuth sessions get a 403 (permission denied) on the
ddsql-editor tool routes even after the OAuth exclusion is removed --
confirmed against prod. Per DAL-960, both changes are needed together.

Also drop the now-stale help text claiming these commands require
DD_API_KEY/DD_APP_KEY.
@srosenthal-dd
srosenthal-dd marked this pull request as ready for review September 3, 2026 18:23
@srosenthal-dd
srosenthal-dd requested a review from a team as a code owner September 3, 2026 18:23
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-03T18:27:17.993387Z fa45ba8 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fa45ba8432

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/auth/types.rs
@platinummonkey
platinummonkey merged commit 7b1c1a5 into DataDog:main Sep 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants