Skip to content

Migrate from Random() to SecureRandom() #4284

@carloea2

Description

@carloea2

Feature Summary

Improve Auth secret generation by replacing the previous random hex string builder with a SecureRandom-based implementation that produces fixed-length 32-character hex strings in a more robust and portable way.

private def getRandomHexString: String = {
val bytes = 32
val r = new Random()
val sb = new StringBuffer
while (sb.length < bytes)
sb.append(Integer.toHexString(r.nextInt()))
sb.toString.substring(0, bytes)
}

Proposed Solution or Design

Update random hex string generation to use SecureRandom and fixed-width hexadecimal output.

Impact / Priority

(P2)Medium – useful enhancement

Affected Area

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    triagePending for triaging

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions