Repository navigation
fix(electoral-log-console): check only the chosen election's label (meta#15631) (ovcs) - #4708
Merged
Merged
Conversation
…31) (ovcs) Pin that the tenant log route refuses a super admin of another tenant, whether the event id is absent, null, empty or blank. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 2
Please check the settings in the CodeRabbit UI or the
|
…#15631) (ovcs) The console page and record always required permission labels reaching every election of the event, so an admin whose labels reach the election they filter by still got "Election outside the user's permission labels" and an empty grid with "No columns". - A page filtered by an election checks only that election's label; the election must be one of the event (400 otherwise). The store already reads only that election's rows. - A record opened from such a page names the election (new optional election_id on the Hasura action) and must be one of it (404 otherwise). - Without an election (entries of no election included) and for queries, labels must still reach every election; the 403 names each election and label out of reach and asks to choose an election. - Cross-tenant super-admin reads are unchanged. - The grid keeps the table's columns when a page fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
…a#15631) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (meta#15631) The story GraphQL boundary validates operations against the admin portal's own introspection file, which still lacked the new optional election_id argument, so OpenARecord failed with 'Invalid operation ElectoralLogConsoleRecord'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… of the event (meta#15631) A super-admin reading another tenant's event skips the label check, but the selected election is now still validated against the event in the target tenant, so an invalid selection is a 400 as documented. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ta#15631) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eta#15631) A page filtered by one election returned estimated_rows, the table's rows for the whole event before filters, so it counted other elections' rows. Harvest now omits it for election-scoped pages (event-wide pages keep it); the admin portal hides the count footer when it is absent. Rows, cursor, personal-data redaction and label gates are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Findeton
marked this pull request as ready for review
December 3, 2026 23:21
edulix
added a commit
that referenced
this pull request
Dec 4, 2026
… TEST elections included (meta#15631) (ovcs) (#4721) Parent issue: sequentech/meta#15631 (rc.49 tracker sequentech/meta#15576) ## Context On rc.48, the tenant **Electoral Log** console answered 403 "Election outside the user's permission labels" and showed "No columns" when the Admin left the Election filter empty. The cause was `electoral_log_console.rs` `event_board`, which always called `authorize_election_permission_labels(.., None)`. That check requires the caller's labels to reach every election of the event, even when the page is filtered by one election. On ovcs-server the admin holds BANGKOK, CANBERRA, HONGKONG and MELBOURNE, but event 2ff5dec8 has four TEST elections labelled `<LABEL>-TEST`, so every read was refused. #4677 did not cause it: the console code was unchanged from rc.48. **#4708, already merged on ovcs, fixes this.** - With an Election filter, only that election's label is checked. - A record opened from that page is checked the same way. - Without a filter (the event-wide view), the page still needs every label. The 403 names each election it cannot reach, with its label, and says "Choose an election". - The grid keeps the table's columns when a read fails. #4680 makes TEST elections carry their Post's label, so an admin holding every Post's label can now browse the whole event. ## This PR: a regression test only `an_admin_of_every_post_browses_the_whole_event_with_its_test_elections` (harvest DB route test) rebuilds the rc.48 event's shape: an official election and a TEST twin per Post (`annotations.test_copy_of`, the same label, on the Post's area), with ballots and a record. - An admin labelled with every Post reads records, ballots, voters and the queue event-wide, with no election chosen. - An admin of one Post gets a 403 event-wide. The 403 names the other Post's official and TEST elections, never their own, and asks to choose an election. That admin then reads each of their own Post's elections (official and TEST) alone, and is refused the other Post's TEST election. ## Tests run (arm64, docker: `step-backend-e2e-cargo-packages:local`, postgres:18) - `cargo test -p harvest --lib -- electoral_log_console permission_label_tests`: 26 passed, 0 failed. This covers the new test and #4708's route tests, which its PR could not run locally. - admin-portal `jest src/services/ElectoralLogConsole.test.ts`: 9 passed (#4708's `pageColumns` test). - `rustfmt` with the harvest config on the changed file. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes sequentech/meta#15631 (ovcs). Draft: not merged or deployed.
Problem
On rc.48, the tenant Electoral Log console (Tables tab) answered 403 "Election outside the user's permission labels" with No columns, even when the admin filtered by an election their labels reach.
event_boardalways checked every election of the event (authorize_election_permission_labels(.., None)).Change
authorize_event_election_permission_labels, the same check the election-scoped export uses since OVCS rc.49: election-scoped log export checks only its election; name 403 refusals (meta#15614) #4677. The election must belong to the event, otherwise 400. The store already reads only that election's rows.electoral_log_console_recordaction gets an optionalelection_id. When it is given, the label check above applies, and a record of another election answers 404. The admin portal passes the page's applied election./electoral-log) refuses another tenant's super admin whether the event id is absent, null, empty or blank. That isolation already held, so it is a regression test only.No authorization is weakened: every path still checks the tenant permission, and an event-wide read still needs every label.
Tests (synthetic data only)
the_console_answers_admins_whose_labels_allow_the_chosen_electionandthe_console_asks_to_choose_an_election_the_labels_reach. They cover the north-only admin on all 4 tables, a refused south election, the record check, a non-event or non-UUID election → 400, and the 403 text.requests_read_one_election_only_when_they_name_one.pageColumnsunit test. Stories:ReadFailsnow asserts the headers and drops its now-obsoletearia-required-childrenexpected failure.FilterTheRecordsasserts that the record request carrieselectionId.gql.ts,graphql.tsand bothschema.jsonfiles were updated by hand for the new optional argument, because codegen needs a live Hasura.Validation not run locally
The host has 22 GiB free (< 25 GiB policy), and there are no
node_modules, cargo build or rustfmt runs in this worktree. So I did not run:cargo check/cargo test/rustfmtfor harvest, jest, tsc, prettier, Storybook, or Hasura metadata lint (the pre-push hooks skipped them too). CI is the first real compile and test run.Demo verification outstanding: on the demo, as an admin whose labels reach only some elections, check the Electoral Log console with and without an Election filter, and open a record.
🤖 Generated with Claude Code