Skip to content

perf(loki.secretfilter): Small improvements in redactLine#5994

Open
kleimkuhler wants to merge 3 commits intomainfrom
kleimkuhler/secretfilter-improvements
Open

perf(loki.secretfilter): Small improvements in redactLine#5994
kleimkuhler wants to merge 3 commits intomainfrom
kleimkuhler/secretfilter-improvements

Conversation

@kleimkuhler
Copy link
Copy Markdown
Member

@kleimkuhler kleimkuhler commented Apr 6, 2026

Brief description of Pull Request

Two small performance improvements to the loki.secretfilter hot path; sha1 -> sha256 for hashing secrets

Pull Request Details

  • Move origin label lookup out of the per-finding loop in redactLine
  • Replace hashing method with sha256 which is more suitable than sha1, and remove overhead of fmt.Sprintf

Issue(s) fixed by this Pull Request

Notes to the Reviewer

PR Checklist

@kleimkuhler kleimkuhler requested a review from a team as a code owner April 6, 2026 16:02
@kleimkuhler kleimkuhler requested review from mikefat and removed request for a team April 6, 2026 16:02
@kleimkuhler
Copy link
Copy Markdown
Member Author

This will likely conflict with #5970

@kleimkuhler kleimkuhler requested a review from kalleep April 6, 2026 16:12
We originally opted for SHA1 in large part for speed - the goal with hashing
the secret is not to keep it entirely secret, but to efficiently conceal it
from all but the most determined attackers.

After running benchmarks, sha256 is 2.09% slower, and we're looking for
every gain we can take right now.
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.

3 participants