Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

✨ Voting portal: public "Locate your ballot" check without login (release/10.1) - #4707

Draft
xalsina-sequent wants to merge 1 commit into
release/10.1from
feat/meta-15623/release/10.1
Draft

xalsina-sequent wants to merge 1 commit into
release/10.1from
feat/meta-15623/release/10.1

Conversation

@xalsina-sequent

Copy link
Copy Markdown
Contributor

Parent issue: https://github.com/sequentech/meta/issues/15623

Summary

A voter's receipt carries a Ballot ID, but "Locate your ballot" only works after logging in. In events where voters sign in only through an external identity provider, the voter can't come back later, so the receipt can't be checked.

This adds a public check: anyone who holds a Ballot ID can confirm, without logging in and while the election is running, that the ballot is recorded in the ballot box. The answer is found or not found, nothing else. An election event allows it with a new policy, off by default.

Changes

  • Event presentation: public_ballot_lookup_policy (disabled by default, enabled). Skipped in the Borsh encoding, so signed ballot bytes do not change; an unknown value reads as no policy.
  • Hasura: migration adding the index cast_vote (election_event_id, election_id, ballot_id). Building it locks the table against writes, so apply it while no election is open.
  • Harvest: POST /api/public/locate-ballot, no credentials. It takes the full 64-character Ballot ID (no prefix, no pattern) and answers {"status": "found"} or {"status": "not-found"}. Policy off, unknown event and wrong election are all not-found. A discarded ballot is not found; valid and in-progress are found, so a re-vote stays private. The Ballot ID is not logged.
  • Voting portal: public page /tenant/…/event/…/election/…/public-ballot-locator#<ballot id>, outside the login gate. It starts no login and makes no Hasura request, and uses the event's logo, CSS and languages. The Ballot ID travels in the URL fragment and the request body, never in a path. The confirmation screen's link and QR point to it when the policy is on.
  • Windmill: the server-rendered receipt links to the public page when the policy is on.
  • Admin portal: the policy in the event settings, translated in all eight languages.
  • New voting portal setting HARVEST_URL: the public address of harvest. Without it the page says the check is not available and receipts keep the logged-in link.
  • Docs: election-manager reference, voter tutorial, custom CSS page and developer notes.

The logged-in locator is unchanged.

Notes for reviewers

  • The public page reads the policy from the event's public config file, which is rewritten when ballots are generated. After changing the policy, generate and publish the ballots again. The backend reads the policy from the database.
  • The route answers any origin (Access-Control-Allow-Origin: *): it takes no credentials and gives everyone the same answer.
  • Deployment work outside this repo: publish the harvest path, set HARVEST_URL, and add rate limiting at the gateway.

Testing

  • Unit tests: sequent-core (policy, lenient read, unchanged Borsh bytes), harvest (input validation, response shape), windmill (receipt link), and jest for the lookup service, URL builder, public page and the login-gate exemption. Voting portal, ui-core and admin portal suites, typecheck, lint and prettier pass.
  • On a dev environment, with an open event that has IdP-only login:
    • API: found, not found (policy off, wrong election, unknown event, other tenant, unknown ID, discarded ballot), 400 for prefixes, patterns and malformed input, CORS preflight.
    • Browser: a voter cast a ballot, and the confirmation link opened in a browser with no session showed the ballot as recorded. The page made no request to Keycloak or Hasura and set no cookies. Unknown ID, 4-character prefix, another election, a 390 px view and an event with the policy off were checked too.
  • Not covered: the admin portal select was not used in a browser (the policy was set in the database); the receipt PDF link is unit-tested only; index use by the planner needs a table of realistic size.

Ports to main will follow.

🤖 Generated with Claude Code

Parent issue: sequentech/meta#15623

Anyone who holds a Ballot ID can check, without logging in, that the
ballot is recorded in the ballot box. The answer is found or not found.
An election event allows it with the new public_ballot_lookup_policy,
disabled by default.

- sequent-core: PublicBallotLookupPolicy in the event presentation,
  skipped in Borsh.
- hasura: index on cast_vote (election_event_id, election_id, ballot_id).
- harvest: POST /api/public/locate-ballot, exact match, no credentials.
- windmill: the receipt links to the public page when the policy is on.
- voting portal: public page outside the login gate, Ballot ID in the
  URL fragment; the confirmation link and QR point to it.
- admin portal: the policy in the event settings.
- docs.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 3, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.2

QR code for preview link

🚀 View preview at
https://docs.sequentech.io/docusaurus/pr-preview/pr-4707/

Built to branch doc-previews at 2026-12-03 17:16 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

This branch has not been deployed

No deployments
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