fix(backend): security hygiene — random_bytes secrets, drop abandoned doctrine/annotations - #567
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Security audit finding #8 (misc hygiene batch).
Changes
RegenerateSecretsCommand: secret generation usedrand()(not crypto-secure) in a 7-line loop →bin2hex(random_bytes(16)), same 32-char lowercase hex output format, so.envregeneration semantics are unchanged. Smoke-tested: replaces all{REGENERATE_SECRET}placeholders correctly.doctrine/annotations: abandoned per composer audit; nothing insrc//config/uses the annotation reader (all PHP attributes). Only the root package required it.composer auditis now fully clean — no advisories, no abandoned flags.Deliberately not changed
APP_ENV=devonly; correct as-is. Ops note: never run prod withAPP_ENV=dev.REGISTRATION_DISABLEDdefaults false): intentional product behavior; set the env var on public deployments.Verification
Full suite: 129 tests / 548 assertions OK; PHPStan clean;
composer auditclean; prod cache warmup ran duringcomposer removewithout errors.