Skip to content

Internal hygiene: make identityEncoding a fixed-size array to remove mutable package-level state #79

Description

@the-sarge

Context

Surfaced by reviewer agy in the PR #78 RAS review (run 20260611T202510-1a7eb9b7ffe39194a54be7f5, cluster C-003) and adjudicated out of scope for that PR: the declaration predates PR #78 (unchanged diff context), every current use is read-only (hmac.Equal/bytes.Equal/fuzz seeds), and PR #78 actually reduced exposure by deleting the clone(identityEncoding) failure-return convention. Filed as the suggested follow-up hygiene item per maintainer direction.

Current state

crypto.go:23:

var identityEncoding = make([]byte, pointSize)

A mutable package-level slice holding the canonical identity encoding. An accidental in-package write (or test contamination) would corrupt every identity comparison. No such write exists today.

Proposed change

var identityEncoding [pointSize]byte

with identityEncoding[:] at comparison/clone sites. Internal-only; no API, protocol, or behavior change. Note a package-level array still does not prevent in-package mutation — this is hygiene that shrinks the accident surface, not a security boundary.

Scheduling constraint

Optional, maintainer's call. If done at all, batch it with other internal churn before the consolidated post-implementation evidence refresh (Phase 3), so the refreshed evidence covers it and no extra refresh is triggered.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/hardeningDefense-in-depth hardening, no API/protocol change

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions