-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
New Feature / Enhancement Checklist
- Report security issues confidentially. This is not a security vulnerability report.
- Any contribution is under the project license.
- Before posting, I searched existing issues and found no duplicates.
Current Limitation
Parse Server does not automatically apply clickjacking protection headers on several routes such as /health, static file routes, or other Public API endpoints.
While the PagesRouter is capable of setting headers like X-Frame-Options and Content-Security-Policy: frame-ancestors,
there is no equivalent global protection applied within the broader ParseServer.app request pipeline.
This results in the following limitations:
- Endpoints like
/parse/healthcan be freely embedded inside external<iframe>elements. - Security behavior is inconsistent between PagesRouter and the rest of ParseServer.app.
- Developers have no unified way to manage or customize security headers across all responses.
Feature / Enhancement Description
A feature is needed to enable global clickjacking protection headers across the entire ParseServer.app layer.
Examples of relevant headers:
X-Frame-Options: DENY | SAMEORIGINContent-Security-Policy: frame-ancestors 'none' | 'self'
To support this, I propose introducing a global configuration that applies security headers consistently across all Parse Server routes.
One possible implementation approach:
security: {
secureHeaders: true, // Enable default clickjacking protection headers
customHeaders: { // Allow overrides as needed
"X-Frame-Options": "SAMEORIGIN",
"Content-Security-Policy": "frame-ancestors 'self'"
}
}Another viable approach is extending the existing pages options to expose similar functionality in a unified way:
pages: {
enableRouter: true,
secureHeaders: true,
customHeaders: {}
}I can implement this feature and submit a PR based on whichever design direction best aligns with the project’s architecture.
Desired outcome:
- Apply clickjacking protection headers globally within
ParseServer.app - Ensure consistent security behavior across PagesRouter and all other endpoints
- Allow developers to easily customize security headers per deployment needs
- Preserve full backward compatibility while improving default security
Example Use Case
- Install and configure Parse Server normally
- Load the
/parse/healthendpoint inside an external<iframe> - Currently, the iframe renders the endpoint without restriction
- When
secureHeadersis enabled:- All responses from ParseServer.app automatically include
X-Frame-OptionsandCSP frame-ancestors - External iframe embedding is blocked
- All responses from ParseServer.app automatically include
- Custom policies can be applied to allow only specific admin domains if needed
Alternatives / Workarounds
Before implementing this feature, Parse Server did not provide any built-in way to apply clickjacking-related security headers globally. Developers had to rely on one of the following workarounds, each with limitations:
- PagesRouter secure headers
- Only apply to PagesRouter responses
- Not applied to other endpoints such as
/health, file routes, or Public API routes
- Adding a custom Express middleware externally
- Possible, but breaks consistency with Parse Server’s configuration structure
- Security behavior becomes fragmented between Parse Server internals and user-defined middleware
With the proposed enhancement (global secureHeaders + customHeaders options), these limitations are removed.
Developers can now configure security headers directly through Parse Server’s built-in options without patching or overriding internal behavior.
3rd Party References
Many web frameworks provide global security header functionality by default:
- Express Helmet (
helmet.frameguard,helmet.contentSecurityPolicy) - Django: built-in
X-Frame-Optionsmiddleware - Rails:
config.action_dispatch.default_headers
To align with common security practice (e.g., OWASP Clickjacking Defense),
Parse Server would benefit from offering global clickjacking protection configuration.