Skip to content

Fix variable hijacking, HTTP status code, and JSONP validation - #738

Merged
waldoj merged 1 commit into
modernizefrom
waldoj-security-audit
Jul 9, 2026
Merged

waldoj merged 1 commit into
modernizefrom
waldoj-security-audit

Conversation

@waldoj

@waldoj waldoj commented Jul 9, 2026

Copy link
Copy Markdown
Member
  • Replace dangerous extract() calls with explicit variable assignment

    • class.BaseController.inc.php: Explicit loop instead of extract() in render()
    • class.LawController.inc.php: Explicit loop instead of extract() in handle()
    • class.StructureController.inc.php: Explicit loop instead of extract() in handle()
    • class.MasterController.inc.php: Explicit loop instead of extract() in execute()
  • Fix incorrect HTTP status code

    • functions.inc.php: Change 'HTTP/1.0 400 OK' to 'HTTP/1.0 400 Bad Request'
  • Improve JSONP callback validation

    • functions.inc.php: Replace regex-based validation with explicit allowlist approach
    • Add reserved words and built-in globals
    • Enforce 255 character limit
    • Validate with proper JavaScript identifier rules

These changes prevent:

  • Variable hijacking through extract()
  • XSS via JSONP callback bypass
  • HTTP header confusion attacks

- Replace dangerous extract() calls with explicit variable assignment
  * class.BaseController.inc.php: Explicit loop instead of extract() in render()
  * class.LawController.inc.php: Explicit loop instead of extract() in handle()
  * class.StructureController.inc.php: Explicit loop instead of extract() in handle()
  * class.MasterController.inc.php: Explicit loop instead of extract() in execute()

- Fix incorrect HTTP status code
  * functions.inc.php: Change 'HTTP/1.0 400 OK' to 'HTTP/1.0 400 Bad Request'

- Improve JSONP callback validation
  * functions.inc.php: Replace regex-based validation with explicit allowlist approach
  * Add reserved words and built-in globals
  * Enforce 255 character limit
  * Validate with proper JavaScript identifier rules

These changes prevent:
- Variable hijacking through extract()
- XSS via JSONP callback bypass
- HTTP header confusion attacks

Co-authored-by: Copilot App <[email protected]>
@waldoj
waldoj merged commit 4f5cc61 into modernize Jul 9, 2026
1 check passed
@waldoj
waldoj deleted the waldoj-security-audit branch July 9, 2026 02:30
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.

1 participant