Skip to content

feat: page through GitHub security alerts (BootUI 2.6.0) - #380

Draft
ffroliva wants to merge 103 commits into
mainfrom
feat/0.11.0-github-pagination
Draft

ffroliva wants to merge 103 commits into
mainfrom
feat/0.11.0-github-pagination

Conversation

@ffroliva

@ffroliva ffroliva commented Dec 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

Task 1.7 of the 0.11.0 plan (#367), the alert-pagination row of the BootUI 2.6.0 delta: Dependabot, code-scanning and
secret-scanning alerts are read across pages, as BootUI's GitHubAlertPagination and
GitHubApiClient.addSecuritySignal do, instead of extrapolating a total from the first page's last link.

  • src/sharpit/engine/collectors/github/pagination.py (new): the Link header parser and traversal state. Numbered
    and cursor links; last is read before next; a link is followed only when its scheme, host, port and path match
    the request (the endpoint or its repositories/{id} alias), with no user info or fragment, allowed query names only,
    one selector, no blank, control or replacement characters; page numbers and alert counts are bounded to the 32-bit
    range; a repeated page or cursor, or a repeated page digest (SHA-256 over canonical JSON), stops the traversal.
  • src/sharpit/engine/collectors/github/client.py: each alert section pages until the last page, the call budget
    (with BootUI's reservation for later sections) or the refresh deadline. A later page that fails, times out, is
    oversized or invalid makes only that section UNAVAILABLE, with an "At least N alerts were observed" lower bound
    and a warning; the refresh is PARTIAL. The next request URL is rebuilt from the configured path and a validated
    selector, so credentials go only to the API host. Dependabot alert details stay within the configured cap across
    pages. Multiple Link headers are read with get_all.
  • docs/reference/matrix-updates/0.11.0-github.tsv: op:github.refresh.alert-pagination (matched),
    op:github.refresh.alert-pagination-deadline (adapted: sharpit's 30 s refresh deadline stops a traversal with the
    time-limit reason; BootUI has no overall deadline) and op:github.refresh.alert-link-parser (adapted: Java URI,
    URLDecoder/URLEncoder and 32-bit arithmetic expressed with explicit checks).

Behaviour change for users: alert totals are counted from the pages read rather than estimated from the last link;
when a section cannot be read to the end it reports a lower bound instead of an estimate.

Review scope

The branch was cut from the 0.11.0 integration line, so against main the diff also shows the earlier 0.11.0 pull
requests (Wave 0, #368 to #379). The changes of this pull request are in the files listed above and in
tests/engine/collectors/github/ (fakes.py, test_github_alerts.py, test_github_client.py,
test_github_pagination.py).

Red evidence

Finding Test Red
Alert totals were extrapolated from the first page; later pages were never read test_github_alerts.py (traversal, caps, budget, digest, canonical-alias cases) assertion: 78 failed against the earlier client.py
Link parsing accepted lenient forms (fragments, spaces, control characters, @ in the authority, overflowing numbers) test_github_pagination.py::test_link_parser_python_leniency, test_rejects_count_overflow_and_invalid_page_sizes, test_cursor_reencoding_matches_java_url_encoder assertion (stub, scripts/dev/red_check.py)
The last-page tests pinned the old extrapolation test_github_client.py::test_github_last_page_uses_known_host, test_github_odd_last_page_links_keep_the_first_page_count assertion
A timeout or oversized body on a later alert page was untested (review) test_later_alert_page_transport_or_size_failure_keeps_section_only_unavailable[timeout, oversized] assertion: 'ERROR' == 'PARTIAL' with the per-section handler removed

| A lone surrogate escape in an alert page failed the whole refresh when the page digest was computed (review) | test_github_alerts.py lone-surrogate cases | assertion: refresh ERROR |
| A digest failure escaped its section (review) | test_github_alerts.py digest-failure case | assertion |

Page digests encode the canonical JSON as UTF-8 with replacement, as BootUI's getBytes(UTF_8) does; any digest
failure makes only that section unavailable. Nesting depth is bounded at 500 by the response decoder (#378).

Verification

uv run ruff check, uv run ruff format --check, uv run pyright (0 errors); targeted run over tests/engine,
tests/fastapi, tests/masking, tests/safety, tests/parity, tests/fuzz, the root rule tests and tests/docs;
the overhead budget tests run alone. The full suite runs in CI.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
… file

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
…e protocol

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
The Origin header is parsed as scheme://host[:port] with an http or https scheme, as BootUI 2.6.0 does: a path (a trailing slash included), query, fragment, userinfo, control character, trailing colon, unsupported scheme or a port above 65535 makes the origin unreadable, and an unreadable origin is cross-site. The value is no longer trimmed.\n\nA port of more than five digits is refused before int() converts it, in the origin and in the request's own Host, so a very long port is a cross-site refusal and no longer an unhandled ValueError. Adds a property test of the origin parser.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
…UI 2.6.0)

A write that carries Sec-Fetch-Site must send same-origin or none (ASCII, case-insensitive); same-site, cross-site, an empty value and any unknown value are refused. A present but empty Origin header is an unreadable origin and is cross-site, no longer read as absent. A same-site navigation GET still loads the shell, and an API path still requires the request's own scheme, host and port. A request whose own origin cannot be formed stays cross-site where that comparison applies.\n\nDocuments the rule in SECURITY.md and the BootUI contract note, and records the deviations in the 0.11.0 guard matrix fragment.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Record the two deviations of the inactivity log from BootUI 2.6.0 in a matrix fragment, update the MVP plan text that still described the old log line, extract the inactivity logging of install() into a helper to keep its complexity at the pinned count, and wrap one over-long test assertion.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
An invalid SHARPIT_ENABLED must log exactly one record, the fixed warning, as BootUI does. The count of the remaining configuration warnings stays.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
An invalid SHARPIT_ENABLED is already reported by the fixed inactive warning. Counting its settings warning as well produced a second WARNING record, where BootUI logs one.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
…tests

Port BootUiInactiveStartupDiagnosticTests.deliberateDisablementIsSilentAtInfo, cite the BootUI tests the other inactivity tests port, and keep the expected log texts in one test module. A single Inactivity alias types the inactivity category. The matrix row for the warning count records that it leaves out the invalid SHARPIT_ENABLED warning.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>

# Conflicts:
#	tests/fuzz/test_trust_boundary_fuzz.py
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
…r section

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
# Conflicts:
#	docs/reference/matrix-updates/0.11.0-github.tsv
#	src/sharpit/engine/collectors/github/client.py

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