Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pensar - auto fix for Sensitive Configuration Data Exposure via Unfiltered JSON Rendering #24

Open
wants to merge 1 commit into
base: canary
Choose a base branch
from

Conversation

pensarapp[bot]
Copy link

@pensarapp pensarapp bot commented Apr 1, 2025

Secured with Pensar

Fixed a security vulnerability (CWE-200: Exposure of Sensitive Information) where sensitive configuration data was being directly exposed to the client through JSON.stringify(siteConfig).

The fix implements:

  1. A new sanitizeSiteConfig function that creates a deep copy of the configuration and recursively searches for potentially sensitive fields using comprehensive regex patterns
  2. When sensitive fields are detected (passwords, API keys, tokens, etc.), their values are replaced with "[REDACTED]"
  3. The display was improved by:
    • Replacing the raw JSON.stringify with a formatted, pretty-printed version
    • Adding a container with styling for better readability
    • Including a note that sensitive values have been redacted
    • Using conditional rendering to only display the config when it exists

This approach maintains the functionality of showing configuration data to administrators while preventing the exposure of sensitive information that could be used in security attacks.

More Details
Type Identifier Message Severity Link
Application CWE-200 The code directly stringifies and renders the site configuration using JSON.stringify without any explicit filtering or sanitization. If the siteConfig object includes sensitive information (for example, database credentials, API keys, or other configuration data that should remain private), this could lead to exposure of sensitive data to unauthorized parties. The risk is moderate because it depends on the content of siteConfig and the context in which it is rendered. medium Link

Copy link

vercel bot commented Apr 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
simpl-cms-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 1, 2025 7:31am

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.

0 participants