Skip to content

pup: remove stale OAuth-excluded endpoints for fleet, cost/billing, and CCM - #762

Open
srosenthal-dd wants to merge 3 commits into
DataDog:mainfrom
srosenthal-dd:stephen.rosenthal/oauth-cleanup-excluded
Open

pup: remove stale OAuth-excluded endpoints for fleet, cost/billing, and CCM#762
srosenthal-dd wants to merge 3 commits into
DataDog:mainfrom
srosenthal-dd:stephen.rosenthal/oauth-cleanup-excluded

Conversation

@srosenthal-dd

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

Copy link
Copy Markdown
Member

Summary

Remove 32 stale entries from OAUTH_EXCLUDED_ENDPOINTS (src/raw_client.rs) whose server-side routes already accept OAuth: Fleet Automation v2 routes (15, since 2026-06-04), Cost/Billing (3, DAL-959), Cloud Cost Management config (14, DAL-959). This table only affects raw_get/raw_post (pup api passthrough and hand-written commands) -- no live pup command uses raw_get/raw_post for any of these paths today, so this only changes pup api passthrough behavior.

Note: this doesn't close pup's fleet OAuth gap. fleet.rs's commands call /api/unstable/fleet/*, not the /api/v2/fleet/* paths covered here, and that surface still deliberately excludes OAuth (DAL-509, separate issue).

Also removes the brittle test_oauth_excluded_count assertion.

Remaining excluded entries (8)

…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 DataDog#756),
Profiling (4, no OAuth scope), Events intake (1, SDK codegen issue).
@datadog-official

This comment has been minimized.

Three tests used /api/v2/fleet/agents as their OAuth-excluded example,
but fleet entries were removed from OAUTH_EXCLUDED_ENDPOINTS in this
PR. Switch all three to use /profiling/api/v1/profiles/abc/info which
is still excluded:

- test_prefix_matching_with_id (raw_client.rs)
- test_api_oauth_excluded_uses_api_keys (api.rs)
- test_api_absolute_url_oauth_excluded_uses_api_keys (api.rs)
Add a fake /api/v2/test-oauth-excluded/ entry to OAUTH_EXCLUDED_ENDPOINTS
that exists only for tests needing a "still excluded" example. This
avoids churn when real endpoints (e.g. profiling) gain OAuth support
and are removed from the excluded list.

Update test_prefix_matching_with_id, test_other_oauth_excluded_endpoints,
test_api_oauth_excluded_uses_api_keys, and test_api_absolute_url_oauth_excluded
to use the test fixture instead of profiling or fleet paths.

Also fixes the CI failure where api.rs tests used /profiling/ paths that
didn't work with run()'s /api/ path prefix prepending.
@srosenthal-dd
srosenthal-dd marked this pull request as ready for review August 25, 2026 19:49
@srosenthal-dd
srosenthal-dd requested a review from a team as a code owner August 25, 2026 19:49

@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: a3df23e121

ℹ️ 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/raw_client.rs
path: "/api/v2/cost/anomalies",
method: "GET",
},
// Profiling (4)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restore the Observability Pipelines exclusions

When an OAuth-authenticated user with API/application keys runs pup obs-pipelines diff, src/commands/obs_pipelines.rs calls raw_get for /api/v2/obs-pipelines/pipelines/{id}; removing this endpoint group makes apply_auth send the bearer token instead of the required keys, causing the request to be rejected. The documented rollout covers Fleet, Cost/Billing, and CCM—not Observability Pipelines, whose six entries were explicitly marked API-key-only—so restore those exclusions and their behavioral coverage. This unrelated deletion also exceeds the stated scope of the change.

AGENTS.md reference: AGENTS.md:L21-L27

Useful? React with 👍 / 👎.

Comment thread src/raw_client.rs
path: "/api/v2/cost/anomalies",
method: "GET",
},
// Profiling (4)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Cover the cost and CCM auth-routing changes

The commit removes the Cost/Billing and Cloud Cost Management entries, but the only new no-fallback assertions exercise Fleet; a repo-wide search finds no test proving that representative /api/v2/usage/* and /api/v2/cost/* requests now attach an OAuth bearer rather than falling back to API/application keys. Add header-level happy-path coverage for these endpoint groups, along with the applicable missing-auth failure case, so method/path mistakes in this security-sensitive table cannot pass unnoticed.

AGENTS.md reference: AGENTS.md:L21-L22

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants