Skip to content

CSRF token is generated using math/random not crypto/random #2489

@robvdl

Description

@robvdl

Issue Description

Can someone please explain why labstack/gommon/random is using math/random over crypto/random. This is what is used to generate the CSRF tokens.

All it does is reset the random seed in the New function, but I'm a bit concerned it's not using crypto/random.

That means we can get predictable CSRF tokens, not good.

Checklist

  • Dependencies installed
  • No typos
  • Searched existing issues and docs

Expected behaviour

Actual behaviour

Steps to reproduce

Working code to debug

package main func main() { }

Version/commit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions