Skip to content

fix: reject empty guild id in oauth authorization - #1694

Closed
karmugilan28 wants to merge 1 commit into
spacebarchat:masterfrom
karmugilan28:karmugilan-oauth-guildid-validation
Closed

karmugilan28 wants to merge 1 commit into
spacebarchat:masterfrom
karmugilan28:karmugilan-oauth-guildid-validation

Conversation

@karmugilan28

Copy link
Copy Markdown

What the issue was

The OAuth2 authorization endpoint accepted an empty string ("") for guild_id because the schema definition (ApplicationAuthorizeSchema) lacked a minimum length constraint.

What was changed

  • Added the @minLength 1 JSDoc validation rule to the guild_id property in src/schemas/uncategorised/ApplicationAuthorizeSchema.ts.
  • Regenerated the runtime JSON schemas using npm run generate:schema to apply the constraint to AJV.
  • Removed the stale // TODO: ensure guild_id is not an empty string comment from src/api/routes/oauth2/authorize.ts since the route wrapper middleware now intercepts and rejects empty strings automatically.

Addresses the specific TODO from #1600.

@TheArcaneBrony

Copy link
Copy Markdown
Member

Question: was this PR AI-generated or -assisted?

@karmugilan28

Copy link
Copy Markdown
Author

Sir this PR is not AI generated . This is done with the ai-assisted and not completely AI-based

@FoxofWinter

Copy link
Copy Markdown

Sir this PR is not AI generated . This is done with the ai-assisted and not completely AI-based

"Keep in mind that we do, under no circumstances, accept AI-generated, AI-assisted, or otherwise machine-generated contributions, for legal reasons." https://github.com/spacebarchat/server/blob/master/CONTRIBUTING.MD
Spacebar does not accept any AI-assisted contributions.

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.

3 participants