Skip to content

fix(kiloclaw): remove biased access code random#3837

Merged
RSO merged 1 commit into
mainfrom
fix/kiloclaw-access-code-random
Jun 9, 2026
Merged

fix(kiloclaw): remove biased access code random#3837
RSO merged 1 commit into
mainfrom
fix/kiloclaw-access-code-random

Conversation

@kilo-code-bot

@kilo-code-bot kilo-code-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace modulo-based access-code character selection with crypto.randomInt so each allowed character is chosen without modulo bias.
  • Preserve the existing KiloClaw access code length, delimiter format, and unambiguous character alphabet.

Verification

N/A — no manual UI or end-to-end flow exercised for this server-side helper change.

Visual Changes

N/A

Reviewer Notes

Fixes CodeQL alert 234: js/biased-cryptographic-random in apps/web/src/lib/kiloclaw/access-codes.ts.

@kilo-code-bot
kilo-code-bot Bot requested a review from RSO June 9, 2026 09:32
@kilo-code-bot

kilo-code-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The single-file change correctly replaces modulo-biased randomBytes with crypto.randomInt, which uses rejection sampling to guarantee uniform distribution across the 32-character alphabet — the fix is accurate and minimal with no regressions introduced.

Files Reviewed (1 file)
  • apps/web/src/lib/kiloclaw/access-codes.ts

Reviewed by claude-sonnet-4.6 · 276,627 tokens

Review guidance: REVIEW.md from base branch main

@RSO
RSO merged commit 5e5e7bc into main Jun 9, 2026
16 checks passed
@RSO
RSO deleted the fix/kiloclaw-access-code-random branch June 9, 2026 12:11
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.

2 participants