Production hardening audit: dead code removal, PHP defensive fixes, nginx regex anchor#34
Draft
Copilot wants to merge 3 commits into
Draft
Production hardening audit: dead code removal, PHP defensive fixes, nginx regex anchor#34Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
- .gitignore: add Python bytecode patterns (__pycache__/, *.pyc, *.pyo, *.pyd) - git rm tracked build artifact scripts/__pycache__/spx-update-cloudflare.cpython-312.pyc - spx-upload-mimes.php: replace isset() with array_key_exists() (×2); initialize $detected = false before try/finally to prevent undefined-variable on unexpected exception - nginx/maps/spx-high-risk-geo.map: remove orphaned dead file (not included in any nginx conf, not copied by CI *.conf glob, misleading deployment comment) - nginx/conf.d/spx-cloudflare-trust.conf: correct stale script name in auto-generated header (update_cloudflare.py → spx-update-cloudflare.py)
…match location ~* ^/wp-json/wp/v2/media was unanchored and matched /wp-json/wp/v2/media-settings, /wp-json/wp/v2/media<anything> etc., applying the 100 m body limit and relaxed method policy to unintended endpoints. Anchor to collection + numeric-ID paths only.
Copilot
AI
changed the title
Production-readiness hardening audit
Production hardening audit: dead code removal, PHP defensive fixes, nginx regex anchor
Jun 19, 2026
Copilot created this pull request from a session on behalf of
MaximillianGroup
June 19, 2026 22:18
View session
MaximillianGroup
approved these changes
Jun 19, 2026
Contributor
|
@copilot resolve the merge conflicts in this pull request |
…tibility-check # Conflicts: # nginx/snippets/spx-upload-limits.conf
Contributor
Author
Done. The only conflict was in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Six targeted production-readiness fixes across the stack. No behavior changes to intended functionality.
Security
nginx/snippets/spx-upload-limits.conf— overbroad WP REST media locationUnanchored regex applied the 100 m body limit and
GET HEAD POST OPTIONSmethod policy to unintended REST endpoints.PHP (
spx-upload-mimes.php)isset()→array_key_exists()on both constant-array key guards (project standard;issetreturns false for null-valued keys)$detected = falsebeforetry/finally— variable was undefined iffinfo_file()threw before assignmentDead code removed
nginx/maps/spx-high-risk-geo.map— not referenced by any nginx config, not deployed by CI (*.confglob excludes.map), 2-country content out of sync with the 20+ country list hardcoded inspx-bot-mitigation-logic.conf; deployment comment was actively misleadingscripts/__pycache__/spx-update-cloudflare.cpython-312.pyc— committed build artifactHousekeeping
.gitignore: add__pycache__/,*.pyc,*.pyo,*.pydnginx/conf.d/spx-cloudflare-trust.conf: correct stale script name in auto-generated header (update_cloudflare.py→spx-update-cloudflare.py)