-
-
Notifications
You must be signed in to change notification settings - Fork 176
Refactor and improve security headers, file blocks, etc #631
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
Refactor and improve security headers, file blocks, etc #631
Conversation
|
Thanks for the PR! I will review soon 👍 |
|
Great PR, running into this issue right now. However, I'd add some more common endpoints for web apps, at least |
d7aed51 to
00df1ca
Compare
@wapacro Thank you for your feedback. I've added your endpoints in this PR. |
|
@jaydrogers Any estimation when this can be reviewed and merged on your side? |
|
Could we also include support for |
…plementing best practices for HTTP headers and file access restrictions. Added protections against clickjacking, MIME type sniffing, and sensitive file exposure while allowing necessary access to well-known URIs as per RFC 8615.
|
@marns93 I appreciate your efforts on this. I had a chance to take a look at your PR. Instead of blocking everything from I also standardized these rules across all 3 web server variations. I am keeping an updated summary here: #631 (comment) |
7a1b6b9
into
serversideup:release/bugfixes-and-dependency-updates
|
Thanks for your contribution! I confirmed functionality in my local testing and this should be available in the next release |
I've doubled checked and can confirm the functionality. |
* Fix blocking .well-known path for FrankenPHP * Remove specific endpoint checks because the whole folder should be allowed * Enhance security configurations across Apache, NGINX, and Caddy by implementing best practices for HTTP headers and file access restrictions. Added protections against clickjacking, MIME type sniffing, and sensitive file exposure while allowing necessary access to well-known URIs as per RFC 8615. --------- Co-authored-by: Jay Rogers <3174134+jaydrogers@users.noreply.github.com> Co-authored-by: Jay Rogers <jaydrogers@users.noreply.serversideup.net>
…atabase connection checks (#628) * Refactor Laravel migration script to improve isolation handling and database connection checks - Removed migration isolation argument from test-db-connection script. - Introduced a helper function for running migrations per database, enhancing clarity and reusability. - Updated migration flag assembly logic to better manage isolation settings. - Improved error handling and logging for database connection issues. * Remove debug log from Laravel migration script to streamline output during migrations * Update Laravel migration script to change error message from error to warning for version check * Update PHP base opertating systems. Add Alpine 3.23 support (#638) PHP repo no longer has images available for alpine3.21 for latest minor versions, this removes 3.21 if its no longer available and adds 3.23 if available * Update PHP extension installer version to 2.9.27 * Update NGINX version to 1.28.1 * Refactor and improve security headers, file blocks, etc (#631) * Fix blocking .well-known path for FrankenPHP * Remove specific endpoint checks because the whole folder should be allowed * Enhance security configurations across Apache, NGINX, and Caddy by implementing best practices for HTTP headers and file access restrictions. Added protections against clickjacking, MIME type sniffing, and sensitive file exposure while allowing necessary access to well-known URIs as per RFC 8615. --------- Co-authored-by: Jay Rogers <3174134+jaydrogers@users.noreply.github.com> Co-authored-by: Jay Rogers <jaydrogers@users.noreply.serversideup.net> * Update GitHub Actions to use actions/checkout@v6 in multiple workflows * Update GitHub Actions to use actions/upload-artifact@v6 for improved artifact handling * Update GitHub Actions to use actions/download-artifact@v7 for improved artifact handling * Upgrade FrankenPHP to v1.11.1 * Increase size of GitHub Actions Runners because of memory segmentation fault issues (Thanks Depot! 😅) * Add security measures to block PHP execution in storage directory (#641) Implemented restrictions across Apache, NGINX, and FrankenPHP configurations to prevent the execution of PHP files in the /storage directory, addressing potential vulnerabilities related to arbitrary file uploads (GHSA-29cq-5w36-x7w3). * Refactor Laravel version check and isolation mode handling in automation script - Updated the logic for enabling isolation mode based on Laravel version, ensuring it only activates for versions 9.38.0 and above. - Improved error handling and logging for Laravel version detection, providing clearer output when version determination fails. - Simplified version comparison logic to enhance readability and maintainability. * Update container info script to include automation status --------- Co-authored-by: alloylab <trevor@alloylab.com> Co-authored-by: Marcel Arns <38068686+marns93@users.noreply.github.com>
Important
This PR was co-authored by @jaydrogers and had it's original comment modified to provide the latest summary. View the original post by @marns93 below if you'd like to see the content of the original submission
Testing this PR
You can test this PR by using any tag with this prefix:
docker.io/serversideup/php-dev:631-*View related images →
Summary
This PR standardizes and improves security configurations across nginx, Apache, and FrankenPHP/Caddy variations to ensure consistent behavior and proper documentation with references to authoritative sources.
Authoritative Sources Referenced
All configurations now cite their sources for transparency and credibility:
Security Headers (Consistent Across All Variations)
X-Frame-OptionsSAMEORIGINX-Content-Type-OptionsnosniffReferrer-Policystrict-origin-when-cross-originStrict-Transport-Securitymax-age=31536000; includeSubDomainsBlocked File Extensions
Based on H5BP server configs with a conservative approach to avoid breaking legitimate use cases:
.bak.conf.config.dist.inc.ini.log.sh.sql.swp/.swo~#*#*/.*✅ Explicitly Allowed
/.well-known/*- Required by RFC 8615 for ACME challenges other standardized endpoints❌ Intentionally NOT Blocked (too aggressive for general use)
.zip,.tar,.tgz- Legitimate downloads.yml,.json- Could be API responses.psd,.fla- Low security riskKey Changes from Previous Configuration
.well-knownexception - Properly allows RFC 8615 endpoints (fixes FrankenPHP returns 403 for commonly used hidden folders like .well-known/ #626).confblocking - More relevant for Linux/PHP environments than.configalone.fla,.psd,.orig,.inci,.swopremoved (not in official H5BP or too aggressive)Referrer-Policy- Changed tostrict-origin-when-cross-originacross all variationsTesting Checklist
/.well-known/paths are accessible (ACME, security.txt, etc.).zipdownloads (should work)Original post by @marns93