Feat/56 observability header redaction#68
Merged
Lakes41 merged 2 commits intoJun 21, 2026
Merged
Conversation
Fixes Adamantine-guild#56 This commit introduces a redactHeaders helper to ensure sensitive information such as API keys, authorization headers, and cookies are not leaked to user-defined observability hook callbacks. Changes: - Expanded RequestHookPayload and ResponseHookPayload to include safely redacted headers and responseHeaders. - Added a redactHeaders utility function in httpClient.ts that filters out a default list of sensitive keys (authorization, x-api-key, cookie, set-cookie). - Updated test coverage to assert redaction logic correctly intercepts known sensitive headers. - Updated SDK guide documentation to describe the hook payload changes.
6 tasks
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.
Description
This PR introduces request and response header redaction for the HTTP client's observability hooks. It ensures that hook payloads expose useful metadata (like request and response headers) without leaking sensitive information such as API keys, authorization tokens, or cookies.
Semver impact: minor
Linked Issue
Closes #56
Type of Change
Changes Made
src/http/http.types.ts: ExpandedRequestHookPayloadandResponseHookPayloadtypes to include theheadersandresponseHeadersproperties. Both are typed to indicate they have been safely redacted.src/http/httpClient.ts: Implemented a newredactHeadersutility helper that replaces known sensitive headers (authorization,x-api-key,cookie,set-cookie) with[REDACTED]. Applied this helper to format headers inside theonRequestandonResponsehook payloads.tests/httpClient.test.ts: Updated observability hook tests to explicitly assert that sensitive headers are redacted while safe headers remain intact.docs/sdk-guide.md: Updated the documentation to reflect the availability of header metadata in hook payloads and added a warning against logging sensitive application data.Public API Changes