Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-enable gosec/G404 #1757

Merged
merged 4 commits into from
Feb 23, 2024
Merged

re-enable gosec/G404 #1757

merged 4 commits into from
Feb 23, 2024

Commits on Feb 23, 2024

  1. replace math/rand usage in requestid middleware

    replaces the generator using math/rand with rs/xid
    
    Benchmarked current vs google UUID vs rs/xid
    
    BenchmarkUUID-12     475.9 ns/op  64 B/op   2 allocs/op
    BenchmarkMathRand-12 397.4 ns/op  176 B/op  2 allocs/op
    BenchmarkXid-12    	 55.03 ns/op  24 B/op   1 allocs/op
    
    xid is not cryptographically secure, but guarantees
    16,777,216 unique values per second and per host/process.
    That number seems higher than we expect a single
    SpiceDB process to handle in terms of requests per second.
    vroldanbet committed Feb 23, 2024
    Configuration menu
    Copy the full SHA
    cfac458 View commit details
    Browse the repository at this point in the history
  2. disable revive unused-parameter

    after updating the golanci-lint action
    to the latest version, revive is flagging
    a lot of "unused-parameter" and is
    very annoying
    vroldanbet committed Feb 23, 2024
    Configuration menu
    Copy the full SHA
    b81dc08 View commit details
    Browse the repository at this point in the history
  3. enable gosec G404 and document when why it's ok to use math/rand

    all these uses to do not have security concerns, and
    math rand is used because contention of crypto/rand
    can hurt throughput/latency on the critical path.
    vroldanbet committed Feb 23, 2024
    Configuration menu
    Copy the full SHA
    d7c958d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    2bc5d90 View commit details
    Browse the repository at this point in the history