Skip to content

fix(oauth2): redact sensitive auth material in debug request logs #8059

@coderabbitai

Description

@coderabbitai

Summary

The OAuth2 debug logging path (using the debug('oauth2') calls) logs the full requestConfig and data objects verbatim, which includes sensitive client authentication material:

The leak pre-existed this PR for the first two cases; PR #8051 added JWT assertions to the set of material flowing through the same path.

Proposed fix

Add a redaction helper that, before the debug log is built, creates sanitized shallow clones of requestConfig.headers and the form data object, replacing sensitive keys (Authorization, client_secret, client_assertion, client_assertion_type) with a [REDACTED] placeholder. The original objects must remain unchanged so the actual HTTP request continues to send real credentials.

Apply the helper in both:

  • packages/bruno-requests/src/auth/oauth2-helper.ts (around the debug('oauth2')('> request') call)
  • packages/bruno-electron/src/utils/oauth2.js (matching log site)

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions