Skip to content

Merge in v1.1 changes - #740

Merged
waldoj merged 122 commits into
masterfrom
modernize
Jul 14, 2026
Merged

waldoj merged 122 commits into
masterfrom
modernize

Conversation

@waldoj

@waldoj waldoj commented Jul 14, 2026

Copy link
Copy Markdown
Member
  • Modernized the entire codebase from PHP 5 to PHP 8, fixing hundreds of incompatibilities so that the software runs on currently supported versions of PHP and MySQL 8.
  • Added a Docker-based development environment, so that the whole stack—PHP 8/Apache, MySQL 8, and optional Memcached—can be built and run with a single command, without installing anything else.
  • Switched to Composer for PHP dependencies, replacing the bundled copy of Solarium with the maintained solarium/solarium package.
  • Switched to npm for front-end dependencies (jQuery, jQuery UI, qtip2, Mousetrap, and Font Awesome), which are now installed and localized rather than loaded from third-party CDNs. The SASS is compiled with Dart Sass.
  • Replaced the old test scripts with a PHPUnit 10 test suite, added sample import data and many new tests (imports, exports, editions, and API), and wired everything into a GitHub Actions CI/CD pipeline that also enforces static analysis with PHPStan.
  • Conducted a security audit, eliminating variable-hijacking extract() calls in the controllers, tightening JSONP callback validation to a strict allowlist, and correcting HTTP status codes.
  • Added a command-line export task, so that bulk downloads can be regenerated on demand instead of only as a side effect of importing a new edition of the code.
  • Improved the command-line importer to report its progress, support setting the current edition, and wrap its storage work in a database transaction.
  • Made XML export far more resilient—escaping quotation marks, ensuring valid element names, and catching export errors.
  • Fixed a wide range of display issues, including cross-reference formatting, hanging indents and copy affordances for subsection identifiers, tooltips, breadcrumbs, sidebar and font styling, and on-hover links. Added support for sorting Roman numerals and for laws that have no subsections.

Phew!

waldoj and others added 28 commits July 6, 2026 21:28
Histories were never being translated because we changed the property name at some point.
Somehow we shipped different CSS and Sass font sizes forever and ever. On this new deploy, building CSS from Sass, the result was that the fonts were way too small. This fixes that.
When ULs were present in sidebars, the right padding was 0, which looked bad, due to the gradient at the edge of the sidebar.
- 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]>
Fix variable hijacking, HTTP status code, and JSONP validation
Exports were being generated only when importing a new version of the code. That's probably fine in prod, but testing this, I need to be able to generate exports atomically, and I don't see any harm in having that available in prod.
It is confusing and also wrong to say we're "importing" when we are in fact exporting.
When they're invalid, this kills the entire import, so we check first.
A single error was killing the entire export process, but this will fix that.
They're making predictable trouble.
This shouldn't have been committed in the first place.
This was choking on quotation marks, and we've eliminated the quotation marks, but let's also make it so that it doesn't choke on input like that. Basically, stop treating HTML as well-formed XML.
A list of sections for a given structural unit will, if they're modestly long, wrap at a hyphen. This looks bad. Here we let the column width flex, up to a point, and then let them wrap.
@waldoj
waldoj merged commit c945a0a into master Jul 14, 2026
2 checks passed
@waldoj
waldoj deleted the modernize branch July 14, 2026 02:40
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