flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[Backend] Sanitize incoming X-Request-ID header in requestId.ts to prevent log injection

Open blurbeast opened this issue 1 month ago • 9 comments

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-ID containing newlines, control characters, or a multi-kilobyte string, it can pollute logs or bloat response headers.

Proposed Changes

  1. Validate incoming X-Request-ID in backend/src/middleware/requestId.ts against a safe pattern (/^[a-zA-Z0-9._-]{1,64}$/).
  2. If the incoming header is missing or fails validation, generate a fresh crypto.randomUUID() instead.

Acceptance Criteria

  • [ ] Valid alphanumeric/UUID X-Request-ID headers are preserved.
  • [ ] Oversized or malformed X-Request-ID headers are ignored and replaced with a fresh UUID.
  • [ ] Unit test added in backend/tests/.

blurbeast avatar Oct 18 '26 05:10 blurbeast

@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.

Walewavy avatar Oct 18 '26 06:10 Walewavy

@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.

SahheedTech avatar Oct 18 '26 06:10 SahheedTech

@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.

aduagba4133 avatar Oct 18 '26 06:10 aduagba4133

@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.

Audukuma avatar Oct 18 '26 06:10 Audukuma

@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.

GreyDayo avatar Oct 18 '26 06:10 GreyDayo

@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.

sladeoj avatar Oct 18 '26 06:10 sladeoj

@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.

Sammydz456 avatar Oct 18 '26 06:10 Sammydz456

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 🌊

drips-wave[bot] avatar Oct 18 '26 06:10 drips-wave[bot]

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.

drips-wave[bot] avatar Oct 18 '26 07:10 drips-wave[bot]