fix(auth): expand OAuth support to 69 scopes across all supported domains#153
Merged
platinummonkey merged 6 commits intodatadog-labs:mainfrom Mar 4, 2026
Merged
Conversation
…, events, HAMR Add missing OAuth scopes so these command domains work with bearer token auth instead of requiring API key fallback. New scopes: integrations_read, manage_integrations, org_management, security_monitoring_filters_write, security_monitoring_rules_write, logs_modify_indexes, disaster_recovery_status_read, disaster_recovery_status_write. Also enables events search for OAuth by removing the forced API key requirement and the OAUTH_EXCLUDED_ENDPOINTS entry. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove RUM and Notebooks from OAUTH_EXCLUDED_ENDPOINTS and replace all forced API key bail blocks with bearer client middleware in rum.rs. New scopes: notebooks_read, notebooks_write, rum_generate_metrics, rum_session_replay_read (rum_apps_read/write and rum_retention_filters_read/write were already present). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reorganize default_scopes() alphabetically by domain and align with the complete expected scope list. Adds 13 missing scopes (CI Visibility, Service Catalog, Teams, BITS, Data Scanner, Status Pages, host_tags_write) and removes 6 unnecessary scopes (slos_corrections, synthetics_global_variable_*, synthetics_private_location_write, security_monitoring_suppressions_read, user_self_profile_read). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
#96 is old enough to be targeting Go code; it shouldn't be necessary anymore #144 plus my addition srosenthal-dd#1 still has some valuable additions, so is valuable separately. If it makes it simpler, I can merge all of the work into a single PR. |
- Remove 3 validate_api_and_app_keys() gates in main.rs for status-pages (Pages, Components, Degradations) — the command module already had bearer client support via make_api() - Add azure_configuration_read scope (69 total) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The status_pages match arms were written with manual nesting instead of the rustfmt-preferred inline match style. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This was referenced Mar 4, 2026
srosenthal-dd
added a commit
to srosenthal-dd/pup
that referenced
this pull request
Mar 4, 2026
Remaining changes from PR datadog-labs#144 that weren't covered by PR datadog-labs#153: - Add teams_manage OAuth scope for team create/update/delete operations - Enable v2.search_flaky_tests as an unstable operation Co-Authored-By: Stephen Rosenthal <stephen.rosenthal@datadoghq.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Expands OAuth scope coverage from 48 to 69 scopes and enables OAuth for all command domains except API/App Keys, Fleet Automation, AWS/GCP integrations, and metrics metadata update. Previously many commands (RUM, Notebooks, Events search, Status Pages) forced API key fallback even though OAuth scopes exist for them.
Changes
src/auth/types.rs— Reorganizeddefault_scopes()alphabetically by domain. Net result: 69 scopes (was 48). Added 14 new scopes, removed 6 unnecessary ones.src/commands/events.rs— Remove forced API key requirement for events search; use bearer clientsrc/commands/rum.rs— Remove all 18 forced API keybail!blocks; use bearer client for all RUM functions (apps, metrics, retention filters, playlists, heatmaps)src/main.rs— Remove 3validate_api_and_app_keys()gates for Status Pages (Pages, Components, Degradations)src/client.rs— Remove RUM (10), Notebooks (5), and Events (1) fromOAUTH_EXCLUDED_ENDPOINTS(40 → 24)Scopes added (14)
apm_service_catalog_readservice-catalog list/getazure_configuration_readcloud azure listbits_investigations_readbits_investigations_writeci_visibility_readcicd pipelines/tests/eventscode_coverage_readcicd code-coveragedata_scanner_readdora_metrics_writecicd dorahost_tags_writetags updatestatus_pages_settings_readstatus_pages_settings_writeteams_readon-call teamstest_optimization_readcicd tests/flaky-teststest_optimization_writecicd flaky-tests updateScopes removed (6)
slos_correctionssynthetics_global_variable_readsynthetics_global_variable_writesynthetics_private_location_writesecurity_monitoring_suppressions_readuser_self_profile_readOAuth-enabled domains (previously blocked)
validate_api_and_app_keys()gates (code already used bearer client)E2E validation (staging, DD_SITE=datad0g.com)
50 passed, 3 failed (transient), 1 skipped across 27 domains:
apm services listservice-catalog listaudit-logs searchinvestigations listcases searchcicd pipelines list,cicd tests list,cicd events searchcloud azure listcode-coverage branch-summarydashboards listdata-governance scanner rules listerror-tracking issues searchevents list,events searchhamr connections get,hamr connections create(write)infrastructure hosts list,tags listincidents listintegrations jira accounts list,integrations webhooks list,integrations jira templates create(write)logs search,logs list,logs archives list,logs metrics list,logs restriction-queries listmetrics list,metrics querymonitors list,downtime listnotebooks listoci tenancy-configs listorganizations listrum apps list,rum events,rum sessions list,rum playlists listsecurity signals list,security rules list,security findings search,security content-packs list,security content-packs activate(write),security rules bulk-export(write)status-pages pages list,status-pages degradations listslos listsynthetics tests list,synthetics locations listtraces searchon-call teams listusage summaryusers listNot yet supported with OAuth
metrics_metadata_writescope not requestedTesting
cargo test— 342 passedcargo clippy -- -D warnings— cleancargo fmt --check— clean🤖 Generated with Claude Code