Skip to content

fix(backend): security hygiene — random_bytes secrets, drop abandoned doctrine/annotations - #567

Merged
algirdasc merged 1 commit into
mainfrom
fix/security-hygiene
Aug 10, 2026
Merged

fix(backend): security hygiene — random_bytes secrets, drop abandoned doctrine/annotations#567
algirdasc merged 1 commit into
mainfrom
fix/security-hygiene

Conversation

@algirdasc

Copy link
Copy Markdown
Owner

Security audit finding #8 (misc hygiene batch).

Changes

  • RegenerateSecretsCommand: secret generation used rand() (not crypto-secure) in a 7-line loop → bin2hex(random_bytes(16)), same 32-char lowercase hex output format, so .env regeneration semantics are unchanged. Smoke-tested: replaces all {REGENERATE_SECRET} placeholders correctly.
  • Removed doctrine/annotations: abandoned per composer audit; nothing in src//config/ uses the annotation reader (all PHP attributes). Only the root package required it. composer audit is now fully clean — no advisories, no abandoned flags.

Deliberately not changed

  • CORS wildcard listener: already gated to APP_ENV=dev only; correct as-is. Ops note: never run prod with APP_ENV=dev.
  • Open registration default (REGISTRATION_DISABLED defaults false): intentional product behavior; set the env var on public deployments.

Verification

Full suite: 129 tests / 548 assertions OK; PHPStan clean; composer audit clean; prod cache warmup ran during composer remove without errors.

…doctrine/annotations

RegenerateSecretsCommand built APP_SECRET/JWT_PASSPHRASE from rand(),
which is not cryptographically secure; bin2hex(random_bytes(16)) is the
stdlib one-liner producing the same 32-char hex format.

doctrine/annotations is abandoned and unused (all mapping/config is via
PHP attributes); removing it clears the composer audit abandoned flag.
@algirdasc
algirdasc merged commit 8a694a6 into main Aug 10, 2026
4 checks passed
@algirdasc
algirdasc deleted the fix/security-hygiene branch August 10, 2026 19:16
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