Skip to content

feat: Add structured request/response logging with redaction (#590) - #639

Merged
Abdulazeem-code merged 3 commits into
Abdulazeem-code:mainfrom
Peolite1:fix-590-logging-redaction
Sep 3, 2026
Merged

feat: Add structured request/response logging with redaction (#590)#639
Abdulazeem-code merged 3 commits into
Abdulazeem-code:mainfrom
Peolite1:fix-590-logging-redaction

Conversation

@Peolite1

Copy link
Copy Markdown
Contributor

Pull Request Writeup: Structured Request/Response Logging with Redaction

Closes #590

Description

This PR addresses issue #590 by introducing structured, machine-parseable JSON logging across the application using pino-http, and ensures that sensitive secrets are safely redacted before logs are ever emitted.

Previously, logging relied on ad-hoc logger.error() calls which could inadvertently leak sensitive fields (like signatures and API keys) into log aggregators in plain text.

Changes Included

  • Structured HTTP Logging: Integrated pino-http into the Express middleware stack (server.js) with autoLogging: true, ensuring that every single incoming HTTP request is automatically tracked.
  • Custom Redaction Serializer: Built a recursive custom serializer in src/logger.js that deeply inspects request headers and payloads. It intercepts and redacts the following sensitive fields to [REDACTED]:
    • signature
    • secret
    • x-api-key
    • authorization
  • Enhanced Log Context: Logs now consistently include the request method, path (url), response status code, and the total request duration (via pino-http's native responseTime).

Impact

This change significantly improves observability for production log analysis and debugging, while enforcing strict security boundaries to prevent accidental exposure of sensitive keys and tokens in external log aggregators.

@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

@Peolite1 is attempting to deploy a commit to the Abdulazeem's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@Peolite1 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! 🚀

Learn more about application limits

@Abdulazeem-code

Copy link
Copy Markdown
Owner

FIX FAILED CHECKS

@Peolite1

Peolite1 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

FIX FAILED CHECKS

done

@Abdulazeem-code

Copy link
Copy Markdown
Owner

FIX FAILED CHECKS

@Abdulazeem-code
Abdulazeem-code merged commit bf83707 into Abdulazeem-code:main Sep 3, 2026
10 of 11 checks passed
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.

Add structured request/response logging with redaction

2 participants