Skip to content

refactor(scripts): simplify site checker and remove CSS layout engine - #21

Merged
Pigbibi merged 12 commits into
mainfrom
refactor/simplify-site-style-checker
Nov 18, 2026
Merged

Pigbibi merged 12 commits into
mainfrom
refactor/simplify-site-style-checker

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

AI assistance

Antigravity AI assistant helped simplify scripts/check_site.py and scripts/test_site.py.

What changed

  • Removed the over-defensive CSS layout engine and DOM visual-tree simulator from scripts/check_site.py (parse_style_decls, parse_css_stylesheet, serialize_visual_tree, ALLOWED_SITE_CSS_PROPS, compute_node_style, _RenderedHTMLNormalizer, runtime DOM state simulation) along with hardcoded SHA-256 asset allowlists (APPROVED_SITE_RASTERS, APPROVED_SITE_SCRIPT_FILES, APPROVED_SITE_INLINE_SCRIPTS, APPROVED_SITE_VECTOR_FILES, APPROVED_SITE_INLINE_SVGS) and hand-rolled PNG scanline reconstruction (unfilter_png_scanlines), reducing scripts/check_site.py from 2,754 lines to 1,275 lines (originally 3,114 lines in scripts/check_style.py before PR ci: extract site check and single-source docs check #20).
  • Preserved real repository-wide and site/ leak scanning (home/Windows paths, gs:// buckets, *.workers.dev, private IPv4/IPv6, internal hostnames, AWS ARNs, GCP service accounts, account/tenant IDs, JS/CSS/HTML/percent-encoded obfuscation decoding, and fail-closed handling for unscanned binaries).
  • Preserved PNG magic/chunk/CRC32/IHDR/IDAT-zlib/IEND structural checks and ICO frame checks while rejecting tEXt/zTXt/iTXt ancillary metadata chunks and scanning their decoded text for leaks.
  • Preserved .gitignore and internal-note path checks (check_internal_paths), site/ asset/anchor link integrity checks (check_site_links_and_safety), and all CLI flags/entrypoints used by .github/workflows/docs-check.yml and .github/workflows/pages.yml (--root, --phase, --advisory, --visibility).
  • Simplified scripts/test_site.py from 768 lines to 650 lines (originally 1,067 lines in scripts/test_style.py before PR ci: extract site check and single-source docs check #20), removing pure CSS layout simulation tests while keeping and expanding leak, PNG/ICO metadata, link integrity, phase, advisory, visibility, and git-visibility tests (33 tests).

How verified

  • python3 -m unittest scripts/test_site.py: 33/33 passed.
  • python3 scripts/test_site.py: 33/33 passed.
  • python3 scripts/check_site.py --phase 2: exited 0 (0 blocking, 0 advisory).
  • python3 ../.github/scripts/check_style.py --root . --phase 2 --visibility public --base-ref origin/main: exited 0 (0 blocking, 1 advisory on baseline README outline).
  • node --test tests/*.test.mjs: 36/36 passed (and baseline npm test with build-site-icons.mjs passed 36/36 before restoring unmodified binary icon fixtures).

Why

The previous site checker embedded a ~1,600-line CSS cascade/grid/flex visual-order simulator, manual PNG scanline unfiltering, and hardcoded SHA-256 asset digests that slowed checks and required editing scripts/ whenever site copy or icons changed. Simplifying it keeps genuine secret/leak prevention, PNG metadata blocking, and link/hygiene enforcement fast and maintainable.

Risk

Risk tier: R2 (scripts/ matches r2_paths in .github/governance/policy.json), so owner review and owner-approved label are required before merge. Preserves CLI flags and workflow invocations in .github/workflows/docs-check.yml and .github/workflows/pages.yml.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T13:23:21.266536Z 60f10c2 Manual request
🔒 Security Review ✅ Completed 2026-11-18T13:27:16.930270Z 60f10c2 Manual request

Security findings

Advisory findings (10)

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 275170910c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/check_site.py Resolved
Comment thread scripts/check_site.py Resolved
Comment thread scripts/check_site.py Resolved
- Verify scanline lengths and filter bytes for non-interlaced and Adam7
  interlaced PNG IDAT streams before marking them scanned.
- Collect inline style attributes in _SiteHTMLParser for CSS resource
  checks and CSS-escape leak scanning.
- Treat empty fragments (# and /#) as valid top-of-page navigation while
  continuing to flag missing element fragment targets.
@Pigbibi

Pigbibi commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f8288d4ad6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/check_site.py Resolved
Comment thread scripts/check_site.py Resolved
Comment thread scripts/check_site.py Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: f8288d4ad6

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread scripts/check_site.py Resolved
Comment thread scripts/check_site.py Resolved
Comment thread scripts/check_site.py Resolved
- Validate spec-mandated sizes and fields on allowed PNG ancillary
  chunks (sRGB, gAMA, cHRM, pHYs, sBIT, bKGD, tRNS, hIST, PLTE).
- Percent-decode local site paths and anchor fragments before checking
  target files and element IDs.
- Resolve query-only anchors (?...) against the current document while
  checking any trailing fragment target.
@Pigbibi

Pigbibi commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 88afcabdbb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/check_site.py Resolved
Comment thread scripts/check_site.py Resolved
- Reject <base> elements in site HTML so relative script, stylesheet,
  and image paths cannot be redirected to an external base URL.
- Collect <a name="..."> attributes alongside id attributes when
  validating same-document fragment links.
@Pigbibi

Pigbibi commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e19fe118a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/check_site.py Resolved
Comment thread scripts/check_site.py Resolved
- Allow relative directory anchors (./, ../) resolving to the site
  root index while still rejecting paths that escape site/.
- Check <source> src and srcset candidates alongside <img> elements.
@Pigbibi

Pigbibi commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7242b8abfb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/check_site.py Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 7242b8abfb

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread scripts/check_site.py Resolved
@Pigbibi Pigbibi added the agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation label Nov 18, 2026
@Pigbibi
Pigbibi force-pushed the refactor/simplify-site-style-checker branch from fcff006 to 71e1a87 Compare November 18, 2026 11:22
@Pigbibi Pigbibi added agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation and removed agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation labels Nov 18, 2026
@Pigbibi

Pigbibi commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71e1a879d0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/check_site.py Resolved
Comment thread scripts/check_site.py Resolved
@Pigbibi Pigbibi added agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation and removed agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation labels Nov 18, 2026
@Pigbibi

Pigbibi commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e2a55dd30e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/check_site.py Resolved
Comment thread scripts/check_site.py Resolved
@Pigbibi Pigbibi added agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation and removed agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation labels Nov 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: e2a55dd30e

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread scripts/check_site.py Resolved
@Pigbibi Pigbibi added agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation and removed agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation labels Nov 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de5987d733

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/check_site.py Resolved
@Pigbibi

Pigbibi commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

- Unescape XML character references in <style> blocks for .svg/.xml files
- Add regression test in scripts/test_site.py
@Pigbibi Pigbibi added agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation and removed agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation labels Nov 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 777ded79af

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/check_site.py Resolved
@Pigbibi

Pigbibi commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

- Strip :~: text-fragment directives before validating element IDs
- Add regression tests in scripts/test_site.py
@Pigbibi Pigbibi added agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation and removed agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation labels Nov 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 987f39d80d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/check_site.py Resolved
@Pigbibi

Pigbibi commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 21260a04de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- Strip ASCII tabs and newlines in resolve_site_asset_href and anchor checks
- Add regression tests in scripts/test_site.py
@Pigbibi Pigbibi added agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation and removed agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation labels Nov 18, 2026
@Pigbibi

Pigbibi commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

1 similar comment
@Pigbibi

Pigbibi commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@Pigbibi

Pigbibi commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@claude review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 451d33d8be

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread scripts/check_site.py Resolved
- Collect and validate <frame src=...> resources alongside iframe/object/embed
- Add regression test in scripts/test_site.py
@Pigbibi Pigbibi added agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation and removed agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation labels Nov 18, 2026
@Pigbibi

Pigbibi commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 60f10c2a23

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Pigbibi
Pigbibi merged commit 11afc7e into main Nov 18, 2026
12 of 15 checks passed
@Pigbibi
Pigbibi deleted the refactor/simplify-site-style-checker branch November 18, 2026 13:25

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 60f10c2a23

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread scripts/check_site.py
Comment on lines 951 to 955
if tag_name == "script":
self.script_tags.append((self._raw_src, raw_body))
self._raw_src = None
dec = fold_js_expressions(raw_body)
self.subtrees.append(dec)
if ("<" in dec or "&" in dec) and self.depth < 3:
self.subtrees.append(normalize_html_text(dec, self.depth + 1, page_rel=self.page_rel))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

P2 Badge Security: Reject unapproved inline scripts before publishing

If a contributor-controlled HTML change is merged, this branch only normalizes inline <script> bodies; it no longer checks them against the parent's approved hashes. I reproduced zero phase-2 findings for a script that creates a remote <script src>, while the parent rejected it. The Pages workflow then uploads site/, so visitors execute attacker-selected off-repo code. The new R2 patterns cover JS files but not HTML. Restore an executable-content approval gate or reject unapproved scripts.

SECURITY.md reference: SECURITY.md:L11-L14

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant