[Backend] Sanitize incoming X-Request-ID header in requestId.ts to prevent log injection
Overview
backend/src/middleware/requestId.ts accepts a client-supplied X-Request-ID header if present and echoes it in response headers and structured logs.
Problem
- If a client sends an
X-Request-IDcontaining newlines, control characters, or a multi-kilobyte string, it can pollute logs or bloat response headers.
Proposed Changes
- Validate incoming
X-Request-IDinbackend/src/middleware/requestId.tsagainst a safe pattern (/^[a-zA-Z0-9._-]{1,64}$/). - If the incoming header is missing or fails validation, generate a fresh
crypto.randomUUID()instead.
Acceptance Criteria
- [ ] Valid alphanumeric/UUID
X-Request-IDheaders are preserved. - [ ] Oversized or malformed
X-Request-IDheaders are ignored and replaced with a fresh UUID. - [ ] Unit test added in
backend/tests/.
@Walewavy has applied to work on this issue as part of the Stellar Wave Program's 10th wave.
I can work on this, please assign.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Walewavy to this issue.
@SahheedTech has applied to work on this issue as part of the Stellar Wave Program's 10th wave.
Hello maintainer, please I would love to work on this issue
ℹ️ Repo Maintainers: To accept this application, review their application or assign @SahheedTech to this issue.
@aduagba4133 has applied to work on this issue as part of the Stellar Wave Program's 10th wave.
Kindly assign it to me.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @aduagba4133 to this issue.
@Audukuma has applied to work on this issue as part of the Stellar Wave Program's 10th wave.
Hello maintainer, Please I would love to work on this issue
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Audukuma to this issue.
@GreyDayo has applied to work on this issue as part of the Stellar Wave Program's 10th wave.
I would like to wok on this issue. please assign
ℹ️ Repo Maintainers: To accept this application, review their application or assign @GreyDayo to this issue.
@sladeoj has applied to work on this issue as part of the Stellar Wave Program's 10th wave.
hii maintainer i would love to work on this issue please
ℹ️ Repo Maintainers: To accept this application, review their application or assign @sladeoj to this issue.
@Sammydz456 has applied to work on this issue as part of the Stellar Wave Program's 10th wave.
hii maintainer i would love to work on this issue please
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Sammydz456 to this issue.
Congratulations, @GreyDayo! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.
🧑💻 @GreyDayo: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.
[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.
🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.
🌊 Happy Wave 🌊
This issue has been completed by @GreyDayo as part of the Stellar Wave Program's 10th Wave 🥳
😎 @GreyDayo: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.
🧑💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.