Skip to content

chore: storage-value hardening (XSS review) + governance sync - #19

Merged
jpettitt merged 3 commits into
mainfrom
chore/hardening-gov-sync
Aug 10, 2026
Merged

jpettitt merged 3 commits into
mainfrom
chore/hardening-gov-sync

Conversation

@jpettitt

Copy link
Copy Markdown
Owner

Summary

  • Storage-time shape checks for decoration values, from the XSS review: every render sink was verified inert (CSSOM property assignment discards invalid values; Lit bindings escape; ha-icon treats icons as lookup keys), so this is defense-in-depth — icon must be prefix:name (DESIGN §4.3 documented this check but it didn't exist), and colors reject characters no CSS color uses (<>{};, quotes, backslash, control chars, url(). 30 new parametrized tests cover hostile payloads (<script>, javascript:, CSS smuggling via ;/escapes/url() and the full legitimate value space (hex, rgb()/hsl(), named, var(--…), color-mix(), custom icon packs).
  • release.yml now refuses a tag whose version ≠ manifest.json (frontend package deliberately ungated — semver prerelease format differs from PEP 440).
  • Governance sync, all explicitly requested: dropped the unread min_ha_version manifest key (hacs.json is the enforced floor), AGENTS.md gate count 100 → 173, TODO's human-only-files block resolved.

Test plan

  • .venv/bin/pytest -q — 173 pass (was 143)
  • cd frontend && npm run typecheck — zero errors
  • cd frontend && npm test — pass
  • cd frontend && npm run build — no bundle drift (no frontend source changes)

Manual / UI verification: n/a — validation + CI + docs; no paint-path change.

Risk

  • Tightened validation can drop existing stored rules whose values fail the new checks at next load — logged via the v0.3.1 WARNING. Real-world values are unaffected; the CHANGELOG documents it under Unreleased.
  • Workflow edit is release-path only and fails closed (blocks a mismatched publish rather than allowing one).

Docs touched

  • README.md
  • CHANGELOG.md
  • TODO.md
  • DESIGN.md
  • docs/examples.md

🤖 Generated with Claude Code

jpettitt and others added 3 commits August 10, 2026 16:35
…acters

Defense-in-depth from an XSS review: every render sink is already
inert (CSSOM property assignment, Lit-escaped bindings, ha-icon lookup
keys), but stored values weren't constrained — and DESIGN § 4.3
documented an icon shape check that didn't exist. Icons must now be
prefix:name; colors reject <>{};, quotes, backslash, control chars,
and url( while keeping the full real value space (hex, rgb()/hsl(),
named, var(--…), color-mix()).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A stale manifest otherwise ships inside the zip and the WS version
command lies about what's installed. frontend/package.json is not
gated: its semver prerelease format differs from PEP 440.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…TODO

min_ha_version is not a manifest key HA reads — hacs.json's
homeassistant field is the enforced floor. AGENTS pre-commit gate
count 100 → 173. TODO's human-only-files block is done by this branch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jpettitt
jpettitt merged commit 980086b into main Aug 10, 2026
2 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