Skip to content

fix: sanitize error messages to prevent info exposure#84

Closed
Sarthak-Bhagat2006 wants to merge 3 commits intoCPAtoCybersecurity:mainfrom
Sarthak-Bhagat2006:main
Closed

fix: sanitize error messages to prevent info exposure#84
Sarthak-Bhagat2006 wants to merge 3 commits intoCPAtoCybersecurity:mainfrom
Sarthak-Bhagat2006:main

Conversation

@Sarthak-Bhagat2006
Copy link
Copy Markdown
Contributor

Fixes #74

Summary

Sanitised frontend error messages to prevent exposure of internal exception details.

Changes Made

  • Replaced detailed error messages with generic user-safe messages
  • Removed direct exposure of exception messages in toast notifications
  • Ensured internal errors are logged only in console (for debugging)

Security Impact

Addresses CWE-209 (Information Exposure Through Error Messages)
Prevents exposure of internal backend and stack trace details.

@Sarthak-Bhagat2006
Copy link
Copy Markdown
Contributor Author

Hi @CPAtoCybersecurity
Please let me know if anything else is needed. Thanks!

@CPAtoCybersecurity
Copy link
Copy Markdown
Owner

CPAtoCybersecurity commented Feb 25, 2026

Hey @Sarthak-Bhagat2006 - solid work on this security fix. You caught a lot of spots across the codebase.

One thing to clean up please before I merge:

In src/pages/Settings.js (lines ~773, 783, 793, 803), looks like some placeholder text got left in:

console.error('Descriptive context message:', err);
toast.error('Generic user-friendly message.');

Just swap those out for real messages, something like:

console.error('Assessment export error:', err);
toast.error('Export failed. Please try again.');

Update that and I'll merge it. Appreciate the contribution!

Copy link
Copy Markdown

@steve-simplycyber steve-simplycyber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff. Generic messages for users, detailed logs in console for debugging.

@CPAtoCybersecurity
Copy link
Copy Markdown
Owner

Closing this PR to resolve a merge issue. Please open a new PR from your fork - your commits are already there, just click 'New pull request' from your fork. Thanks!

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.

HIGH: Error messages expose internal details

3 participants