Skip to content

Implement URL redaction#52

Merged
ladd merged 3 commits intomainfrom
lvt-url-redaction
Dec 15, 2025
Merged

Implement URL redaction#52
ladd merged 3 commits intomainfrom
lvt-url-redaction

Conversation

@ladd
Copy link

@ladd ladd commented Dec 15, 2025

  • Implement URL redaction. By default strip out username, password, and x-amz-* parameters. Can be customized with closure.
  • Combine duplicate implementations of request attributes.
  • Tests.

@bachand
@jparise

Fix comment

Prefix
addAttribute("server.port", url.port)
addAttribute("url.scheme", url.scheme)

let urlRedaction = urlRedaction ?? defaultUrlRedaction
Copy link

Choose a reason for hiding this comment

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

I wonder if this is the default behavior we want. It means that there isn't a way to skip redaction without passing in a non-redacting closure.

I'd lean toward not providing a default implementation and doing that in user code. We could provide a reference implementation as an example or as a public function that the caller could explicitly pass.


// MARK: Internal

static let redacted = "REDACTED"
Copy link

Choose a reason for hiding this comment

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

Could be useful for this to be public.

@ladd ladd merged commit 3147746 into main Dec 15, 2025
10 of 12 checks passed
@ladd ladd deleted the lvt-url-redaction branch December 15, 2025 22:57
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.

2 participants