Commit ee2ef32
committed
fix: validate SEARCH_PEPPER configuration before token generation
Added validation to ensure SEARCH_PEPPER is not empty before generating
tokens. This prevents a security vulnerability where tokens would be
generated without a pepper, making them vulnerable to rainbow table attacks.
Changes:
- Added empty pepper validation in Tokens::exact()
- Added empty pepper validation in Tokens::prefixes()
- Throw RuntimeException with helpful error message and setup instructions
- Updated PHPDoc to document the exception
The error message now guides developers to configure the pepper properly
with a suggested command: openssl rand -base64 321 parent 6975c73 commit ee2ef32
1 file changed
+18
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
52 | 61 | | |
53 | 62 | | |
54 | 63 | | |
| |||
71 | 80 | | |
72 | 81 | | |
73 | 82 | | |
| 83 | + | |
| 84 | + | |
74 | 85 | | |
75 | 86 | | |
76 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
77 | 95 | | |
78 | 96 | | |
79 | 97 | | |
| |||
0 commit comments