Re-add APM service remapping CRUD commands#498
Merged
platinummonkey merged 2 commits intoMay 12, 2026
Merged
Conversation
Resurrects DataDog#439 (reverted in DataDog#454). The original revert was because pup's `default_scopes()` requested `apm_service_renaming_write` before that scope was on pup's server-side DCR client allowlist, breaking every `pup auth login` with `invalid_scope`. The allowlist is now in place, verified end-to-end against app.datadoghq.com with this build: - `pup auth login` succeeds with `apm_service_renaming_write` in the token - `pup apm service-remapping list` returns the rules - `pup apm service-remapping delete <bogus-uuid> 1` returns 404 (scope passed; rule not found), confirming the write scope is honored Test-count assertion bumped 84 -> 85 to match current main. Adds back: - `pup apm service-remapping {list,create,get,update,delete}` commands - `apm_service_renaming_write` in `default_scopes()` - `raw_put` helper in `client.rs`
Member
Author
|
End-to-end transcripts proving the scope is wired through (from Claude Code). Staging (datad0g.com)404 = scope passed Smart Edge, rule lookup miss. Prod (datadoghq.com)403 with "Failed permission authorization checks" is a downstream RBAC check (the test account lacks the |
Restored from DataDog#439 verbatim, but main has since moved every other raw_* helper onto parse_response_json (deep-stack JSON parsing via serde_stacker to bypass serde_json's 128-level recursion cap). Match that pattern so service remapping update doesn't re-introduce the pre-hardening failure mode for deeply nested PUT responses.
rachelyangdog
approved these changes
May 12, 2026
platinummonkey
approved these changes
May 12, 2026
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.
Context
Resurrects #439, which was reverted in #454 because
pup auth loginfailed withinvalid_scopeonce the new scope was requested. The server-side DCR client allowlist is now in place, so the original failure mode is resolved.Requested by @rachelyangdog
Summary
Restores the four files removed by the revert, with one updated test assertion to match current
main:pup apm service-remapping {list,create,get,update,delete}(new commands wired insrc/main.rs, implementation insrc/commands/apm.rs)apm_service_renaming_writeadded todefault_scopes()insrc/auth/types.rsraw_puthelper added tosrc/client.rsto support theupdate(PUT) endpointtest_default_scopeslength assertion 84 -> 85No exclusion-list changes: the original PR briefly added then removed three
/api/v2/service-naming-rulesentries fromOAUTH_EXCLUDED_ENDPOINTS; net effect was zero. Currentmainhas no such entries, so OAuth is used for these routes by default -- which is what we want.Test plan
cargo build,cargo fmt --check,cargo clippy --all-targets -- -D warningscleancargo test --bin pup auth::types(9 passed)cargo test --bin pup -- --test-threads=1 commands::apm(19 passed, including 11 newservice_remapping_*tests)datad0g.com(staging) anddatadoghq.com(prod): login issues a token containingapm_service_renaming_write,service-remapping listreturns real rules, andservice-remapping delete <bogus-uuid> 1reaches the service (404 in staging, 403 RBAC in prod) -- proving the scope is honored end-to-end. Transcripts in a comment below.