feat(backend): implement BE-136, BE-131, BE-130, BE-129 - #1108
Merged
mftee merged 2 commits intoJul 29, 2026
Conversation
- BE-136: request correlation IDs via async local storage, propagated to logs and BullMQ jobs, with log redaction - BE-131: secrets inventory and rotation runbook - BE-130: content-based upload validation, randomized storage keys, attachment downloads - BE-129: hardened CORS with explicit production origin and allowlist
Contributor
|
@Mkalbani is attempting to deploy a commit to the Mftee's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Mkalbani Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Closed
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #966
Closes #990
Closes #989
Closes #988
Summary
This PR implements the four backend hardening tickets together because they all touch request handling, logging, and configuration.
BE-136 — Add request correlation IDs to Winston logging
CorrelationIdMiddlewareto generate or honor inboundX-Request-Id, attach it to the request, and echo it back on responses.AsyncLocalStoragebasedcorrelationId.storage.tsso any log line can pick up the current request ID without threading it through every call.requestIdinto every JSON log line.DocumentProcessorworkers.requestIdinHttpExceptionFiltererror responses.authorization,cookie,password,token, and any*_token/*_secret/*_password/*_keyfields.BE-131 — Document secrets management and rotation procedure
backend/docs/SECRETS.md..env, platform secret manager, CI secrets).BE-130 — Validate uploaded document files by content
FileValidationPipewith max-size enforcement, MIME allowlist, and magic-byte sniffing.pdf-lib.sharp.GET /documents/:id/downloadserving withContent-Disposition: attachment, correctContent-Type, andX-Content-Type-Options: nosniff.BE-129 — Harden CORS configuration
FRONTEND_URL || localhostorigin with an exact-origin allowlist.FRONTEND_URLis missing.FRONTEND_URLvalues.Verification
cd backend && npx tsc --noEmitpasses.cd backend && npx jest --no-coveragepasses: 45 tests, 12 suites.Notes for reviewers
sharpwas added for image metadata stripping; a small local type declaration (backend/src/types/sharp.d.ts) is included because the installed sharp types resolve incorrectly under the project'smoduleResolution: nodesetting.file-typewas not added; magic-byte detection is implemented inline to keep dependencies minimal and avoid ESM/CJS interop issues.