feat(dynatrace): validate tokens via v2 lookup + scope-based blast radius#5
Open
beer4code wants to merge 1 commit into
Open
feat(dynatrace): validate tokens via v2 lookup + scope-based blast radius#5beer4code wants to merge 1 commit into
beer4code wants to merge 1 commit into
Conversation
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.
Problem
The existing Dynatrace detector was effectively non-operational. It templated
Baseon{endpoint}with no tenant resolution (so it never ran without a manual --endpoint). Its whoami hit/api/v1/time- a non-existent path that 404s, so it could never actually confirm or deny a token, and it did zero blast-radius modeling.Suggested Changes
dynatrace.go): matches the full token shapedt0[a-z][0-9]{2}.<id>.<secret>(covers dt0s16 platform tokens that gitleaks misses), auto-discovers the tenant URL from the same blob, normalizes the 3rd-gen apps host to the classic API host, and falls back to env vars / --endpoint (or a needs-endpoint hint).dynatrace-api-tokenpattern is outdated but as the project is in maintenance mode, it seemed reasonable to redefine a (practically validated) pattern with support for all currently issued token types directly in geiger.catalog_header.go): validates viaPOST /api/v2/apiTokens/lookup(read-only):Severity was aligned to geiger's tiers:
credentialVault.read(metadata-only and no secret material is extractable) → LOW.Validation
Real-World Example