Skip to content

Add JSON-field auth token extraction and additional header support to ServiceDeployer - #104

Closed
nolanmurphey wants to merge 2 commits into
restatedev:mainfrom
capitalone-contributions:service-deployer-auth-options
Closed

Add JSON-field auth token extraction and additional header support to ServiceDeployer#104
nolanmurphey wants to merge 2 commits into
restatedev:mainfrom
capitalone-contributions:service-deployer-auth-options

Conversation

@nolanmurphey

Copy link
Copy Markdown

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 the
    named 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 API
    request (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 override
    them 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 on
    ServiceRegistrationProps, forwarded to the custom resource only when set.
  • lib/restate-constructs/register-service-handler/index.mts
    createAuthHeaderbuildBaseHeaders; spreads extra headers last (caller
    wins) and performs secret-safe JSON-field extraction (never echoes secret
    material on error).
  • test/restate-constructs.test.ts — new tests: forward-when-set and
    omit-when-unset for both options.
  • Updated handler bundle snapshot.

…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
@github-actions

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


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.

@github-actions github-actions Bot locked and limited conversation to collaborators Jul 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant