Skip to content

Improve validate command + docs - #4

Merged
aswasif007 merged 5 commits into
trunkfrom
fix/validate-qa-hardening
Jul 30, 2026
Merged

Improve validate command + docs#4
aswasif007 merged 5 commits into
trunkfrom
fix/validate-qa-hardening

Conversation

@aswasif007

@aswasif007 aswasif007 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

What

In this PR we are improving the validate command.

  • Reject YAML alias bombs in manifest validation (billion-laughs DoS)
    inspectManifest() now loads with maxAliases: 0, rejecting anchors/aliases at parse time
  • Recognize PHP matrix list syntax in Rule 7
    Rule 7 only counted a PHP version when it sat immediately after the php: key, so a CI matrix written as a YAML flow array (php: [8.2, 8.3, 8.4, 8.5]) or block sequence was missing.
  • Error on an explicitly empty validate path
    validate "" (or an unset shell variable) silently validated the current directory. It now errors with exit 1; an omitted argument still defaults to cwd.

An empty path argument (`validate ""`, or an unset shell variable)
silently validated the current directory. Treat it as the mistake it
is and reject it; an omitted argument still defaults to cwd.
A 344-byte manifest of nested YAML aliases hung `validate` for tens of
seconds (unbounded past 10 levels). js-yaml returns aliases as shared
references cheaply, but the downstream placeholder scan and Ajv walk
expand them into an exponential tree. Setting maxAliases to 0 rejects
anchors/aliases at parse time; a manifest never needs them.
Rule 7 only matched a PHP version when it sat immediately after the
`php:` key, so a matrix written as a YAML flow array (`php: [8.2, 8.3]`)
or block sequence — the most common GitHub Actions forms — was reported
as missing, falsely failing a conformant integration. Parse the value
region after each php/php-version key across all three list styles.
@aswasif007 aswasif007 changed the title Fix/validate qa hardening Harden validate against QA findings (DoS, Rule 7, empty path) Jul 30, 2026
@aswasif007 aswasif007 changed the title Harden validate against QA findings (DoS, Rule 7, empty path) Improve validation Jul 30, 2026
@aswasif007
aswasif007 marked this pull request as ready for review July 30, 2026 06:43
@aswasif007 aswasif007 changed the title Improve validation Improve validate command Jul 30, 2026
Rule 7 had two holes. The WordPress check was a bare full-text scan, so
a `node: [6.9, 7.0]` matrix with no WP key passed as WP coverage — a
false pass on the gate's core job. The PHP key regex was singular-only,
so the common `php-versions:` (plural) matrix key false-failed a
conformant integration.

Generalize the key-scoped collector to both checks: scope WordPress to a
wp/wordpress key like PHP, and accept php-versions/wp-versions plural.
The collector also bounds a flow-mapping value at the next entry and
strips inline comments, so a same-line neighbor key or a trailing
comment no longer leaks versions into the scan.
The config cross-check warns, not fails, and is a best-effort heuristic
read of the PHP source — not deterministic. The doc implied a mismatch
blocks conformance, which would mislead a partner. Also correct the
colors helper line count.
@aswasif007 aswasif007 changed the title Improve validate command Improve validate command + docs Jul 30, 2026
@aswasif007
aswasif007 requested a review from pandah3 July 30, 2026 06:55
@aswasif007
aswasif007 merged commit ed12ee4 into trunk Jul 30, 2026
3 checks 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