Skip to content

sec(auth): implement byte-level secret handling and memory scrubbing - #24

Merged
grobf5 merged 2 commits into
mainfrom
feat/security-memory-scrubbing
Oct 8, 2026
Merged

grobf5 merged 2 commits into
mainfrom
feat/security-memory-scrubbing

Conversation

@grobf5

@grobf5 grobf5 commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements comprehensive zero-secret memory scrubbing and byte-level secret isolation across API credentials, OAuth tokens, appliance basic auth (iControl REST and SSH/SCP), and HTTP CONNECT proxy tunnels.

Changes

  • pkg/auth:
    • Added SecretBytes []byte and APIKeyBytes []byte to Credentials with deferred memory scrubbing in file readers.
    • Implemented Credentials.Zero() using auth.ZeroBytes with runtime.KeepAlive.
    • Added AuthenticateWithSecretBytes to format Basic Auth credentials in mutable byte slices and immediately zero them post-base64 encoding.
  • pkg/bigip:
    • Added PasswordBytes []byte and PassphraseBytes []byte across Client, SCPOptions, GeoIPOptions, and TransferOptions.
    • Implemented .Zero() across all option structs and bigip.Client.
    • Scrubbed Basic Auth byte slices immediately after header construction in setAuth.
    • Scrubbed SSH passphrase byte slices immediately after key decryption in BuildSSHClientConfig.
    • Added deferred .Zero() cleanup to failover methods.
  • pkg/downloads, pkg/cases, pkg/ihealth:
    • Implemented Client.Zero() to scrub cached OAuth tokens and API usage keys from heap.
  • pkg/client:
    • Enhanced zeroBytes in proxy.go and tls.go with runtime.KeepAlive to guarantee anti-dead-store elimination.
    • Scrubbed Proxy-Authorization basic auth buffers in HTTP CONNECT tunnels.
  • cmd/myf5:
    • Deferred .Zero() across all command flows (downloads, cases, ihealth, doctor, bigip ready/push/download/qkview/geoip/info).

Verification

  • make all (fmt, vet, test -race, build) passes cleanly.
  • go test -v -race -count=1 ./... all pass.
  • OAS tests go test -v -race ./internal_docs/oas/... all pass.

grobf5 added 2 commits October 7, 2026 13:10
- Add SecretBytes and APIKeyBytes to Credentials with deferred zeroing
- Implement AuthenticateWithSecretBytes for mutable OAuth basic auth
- Add PasswordBytes, PassphraseBytes, and .Zero() to bigip.Client, SCPOptions, GeoIPOptions, and TransferOptions
- Implement .Zero() across downloads, cases, and ihealth clients
- Harden proxy CONNECT tunnel auth buffer scrubbing with runtime.KeepAlive
- Wire secret scrubbing across all command entry points in cmd/myf5/main.go
@grobf5
grobf5 merged commit 2bfe376 into main Oct 8, 2026
12 checks passed
@grobf5
grobf5 deleted the feat/security-memory-scrubbing branch October 8, 2026 21:40
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.

1 participant