Skip to content

feat(verify): harden readonly browser verify and summary output - #2

Merged
Pigbibi merged 1 commit into
mainfrom
feat/harden-readonly-browser-verify
Dec 4, 2026
Merged

Pigbibi merged 1 commit into
mainfrom
feat/harden-readonly-browser-verify

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

AI assistance

  • Model: Antigravity

What changed

  • Hardened scripts/sign_readonly_session.py (verify_readonly_token) to validate integer iat/exp, reject future-issued tokens (iat > now + 60), and enforce bounded token lifetime (0 < exp - iat <= MAX_TTL_SECONDS).
  • Updated scripts/playwright_readonly_verify.mjs:
    • Exported pure helpers (isUnexpectedLoginRedirect, sanitizePathName, buildSummaryPayload) with a pathToFileURL CLI entrypoint guard.
    • Added VERIFY_REJECT_LOGIN_REDIRECT (default "true") failing when a non-login path redirects to /login or /auth/.
    • Added VERIFY_SUMMARY_PATH emitting a sanitized JSON report (HTTP status, final path, selector match, load timing, error counts) with zero cookies or page text.
  • Updated .github/workflows/live-readonly-verify.yml to accept push on refs/heads/main (supporting post-deploy chaining) alongside workflow_dispatch, and to upload the sanitized JSON summary artifact.
  • Added unit tests in tests/test_readonly_session.py and tests/test_playwright_readonly_verify.mjs.

How verified

  • python3 -m unittest discover -s tests -v -> all passed.
  • node --test tests/test_playwright_readonly_verify.mjs -> all passed.
  • /usr/local/bin/gitleaks git --log-opts="origin/main..HEAD" --redact -> no leaks found.

Risk

Low: backward-compatible additions (workflow_dispatch continues unchanged; reject_login_redirect & upload_summary can be toggled per caller; only metadata counts leave the workflow summary).

Co-authored-by: Antigravity <noreply@google.com>
@cgl-agent-coordinator

Copy link
Copy Markdown

Autoland: waiting: AI review evidence for this head

@cgl-opencode-reviewer

Copy link
Copy Markdown

AI Code Review (opencode / glm-5.4+kimi-k3.1-pro)

[glm-5.4] The Python token hardening (integer/bool-safe timestamp checks, future-iat rejection, bounded TTL) and the mjs refactor (pure exported helpers, dynamic Playwright import, main-module guard, sanitized summary) are largely sound, and the new artifact action is SHA-pinned with minimal permissions. However, the workflow's new push support is incomplete: the diff never adds a push entry to on: (the +22/-1 is fully accounted for by inputs, env, and the upload step), so the new push branch of the job if is unreachable; on push events the dispatch-input defaults would not apply, silently skipping the new summary upload and write-guard config; and the secrets: block nested under the same trigger as inputs: suggests this is a workflow_call reusable workflow, for which github.event_name is workflow_call and would match neither branch of the job if. Several lower-severity gaps remain in summary completeness, artifact contents, and test coverage. [kimi-k3.1-pro] The token-validation changes fail closed, but the advertised push-triggered verification is not wired end-to-end. The new summary also has diagnostic and sanitization gaps, and several new token-validation boundaries lack tests.

Reviewed commit: 350373a935 · Coverage: complete · Unresolved findings: true

