Skip to content

Return OK for newer PHP patch versions and verify HTTP header handling - #2

Merged
ianw-oai merged 1 commit into
mainfrom
fix/php-header-status
Oct 21, 2026
Merged

ianw-oai merged 1 commit into
mainfrom
fix/php-header-status

Conversation

@ianw-oai

Copy link
Copy Markdown
Collaborator

The checker currently only returns vulnerable or unknown, so even a simulated newer patched PHP version can never return OK.

This adds ok / exit code 0 for stable patch versions above the existing cutoff in a listed major/minor branch. Missing headers, no response, unknown branches, and newer prereleases remain unknown / exit code 3. Conflicting banners cannot hide a vulnerable or unrecognized version behind an OK result.

Added dependency-free CLI integration tests using local HTTP servers. They verify X-Powered-By, case-insensitive header names, Apache-style Server headers, numeric patch comparisons, every configured version boundary, 405/501 GET fallback, absent headers, closed connections, timeouts, and JSON/plain-text output.

Validation: node --test --test-reporter=spec phpcheck.test.js — 30/30 tests pass on Node v24.19.0. The same suite against the original code had 12 failures. PHP itself is not installed in the test environment; HTTP fixtures use PHP's documented header format: https://www.php.net/manual/en/ini.core.php#ini.expose-php.

The version cutoffs are unchanged. OK follows the requested assumption that a newer stable patch in a listed branch contains the fix. PHP's October 20 announcement says affected/fixed versions will be published with the upcoming release, so these cutoffs still need confirmation against that release: https://www.php.net/index.php. The README now makes this limitation explicit.

@ianw-oai
ianw-oai marked this pull request as ready for review October 21, 2026 01:09
@ianw-oai
ianw-oai merged commit f5b56c8 into main Oct 21, 2026
1 check passed
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