Skip to content

Remove x-user-email from audit logs; add test#858

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
martinshub-tech:remove-email-audit
Jun 29, 2026
Merged

Remove x-user-email from audit logs; add test#858
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
martinshub-tech:remove-email-audit

Conversation

@martinshub-tech

Copy link
Copy Markdown
Contributor

this pr closes #729

Description
This PR addresses a privacy compliance issue by eliminating the logging of raw email addresses in the audit system.

Changes Made
Audit Middleware (src/middleware/audit.ts)

Removed the fallback that reads x-user-email from request headers.
Actor identification now relies solely on x-admin-user or x-user-id, falling back to 'anonymous'.
Updated comments to reflect the new behavior.
Tests (tests/audit.test.ts)

Added a unit test that:
Sends a request with x-user-id.
Calls logAuditMutation.
Asserts that the actorId in the generated audit entry does not contain an “@” character and exactly matches the provided user ID.

@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@martinshub-tech 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

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project.

@RUKAYAT-CODER RUKAYAT-CODER merged commit 456ac4f into rinafcode:main Jun 29, 2026
5 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.

[Security] Audit middleware logs x-user-email header directly — leaks PII into audit records

2 participants