RealDevSquad / RealDevSquad/website-backend

Update middleware to validate incoming request from Discord Service

Open
#2,409 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
74
Forks
276
Avg merge
1d 26m
Merged PRs (30d)
14

Description

Description:

The current middleware verifyDiscordBot requires an update to properly validate incoming requests from the Discord service. Right now, it partially handles this by checking the x-service-name header and verifying the token, but lacks complete validation logic specific to Discord's expected signature-based request validation (if applicable).

Proposed Changes:

  • Ensure the middleware performs complete validation of incoming requests from Discord, including:
  • Verifying the authorization header format.
  • Confirming x-service-name equals DISCORD_SERVICE.
  • If x-service-name is DISCORD_SERVICE, ensure botVerification.verifyDiscordService(token) returns a valid result and implements any additional checks Discord requires (e.g., signature verification).
  • Maintain compatibility with existing token-based validation from Cloudflare Worker (CLOUDFLARE_WORKER).
  • Improve error handling and response messages for clarity.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the verifyDiscordBot middleware and review how it handles the authorization header, x-service-name, and botVerification.verifyDiscordService(token). Compare the existing Discord and CLOUDFLARE_WORKER paths with the requested validation and error handling. Done means incoming Discord requests are fully validated while existing Cloudflare Worker token validation remains compatible.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, authentication, backend, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.