Add JSON-field auth token extraction and additional header support to ServiceDeployer - #104
Closed
nolanmurphey wants to merge 2 commits into
Closed
Conversation
…tration Support extracting a bearer token from a JSON field of the auth-token secret, and forwarding static headers on every admin API request. Both options are opt-in and only forwarded to the custom resource when set, avoiding CFN property diffs for existing users. JSON extraction happens inside the handler so the plaintext token is never exposed as a custom-resource property. Co-Authored-By: Claude Code
Simplify header handling: instead of stripping reserved headers (Authorization, Content-Type, Accept) from additionalHeaders, spread additionalHeaders last so a caller can override them when a proxy or gateway in front of the admin endpoint requires it. Co-Authored-By: Claude Code
Contributor
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Addresses Tier 1 of #103 by adding two opt-in registration options to the Restate
ServiceDeployer:authTokenJsonField— when the auth-token secret holds a JSON object(e.g.
{"token":"rst_xxx","version":3}), extract the bearer token from thenamed top-level field instead of using the whole secret string. Extraction
happens inside the custom-resource handler, so the plaintext token never
becomes a CloudFormation property.
additionalHeaders— static headers added to every Restate admin APIrequest (health check, registration, visibility patch, pruning). They are
spread last, so they take precedence over the headers the handler sets itself
(
Authorization,Content-Type,Accept), allowing a caller to overridethem when a proxy or gateway in front of the admin endpoint requires it.
Both options are only forwarded to the custom resource when set, so existing
users see no CloudFormation property diff.
This covers the structured-secret extraction and header-injection parts of #103 (Tier 1).
Changes
lib/restate-constructs/service-deployer.ts— new props onServiceRegistrationProps, forwarded to the custom resource only when set.lib/restate-constructs/register-service-handler/index.mts—createAuthHeader→buildBaseHeaders; spreads extra headers last (callerwins) and performs secret-safe JSON-field extraction (never echoes secret
material on error).
test/restate-constructs.test.ts— new tests: forward-when-set andomit-when-unset for both options.