Skip to content

Miscellaneous hardening: key zeroing, port validation, struct JSON#78

Merged
telegrapher merged 3 commits into
refactor/pkce-method-splitfrom
fix/misc-hardening
Feb 27, 2026
Merged

Miscellaneous hardening: key zeroing, port validation, struct JSON#78
telegrapher merged 3 commits into
refactor/pkce-method-splitfrom
fix/misc-hardening

Conversation

@telegrapher

@telegrapher telegrapher commented Feb 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Zero private key bytes after use in JWT exchange to prevent key material lingering in memory
  • Add port validation to validateAuthorizeUserConfig, remove defaultPort fallback
  • Replace map[string]interface{} with anonymous struct in refresh for deterministic JSON field order
  • Trim trailing slash from IMS URL before building JWT claim keys
  • Standardize orgs API version error message to match profile style
  • Document PersistentPreRunE override risk in README.md

telegrapher and others added 2 commits February 27, 2026 17:13
…ON, URL slash

- Zero private key bytes after use in JWT exchange to prevent key material
  lingering in memory until GC (6.1.7)
- Add port validation to validateAuthorizeUserConfig, remove defaultPort
  fallback so the ims package validates its own parameters (N10)
- Replace map[string]interface{} with anonymous struct in refresh command
  for deterministic JSON field order and better performance (N11)
- Trim trailing slash from IMS URL before building JWT claim keys to
  prevent double-slash in metascope URIs (6.2.10)
- Standardize orgs API version error message to match profile style (6.2.12)
- Document PersistentPreRunE override risk in README.md (N7)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Expires field was set in jwt_exchange.go, exchange.go, and refresh.go
but never read by any caller. The calculations were also wrong:
duration * duration produces nanoseconds-squared (overflow), and
refresh.go used time.Second while the others used time.Millisecond.

Remove the field entirely rather than fixing dead code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove dead TokenInfo.Expires field and broken calculations
@telegrapher
telegrapher merged commit c1da83a into refactor/pkce-method-split Feb 27, 2026
3 checks passed
@telegrapher
telegrapher deleted the fix/misc-hardening branch February 28, 2026 13:56
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