Findings

  • [MEDIUM] .github/workflows/live-readonly-verify.yml: No push trigger is added to on: in this diff (the +22/-1 lines are fully accounted for by the new inputs, env vars, and upload step). A workflow only runs for declared triggers, so the new github.event_name == 'push' branch of the job if is dead code and the advertised post-deploy push chaining will never fire. Add push: branches: [main] under on: (or correct the PR description if the trigger already exists elsewhere).
  • [MEDIUM] .github/workflows/live-readonly-verify.yml: Trigger/event-name mismatch risk: the diff context shows secrets: nested at the same level as inputs: under a single on: trigger, which is only valid syntax for workflow_call (this repo's workflows are reusable workflow_call workflows per AGENTS.md). In a called workflow github.event_name is workflow_call, which the job if (both old and new) does not admit, meaning the job would never run for its actual trigger. Please verify the real on: triggers and include github.event_name == 'workflow_call' in the if if this workflow is invoked as reusable.
  • [MEDIUM] .github/workflows/live-readonly-verify.yml: On push events the inputs context is empty, so workflow_dispatch defaults do not apply: if: ${{ always() && inputs.upload_summary }} evaluates falsy and the new summary artifact step is always skipped on push (defeating the stated goal), and inputs.write_guard_path, inputs.ttl_seconds, inputs.upload_screenshots resolve to empty (an empty TTL_SECONDS may also break the token-signing step with int("")). If push runs are intended, add event-aware fallbacks (e.g., inputs.x || vars.x or literal defaults) for these values.
  • [LOW] scripts/playwright_readonly_verify.mjs: Pages that fail before results.push (unexpected HTTP status, login-redirect rejection, selector timeout) are omitted from the summary JSON, so failure reports are incomplete; additionally selector_ok is always true when recorded because waitForSelector throws on failure, making the field dead/misleading. Consider pushing a result entry (with an error marker) before rethrowing, or dropping selector_ok.
  • [LOW] .github/workflows/live-readonly-verify.yml: The summary artifact is described as "metadata counts only; safe for public repos", but buildSummaryPayload includes the full base_url (potentially a custom domain) and the write-guard API path. Artifacts of public repositories are downloadable by any authenticated user, and AGENTS.md treats custom domains as non-committable; consider omitting or hashing base_url/write_guard.path when upload_summary runs on public repos.
  • [LOW] tests/test_readonly_session.py: Only the future-iat branch of the new verify_readonly_token hardening is tested. Add unit tests for the other new fail-closed branches: non-integer/boolean iat/exp rejection ("Invalid token timestamps") and verify-side TTL bounds (exp - iat <= 0 and exp - iat > MAX_TTL_SECONDS -> "Token TTL out of bounds").
  • [LOW] tests/test_playwright_readonly_verify.mjs: The new Node test suite is not wired into repository CI (no CI workflow change; AGENTS.md local checks only run python3 -m unittest and actionlint), so these tests will only run locally and can silently regress. Also, the "How verified" section does not mention running actionlint despite workflow changes, which AGENTS.md requires before pushing.
  • [MEDIUM] .github/workflows/live-readonly-verify.yml: Push support is incomplete. The shown changes do not add a push: trigger under on:; changing the job-level if alone does not subscribe the workflow to pushes. Even if that trigger already exists in the unchanged header, inputs.* is not populated for a push: the existing input-derived VERIFY_BASE_URL and other configuration become empty, causing verification to fail its HTTPS-base-URL check, and always() && inputs.upload_summary evaluates false so the summary is not uploaded. Add an explicit push trigger and push-safe configuration/defaults rather than relying on workflow-call inputs.
  • [LOW] tests/test_readonly_session.py: Only the future-iat branch is tested. There are no verification tests for string/float/boolean iat or exp, non-positive lifetimes, or correctly signed tokens whose lifetime exceeds MAX_TTL_SECONDS; the existing issuer-side excessive-TTL test does not exercise these verifier guards. Add signed-payload boundary tests to prevent regressions in these authentication checks.
  • [LOW] scripts/playwright_readonly_verify.mjs: Failure summaries omit the page that actually failed. HTTP-status, unexpected-login-redirect, selector, and screenshot failures all throw before results.push(...), so the always-uploaded report can contain only earlier successful pages and none of the failing page's status, final path, or error counts. Record the current page attempt before these checks or finalize it in a per-page finally block.
  • [LOW] scripts/playwright_readonly_verify.mjs: buildSummaryPayload does not actually sanitize its string fields: it uploads raw baseUrl, requested paths, selectors, and write-guard paths. Base URLs with userinfo and requested paths with sensitive query parameters would therefore be copied verbatim into the artifact, despite the public-repo safety claim. Strip credentials/query components and allowlist the intended metadata; the current test merely checks for a cookie name that was never supplied to the helper.

@Pigbibi
Pigbibi merged commit 4c30fef into main Dec 4, 2026
1 check passed
@Pigbibi
Pigbibi deleted the feat/harden-readonly-browser-verify branch December 4, 2026 21:48
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