This repository was archived by the owner on May 29, 2026. It is now read-only.
Commit ab3f7f2
committed
fix(security): UserService::createApiToken — reject invalid expiresIn
`parseExpiration()` returns `null` for any string that doesn't match
the `^(\d+)([dhm])$` regex (e.g. "5x", "abc", "90 days"). The caller
wrote that null straight into the persisted token row, where a null
`expires` means a *non-expiring* token. Net effect: a typo in the
expiration mints a permanent API key instead of producing an error.
Throw `\InvalidArgumentException` from the controller surface when the
input is supplied but unparseable. Existing "no expiration provided"
path (`$expiresIn === null` or empty) still produces a non-expiring
token — that's an explicit operator choice, not a malformed-input
side effect.
Refs: #1419 review (off-diff blocker — top-level comment 4378205122)1 parent 17facc5 commit ab3f7f2
1 file changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1231 | 1231 | | |
1232 | 1232 | | |
1233 | 1233 | | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
1234 | 1238 | | |
1235 | 1239 | | |
1236 | 1240 | | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
1237 | 1246 | | |
1238 | 1247 | | |
1239 | 1248 | | |
| |||
0 commit comments