mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-19 08:01:17 +00:00
fix(security): restrict OAuth auth code regex to alphanumeric only (#2116)
Removes underscore and hyphen from the OAuth authorization code validation regex, restricting it to alphanumeric characters only. Defense in depth: if the code is ever used in logging or other contexts, special characters won't create injection opportunities. Fixes #2114 Agent: security-auditor Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
7cc21e4111
commit
2a23ebcaf2
2 changed files with 2 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@openrouter/spawn",
|
||||
"version": "0.12.3",
|
||||
"version": "0.12.4",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
"spawn": "cli.js"
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ async function tryOauthFlow(callbackPort = 5180, agentSlug?: string, cloudSlug?:
|
|||
});
|
||||
}
|
||||
// Validate code format
|
||||
if (!/^[a-zA-Z0-9_-]{16,128}$/.test(code)) {
|
||||
if (!/^[a-zA-Z0-9]{16,128}$/.test(code)) {
|
||||
return new Response("<html><body><h1>Invalid OAuth Code</h1></body></html>", {
|
||||
status: 400,
|
||||
headers: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue