Skip to content

fix: use crypto/rand for the retry jitter - #35

Merged
samber merged 1 commit into
mainfrom
fix/lint-weak-prng-jitter
Oct 13, 2026
Merged

samber merged 1 commit into
mainfrom
fix/lint-weak-prng-jitter

Conversation

@samber

@samber samber commented Oct 13, 2026

Copy link
Copy Markdown
Owner

The Bearer scan in the Lint workflow fails on main since the retry jitter was added: math/rand triggers the weak PRNG rule (CWE-327) at dispatcher.go:153.

  • draw the jitter from crypto/rand instead of suppressing the finding
  • fall back to the plain backoff if no randomness is available

golangci-lint (0 issues) and bearer scan (no failures) pass locally.

The Bearer scan in CI flags math/rand (weak PRNG rule, CWE-327) and
fails the Lint workflow on main.

The jitter has no security role, but crypto/rand satisfies the rule
without suppressing it. If no randomness is available, the plain
backoff is used.
@samber
samber marked this pull request as ready for review October 13, 2026 16:14
@samber
samber merged commit 6b806ab into main Oct 13, 2026
13 checks passed
@samber
samber deleted the fix/lint-weak-prng-jitter branch October 13, 2026 16:14
@codecov

codecov Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.37%. Comparing base (50c86d3) to head (88f9a2b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
dispatcher.go 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #35      +/-   ##
==========================================
- Coverage   92.39%   91.37%   -1.02%     
==========================================
  Files           3        3              
  Lines         171      174       +3     
==========================================
+ Hits          158      159       +1     
- Misses          7        8       +1     
- Partials        6        7       +1     
Flag Coverage Δ
unittests 91.37% <50.00%> (-1.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant