Skip to content

fix(redaction): split camelCase keys in normalizeKey - #994

Open
hazyhaar wants to merge 3 commits into
Gitlawb:mainfrom
hazyhaar:fix/redaction-camelcase-keys
Open

fix(redaction): split camelCase keys in normalizeKey#994
hazyhaar wants to merge 3 commits into
Gitlawb:mainfrom
hazyhaar:fix/redaction-camelcase-keys

Conversation

@hazyhaar

Copy link
Copy Markdown

Fixes #922

normalizeKey only inserted _ on non-alphanumeric runes, so accessToken became accesstoken and missed the access_token registry entry. OAuth tokens in camelCase JSON/maps leaked into logs, TUI, and CLI.

This treats a lowercase-to-uppercase boundary as a delimiter (accessTokenaccess_token). Token-count fields (promptTokens, maxTokens) stay unredacted because the trailing segment is the plural tokens.

doctor reported credential presence under credentialConfigured, which the same split now treats as sensitive. The indicator is renamed to authConfigured so set / not set is not replaced by [REDACTED].

The reflect.Pointer one-liner is independent govet on current main (deprecated reflect.Ptr). It can be dropped if maintainers prefer it on its own.

A lower-to-upper boundary now inserts an underscore, so accessToken
and refreshToken match the registry instead of leaking into logs.
Token-count fields such as promptTokens stay unredacted.

Fixes Gitlawb#922
camelCase normalization treats credentialConfigured as a credential
segment, so check() redacted the set/not-set indicator. authConfigured
does not match the registry.
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 12 minutes.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

This review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 27cab3e6-648c-4b5f-8740-9f42c13ecd60

📥 Commits

Reviewing files that changed from the base of the PR and between 1b5db17 and 5be6eae.

📒 Files selected for processing (5)
  • internal/config/unknownfields.go
  • internal/doctor/doctor.go
  • internal/doctor/doctor_test.go
  • internal/redaction/audit_fixes_test.go
  • internal/redaction/redaction.go

Comment @coderabbitai help to get the list of available commands.

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anandh8x anandh8x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the latest head. The camelCase normalization closes a real redaction gap for accessToken, refreshToken, and apiKey while preserving token-count fields. The Doctor metadata rename is necessary to keep its set/not set indicator visible. Focused race tests for redaction, Doctor, and config pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

security: token-leak bug in canonical redaction package (Z-050)

3 participants