Deduplicate delegation token generation with util.RandomHex - #12654
Conversation
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The focused refactor preserves existing behavior and introduces no unresolved issues.
Pull request overview
Deduplicates delegation token generation by reusing the shared cryptographic utility while preserving token format and length.
Changes:
- Replaced manual random-byte generation and hex encoding with
util.RandomHex. - Removed unused standard-library imports.
File summaries
| File | Description |
|---|---|
internal/delegation/store.go |
Uses the shared random hexadecimal token helper. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
🔒 mcpg Read-Only Stress — gvisorSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
|
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE No write leaked through any surface. Part B is INCONCLUSIVE because all targeted write tools were absent from the exposed catalog entirely (gh-aw's
|
🔒 mcpg Read-Only Stress — docker-sbxSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
|
internal/delegation/store.goreimplemented crypto-random hex-token generation via manualcrypto/rand.Read+hex.EncodeToString, duplicating logic already provided byinternal/util.RandomHex.Changes
generateOpaqueToken's manual random-byte generation and hex encoding with a call toutil.RandomHexcrypto/randandencoding/heximports fromstore.goToken format and length are unchanged; this only consolidates the entropy source and error-wrapping behind a single shared helper.