Skip to content

app/: bound the work strangers' GitHub App installations and anonymous requests can cause (sc-9144, sc-9124) - #162

Open
ndbroadbent wants to merge 7 commits into
mainfrom
app-abuse-hardening
Open

ndbroadbent wants to merge 7 commits into
mainfrom
app-abuse-hardening

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Two CLI fixes, one version bump (0.2.24 → 0.2.25).

sc-9174: an upload with identical files fails on R2 429

WeasyPrint's build of 42 files held 14 identical .txt files. The server answers an upload URL for every snapshot whose file it lacks, and identical files share one content-addressed key, so the CLI PUT the same key up to 14 times in parallel. R2 lets one client write an object about once a second, and the retries from #128 (6 tries, 0.5 s → 8 s, no jitter) retried in lockstep, so the upload failed.

  • Dedupe: add_snapshots uploads each distinct SHA-256 once per run, across registration batches too. Every snapshot is still registered by name with its hash; the others point at the same blob. The registration request sends each snapshot once, as before; it's the upload list that asked for the same SHA twice, and that's deduplicated now.
  • Retries: extends CLI 0.2.19: snapshot uploads the store refuses are tried again #128's put_blob instead of adding a second layer. 429, 5xx and dropped connections still get 6 tries with exponential backoff (or Retry-After, at most 30 s), plus up to 50% random jitter so parallel uploads don't retry together.
  • Errors name the file: uploading out/sample-03.txt: the store refused it 6 times, the last with 429 Too Many Requests (an inline snapshot shows as name (from path)). The presigned URL no longer goes into the log.
  • Not changed: the server still returns a URL per duplicate snapshot, so older CLIs keep the old behaviour. A server-side dedupe in POST /snapshots (app/src/http/api/builds.rs) would cover them; I left app/ alone here.

sc-9164: PDF fingerprints change every run when font subsets carry a timestamp

fontTools stamps the time it saves each subset into head.modified, which changes head.checkSumAdjustment and the directory checksum for head. So every run of WeasyPrint, fpdf2 and similar tools got new fingerprints.

  • Normalisation (visualci-core::pdf): font programs under a font descriptor's FontFile2 or FontFile3 are decompressed (Flate etc. via lopdf), then normalize_sfnt zeroes head.modified, head.checkSumAdjustment and the head table-directory checksum before hashing. It parses the sfnt table directory and finds head by tag. It skips the font, leaving it to be hashed as it is, unless the version is 0x00010000, true or OTTO, the whole directory fits the data, the head record exists, the table holds at least 36 bytes in range (checked arithmetic) and the magic number is 0x5F0F3CF5. No indexing can panic. CFF (Type1C), Type 1 FontFile and collections are hashed as before. A font program the normalisation doesn't change hashes exactly as before: the referenced-stream path feeds R plus the stream's digest, the same as feed.
  • compare-runs: when two PDFs' fingerprints still differ and the PDFs are identical with every embedded font program left out (pdf::fingerprint_without_font_programs), it lists them under "same drawing, embedded fonts differ" with a note that this is usually a subsetter's timestamp, and suggests SOURCE_DATE_EPOCH. It doesn't list every page as differing. It still exits 1, because those PDFs would still re-render each run.
  • Docs: pdfs.md's Fingerprints section mentions the font timestamps and SOURCE_DATE_EPOCH. skills/ is regenerated and the plugin is bumped to 0.1.54.

Deploy impact (fingerprints are shared with the renderer)

  • ALGORITHM stays vci-pdf-1. I reworded its doc comment: bump it when a change could let PDFs that draw differently match. This change only makes fewer bytes count, so an old fingerprint can equal a new one only for PDFs that draw the same. Bumping would have re-rendered every PDF; this way only the affected ones re-render.
  • Affected PDFs: those that embed a TrueType/OpenType font with a valid head table. That's most PDFs with embedded TrueType subsets (WeasyPrint, Chrome/Skia, fpdf2, ReportLab TTF). checkSumAdjustment is never zero, so these get a new fingerprint once, whether or not their font had a timestamp. PDFs with only CFF/Type 1 or non-embedded fonts keep their fingerprints.
  • First run after customers upgrade the CLI: affected PDFs miss the render cache (renders is keyed by project, source fingerprint and renderer), so they upload, render and get charged rendered-page credits once. Their manifest groups (sc-8868) hash fingerprints, so those groups show as needed and are re-checked once. After that, timestamp-only runs match and stop re-rendering.
  • Baselines and review: no change. Comparison is by page image (base.image == head.image or the pixel fingerprint), so a re-render of the same drawing compares unchanged. Nothing shows as changed and nothing needs re-approving. The text-snapshot "variant" lookup uses text fingerprints, not PDF ones.
  • Renderer: its image rebuilds (its input hash covers visualci-core), and it reports document_fingerprint from the same fingerprint_bytes, so the CLI 0.2.25 and the renderer agree on any file. blobs.pdf_fingerprint is written only where it's NULL, so blobs already rendered keep the old value. That only matters when a PDF is registered by hash alone without a fingerprint (current CLIs always send one), and the worst case is one extra render.
  • CLIs before 0.2.25 keep sending old fingerprints. For affected PDFs those won't match renders keyed by new ones, so mixing CLI versions on one project costs re-renders, never wrong results.

Security review fixes (review of 30afdd3)

  1. No fail-open. When a delivery's counts can't be read (the cache store failing, or a bucket contended past the framework's 100 compare-and-swap retries), the delivery is never accepted outright (when_uncounted). A claimed installation's delivery is kept for later; if the database is down, keeping it fails with a 5xx, which GitHub logs as failed and the redelivery job picks up. An unclaimed installation's delivery is dropped with a 202.
  2. Claimed installations are cheap to make, so limits now depend on plan. Claims are unclaimed, free or paid (the best plan among the organization the installation is set up for and the organizations whose projects link through it). I chose plan weighting over a reserved share: anyone can make a free claim, but only paying customers get the large shares.
    • Rate per minute: paid 600, counted against nothing shared; free 120 plus the shared total; unclaimed as before. The 6,000/min total now covers only unclaimed and free traffic, so no amount of strangers' traffic holds up a paying customer.
    • Storage: 50 MB per paid installation, 5 MB per free one, 50 MB for all free installations together, 500 MB in total. Ten throwaway organizations can fill only the 50 MB free pool, never the store paid customers need.
    • When a later count refuses a delivery, every earlier count gets its token back (Bucket::give_back, through the laravel-rust-cache crate, since 0.1.4's laravel::rate_limit doesn't export Bucket). The drain therefore doesn't spend a second token.
  3. Over the storage cap, a claimed delivery gets a 503 (GitHub logs it as failed, and the redelivery job sends it again). It never gets a 202 and is never lost. Unclaimed deliveries keep the 202.
  4. Redelivery job.
    • It keeps a high-water mark (the newest delivery ID read, in webhook_redelivery_marks) and pages back to it, at most 100 pages and 24 hours.
    • A run that doesn't reach the mark reports partial, and its heartbeat is a failure.
    • Order: paid installations first, then oldest first, at most 10 per installation and 50 per run.
    • When GitHub refuses a redelivery, the error is recorded in webhook_redeliveries and the run continues. Later runs retry it first, up to 3 tries in all.
  5. Drain.
    • Each row is claimed before it's acted on (claimed_until, 5 minutes, through a conditional UPDATE), and a row another run holds blocks its installation for this run. A crashed run's claim expires, so the delivery is retried rather than lost. I chose this over DELETE … RETURNING because a crash then would lose the delivery.
    • A run stops after 240 s, under its 10-minute lock.
    • Installations still over their limit are excluded in SQL, so their payloads aren't read.
    • While an installation has kept deliveries, its new deliveries are kept behind them (has_deferred), so they're acted on in order.
  6. Trailing slash. The OAuth registration limit compares the normalised path without trailing slashes, and hosts.rs is_oauth_server_path now trims trailing slashes too, so /oauth/register/ is the MCP host's path and is limited.
  7. Registrations. IPv6 addresses count by their /64. The daily total is gone. Instead, never-connected clients are capped (VISUALCI_OAUTH_UNUSED_CLIENTS, 5,000): a registration past the cap deletes the oldest unused clients first (registered over 10 minutes ago, with no authorization code pending), so new MCP clients can always register. It refuses only while every unused client is newer than that. Concurrent registrations can overshoot the cap by however many arrive at once, and the next registration corrects it.
  8. Picks. The limit check and the INSERT run in one transaction under pg_advisory_xact_lock per organization, then per person (always in that order). The job is dispatched after the commit.

Nits:

  • 9. The kept GitHub token is forgotten on sign-out. There's no user-account deletion in app/ to hook into.
  • 10. Deliveries for claimed installations are deduplicated by X-GitHub-Delivery (webhook_deliveries_seen, kept 3 days, pruned by the redelivery job), live and in the drain. Unclaimed ones aren't recorded: they're inconsequential, and recording them would cost a write each.
  • 11. Delivery bodies in flight before signature checking are capped at 100 MB per process (a semaphore, each request taking its Content-Length rounded up, or 25 MB without one). A request that waits more than 5 s gets a 503.
  • 12a. log_dropped keeps an Option<Instant>, so there's no subtraction that could panic.
  • 12b. /status holds its lock only to read or write the cached value. While one request queries the database, others get the last answer. A failure is cached for 2 s.
  • 12c. defer() checks the caps and inserts under an advisory transaction lock, so it's atomic with no overshoot.
  • 12d. import_batch stops a pick (with an error saying why) when the person is no longer an admin of the organization.
  • 12e. The retry time includes the date when it isn't today, for example "09:05 UTC on 5 Dec".
  • 12f. The drain re-checks each installation's claim and uses it for both the limits and how the delivery is acted on.

Review-fix tests:

  • 1: uncounted deliveries are never accepted, and a refused delivery gives its counts back.
  • 3: a claimed delivery over the cap gets 503, never "dropped".
  • 4: the second redelivery run reads one page back to the mark; a refused redelivery is recorded and the run continues; it's retried next run; a partial run makes the heartbeat fail.
  • 5: a live delivery waits behind a kept one, and two drains running at once act on each delivery exactly once, in order.
  • 6: trailing-slash and uppercase registration paths are limited, and IPv6 counts by /64.
  • 7: unused clients are capped by deleting the oldest.
  • 8: two picks at once can't both pass the limit.
  • 9: sign-out forgets the token.
  • 10: a delivery sent twice is acted on once.

Re-review fixes (review of 975bfb5)

  • A (blocker): no failed delivery is skipped. As the delivery log is read, each failed delivery is recorded in webhook_redeliveries with its GUID, installation, the first and last attempt IDs seen, and a state (pending, redelivered, succeeded, given_up or skipped). Runs drain the pending ones across runs: paid installations first, oldest first, 10 per installation and 50 per run, and the rest wait. The mark moves only once a scan has read back to the old mark. A run that stops at its page cap saves its cursor and the newest ID it started from (webhook_redelivery_marks), and the next run resumes there. Within a scan, an older failed attempt of a GUID that already got a 2xx isn't recorded. A success read in an earlier run can't be seen that way, so that delivery may be redelivered once; the GUID dedupe then makes it a no-op.
  • B: retry after a failed redelivery. If the log later shows a newer failed attempt for a delivery we already redelivered, it becomes pending again, with a backoff of 10 minutes doubling each time. After 5 tries it's given up with an error log, as are entries older than 72 hours (how long GitHub keeps them). An ask GitHub refuses is recorded, retried with the same backoff, and the run continues.
  • C: slow bodies can't hold the budget.
    • A body takes 1 MB of the 100 MB per-process budget for each megabyte as it arrives, rather than for its declared size.
    • It must arrive at 1 MB/s after a 5-second grace period, or it gets a 408. A declared size over 25 MB gets a 413 before anything is read.
    • Requests from outside GitHub's hook addresses get a separate 8 MB budget. The addresses come from GET /meta hooks, refreshed hourly by RefreshGithubHookAddresses into the cache store; /status reports github_hook_addresses_seconds. The check uses request.ip() as the trusted proxies resolve it, and while the list isn't known yet every address counts as GitHub's.
  • D: /status can't get stuck on a stale answer. A drop guard clears the "someone is asking" flag however the request ends, and the flag also expires after 15 s. No answer older than 60 s is ever served.
  • E: registrations. A /48 now has its own limit (3× the per-address limit), alongside the /64. Only clients over a day old can be deleted to make room; otherwise the registration gets a 429. Deletions are logged at warn level.
  • F: no global lock when keeping a delivery. Kept bytes are counted in deferred_webhook_bytes (per installation, free, total), updated in the same transaction. Only the installation's own row is locked (FOR UPDATE), so its cap holds exactly. The free and total rows are read without a lock and incremented atomically, so deliveries for different installations never wait on each other. Those two caps can overshoot by the deliveries being kept at that moment, at most 25 MB each.
  • G: attempts counted when a row is claimed. A delivery that kills the worker is dropped after 5 attempts instead of blocking its installation.
  • H: plan from the set-up organization only. An installation is paid only if the organization it's set up for is on a paid plan. Projects linked through it make it at most free.
  • I: dedupe inserts first. The GUID is inserted before the delivery is acted on, and a conflict means it's a duplicate. If acting on it fails, the GUID is released, so GitHub's redelivery is still acted on. This applies both live and in the drain.
  • Account deletion: app/ never deletes users (staff org:delete deletes organizations), so the kept token is forgotten on sign-out and otherwise expires within 8 hours.

Re-review tests:

  • A: 40 failed deliveries for one installation are all redelivered over 4 runs, each exactly once, and a fifth run finds nothing. A partial run resumes from its cursor: 3 pages, each read once, a failure found on every page, and the mark set to the newest ID.
  • B: a delivery redelivered but failed again goes back to pending behind a backoff, is redelivered again, and is given up after 5 tries.
  • C: 40 slow bodies don't stop a 2 MB delivery being read within 2 s.
  • D: a unit test of the reuse decision and the drop guard.
  • E: a 2-hour-old unused client is kept (429), and one over a day old makes room.
  • F: concurrent defers for two installations produce the right counters.
  • G: a delivery already at 5 attempts is dropped without being acted on.
  • H: a paid organization's project linked through someone else's free installation leaves that installation free.
  • I: a delivery sent twice is acted on once.

Third-pass fixes (review of 7cac487)

  1. A claim left half-done can't turn into a lost delivery. Each row in webhook_deliveries_seen now has a state and started_at. A delivery is claimed as processing and set to done after success; only done counts as a duplicate (200). Another delivery of a GUID that's still processing gets a 409, which isn't a 2xx, so GitHub's log keeps it as failed for the redelivery job. A claim still processing after 2 minutes (past the 30 s request limit) was abandoned (a request cut off, a panic, a worker gone), and the next delivery takes it over. If acting on it fails, the claim is released. In the drain, a delivery another request is acting on waits with its installation until the next run, and the attempt isn't counted.
  2. Paid failures go first, and free installations can't build a queue.
    • Recorded failures store paid (the claim tier at recording time), and the drain query orders by paid DESC, first_attempt_id before its LIMIT.
    • Unclaimed installations' failures aren't recorded at all.
    • At most 100 failures wait for one free installation; the rest are given up at once, with an error log.
    • A free installation whose own store is full now gets 507, which the redelivery job never records (a paid one still gets 503, which is redelivered). An attacker who fills their free store on purpose fills nothing else.
  3. Registrations.
    • 5 a day per IPv4 address or IPv6 /64 (an MCP client registers once), and 15 a day per /48.
    • The unused-client cap is now 100,000. Between the cap and the ceiling, only clients over a day old are deleted.
    • New ceiling, 150,000 (VISUALCI_OAUTH_UNUSED_CLIENTS_CEILING): above it, the oldest unused clients are deleted whatever their age.
    • 429s are logged at warn level, at most once a minute per process, with a count.
  4. Hook addresses. The /meta refresh is scheduled every five minutes but only fetches when the list is missing or an hour old, so a new server has it within five minutes of starting. I chose that over a boot hook, which would make every test boot call GitHub. A cache read error now counts as "outside" (the 8 MB budget).
  5. Expired cursor. If GitHub rejects the saved resume cursor with a 4xx, it's cleared and the run rescans from the newest entry back to the mark.
  6. Comment fixed. The free and total counters can overshoot by the bodies in flight, about 100 MB per process, not 25 MB.

Third-pass tests:

  • An abandoned processing claim is taken over and acted on once; a live one gets 409 and is never answered as a duplicate.
  • A paid failure is redelivered in the next run despite 3,000 older free pending rows, and a 507 isn't recorded.
  • A free installation keeps at most 100 waiting.
  • A rejected resume cursor restarts from the top and moves the mark.
  • 5 registrations a day from one address, then 429.
  • The ceiling deletes the oldest young clients and keeps the newest.
  • CIDR matching, including IPv4-mapped IPv6.

Fourth-pass fixes (review of 747626b)

  • A. Registrations are counted per address and redirect URI host.
    • 50 a day per IPv4 address or IPv6 /64 for one redirect host (VISUALCI_OAUTH_REGISTRATIONS_PER_REDIRECT_HOST). Hosted platforms like claude.ai's connectors register their users' clients from shared egress addresses with their own callback host, so they get a count of their own, and one attacker can't fill another platform's.
    • 500 a day per address across all hosts (VISUALCI_OAUTH_REGISTRATIONS_PER_ADDRESS), and 1,500 per IPv6 /48.
    • A refusal gives back the counts already taken.
    • The redirect host comes from the registration body (read up to 64 KB, then handed on to the OAuth server unchanged).
    • I chose 50 rather than about 20 per host, since the test you described expects 30 a day from one platform address to succeed.
  • B. A paid organization's projects linked through a free installation are redelivered. The installation keeps the limits of the organization it's set up for (fix H). But when a paid organization has a project linked through it, its deliveries past the store's cap get 503 (redelivered), not 507. Its failures are also marked to be redelivered first and aren't held to the 100-waiting cap.
  • C. The drain acts on a kept delivery for at most 90 s, under the 120 s takeover time. A timeout counts as a failure and releases the claim.
  • D. Claims carry a random owner token. finish_delivery and release_delivery act only on a claim their caller still owns, so a late release can't undo a newer takeover.
  • E. Documented in docs/design.md (limits): a free installation keeps at most 100 failures waiting, and its 507s aren't redelivered.

Fourth-pass tests:

  • 30 claude.ai registrations from one address succeed, the 31st is refused, another host from the same address is counted separately, and the address's overall limit holds.
  • A late release by the first owner leaves the takeover's claim intact, and only the new owner can finish it.
  • A free installation with a paid project linked through it answers 503 past its cap (never 507), and 120 of its failures are kept, marked to go first, with none given up.

Tests

  • identical_files_are_uploaded_once: 20 identical files through add_snapshots against a fake API and store → registered 20, exactly 1 PUT.
  • an_upload_the_store_refuses_once_succeeds_on_a_retry: a 429, then success → 2 PUTs.
  • an_upload_the_store_keeps_refusing_fails_naming_the_file: persistent 429 → 6 PUTs, and the error names sample-00.txt, "6 times" and 429.
  • ignores_the_time_a_font_subset_was_saved: a synthetic TrueType subset (generated in the test, with real table checksums and checkSumAdjustment) in a minimal PDF as Flate-compressed FontFile2. Two copies that differ only in head.modified and the two checksums get the same document and page fingerprints.
  • a_font_with_other_glyphs_still_changes_the_fingerprint: different glyf bytes → different fingerprint, and the fonts-left-out fingerprint still matches (the compare-runs case).
  • malformed_fonts_are_left_alone_without_panicking: empty data, a truncated header, directory or head table, a numTables that overruns, overflowing or out-of-range head offsets, a head that's too short, a bad magic number. Each is left unchanged, and the PDFs embedding them still fingerprint as drawn.
  • The existing CLI 0.2.19: snapshot uploads the store refuses are tried again #128 retry tests pass.

Gates on the build pool: cargo fmt --all --check, cargo clippy --locked --workspace --all-targets -- -D warnings, cargo test --locked --workspace --exclude visualci-app (all pass), and node scripts/skills.mjs --check. No app/ code changed.

…s requests can cause (sc-9144, sc-9124)

The GitHub App is public, so anyone can install it and make GitHub send its webhook.

- /webhooks/github refuses a missing or malformed signature before reading the body, and a wrong one before parsing it.
- Deliveries are rate limited in the cache store (VISUALCI_GITHUB_WEBHOOKS_*): per installation (600/min claimed, 60/min
  unclaimed), all unclaimed installations together (600/min) and everything (6000/min). Over the limit, a claimed
  installation gets a 429 (GitHub's delivery log keeps it for redelivery) and an unclaimed one a 202, dropped and logged
  once a minute. `installation` deliveries count only in the total, so onboarding is never dropped.
- Unclaimed installations' membership changes recheck nobody; an installation delivery looks its repositories up in one
  query and asks GitHub whether the installation exists only when a project changes.
- RecheckAccess is debounced (30 s, at most 2 min) over an access_rechecks queue, so a burst of membership deliveries
  lists every linked repository's collaborators once. /status reports oldest_access_recheck_seconds; the hourly sync
  clears the queue.
- forge::calls counts every request's GitHub calls through the app's HTTP client: 5 per request, 22 for a sign-in, 10
  for linking a repository. Logged per request; under APP_ENV=testing a request over budget answers 500, so a handler
  that loops over a GitHub list fails CI. Jobs count their own.
- A sign-in reads at most one page of installations and 20 pages of repositories (10 per installation); a GitLab
  sign-in at most 20 pages. The unused installation_repositories pager is gone.
- OAuth client registrations: 20/hour per address, 1000/day in total. Sign-in start and callback: 60/min per address.
  Repository picks: 20/hour per person. /status reuses its numbers for 10 s per process.
…s through the queue, picker search past the cap, cached installation tokens (sc-9144, sc-9124)

- A claimed installation's delivery over its rate limit is kept (deferred_webhooks, verified payloads only) and acted
  on at the allowed rate by DrainDeferredWebhooks, capped at 50 MB per installation and 500 MB in total (past a cap:
  an error in the log and a 202). /status reports oldest_deferred_webhook_seconds. Unclaimed ones are still dropped.
- RedeliverFailedWebhooks, every 10 minutes: reads the App's delivery log for the last day (at most 10 pages), and
  redelivers each failed delivery of a claimed installation once (webhook_redeliveries), at most 50 a run, with
  VISUALCI_WEBHOOK_REDELIVERY_HEARTBEAT_URL/_TOKEN.
- Picks: up to 500 at once, 500 an hour per person and 2,000 a day per organization, refused with the time to try
  again; ImportRepositories makes 20 projects a run, 15 s apart; validation in one query.
- Picker: installations[].listed and .total; for an installation the sign-in didn't list completely, a search asks
  GitHub once as the person (their sign-in token, encrypted in the cache), 30 a minute per person.
- Installation tokens cached encrypted until 5 minutes before expiry, forgotten on a 401.
…44, sc-9124)

- admit() never accepts a delivery whose counts can't be read; a refused delivery gives its earlier counts back.
- Claims by plan: paid installations count against nothing shared (600/min, 50 MB kept); free ones 120/min, 5 MB each
  and 50 MB together, and the shared total; the total covers unclaimed and free traffic only.
- A claimed delivery over the storage cap gets a 503 (redelivered later), never a 202.
- Redelivery: a high-water mark, up to 100 pages; partial runs fail the heartbeat; paid first, oldest first, 10 per
  installation; refused redeliveries recorded and retried up to 3 times; the run goes on.
- Drain: rows claimed per run (claimed_until), runs capped at 240 s, blocked installations left out in SQL, and live
  deliveries kept behind an installation's kept ones so they're acted on in order.
- OAuth registrations: trailing-slash paths limited (hosts.rs too), IPv6 by /64, a cap on never-used clients that
  deletes the oldest instead of a daily total.
- Picks: limits checked and recorded under per-org and per-person advisory locks.
- Nits: kept GitHub token forgotten on sign-out; claimed deliveries deduplicated by X-GitHub-Delivery; in-flight body
  bytes capped per process; no Instant subtraction in log_dropped; /status lock not held across the query and failures
  cached 2 s; defer's cap check atomic; import batches recheck the admin role; retry times with the date when not today;
  the drain rechecks claims.
…-9124)

- Redelivery: failed deliveries are recorded in webhook_redeliveries as the log is read and drained across runs
  (paid first, oldest first, 10 per installation, 50 a run); the mark moves only once a scan reaches the old one, and a
  partial run resumes from its cursor. A redelivered delivery whose new attempt fails is pending again with a doubling
  backoff, given up with an error after 5 tries or 72 hours.
- Body budget taken per megabyte as bytes arrive, with a 1 MB/s minimum rate; requests from outside GitHub's hook
  addresses (GET /meta, refreshed hourly; /status github_hook_addresses_seconds) share an 8 MB budget.
- /status: a drop guard clears the asking flag, which also expires after 15 s; no answer older than 60 s.
- OAuth: IPv6 /48 limit too; only unused clients over a day old are deleted, warn when they are.
- defer() counts bytes in deferred_webhook_bytes, locking only the installation's row.
- The drain counts an attempt when it claims a row.
- A claim's plan comes only from the organization the installation is set up for.
- Dedupe inserts the GUID first, released when acting on it fails.
…count refilling on a slow CI machine doesn't fail it
…c-9124)

- Dedupe claims have a state: processing (taken over after 2 minutes, answered 409 meanwhile) and done (the only
  duplicate), so a request cut off or a worker gone mid-way can't make a retry look handled.
- Redelivery queue: paid stored on each row and ordered first in SQL; unclaimed installations' failures not recorded;
  at most 100 waiting per free installation; a free installation's own full store answers 507, never recorded.
- OAuth: 5 registrations a day per address or /64 (15 per /48), unused-client cap 100,000, a 150,000 ceiling past
  which the oldest go whatever their age, and a once-a-minute warning while registrations get 429s.
- GitHub's hook addresses read within five minutes of starting; a cache error counts as outside.
- A rejected resume cursor is cleared and the log read again from the newest.
- The counters' overshoot comment names the in-flight body bound.
…sc-9124)

- OAuth registrations counted per address (or /64) and redirect URI host, 50 a day, so a hosted platform's users
  sharing its addresses get their own count; 500 a day per address across hosts, 3x per /48; counts given back on a
  refusal.
- A free installation with a paid organization's projects linked through it answers 503 past its store's cap
  (redelivered), and its failures go first without the free queue cap; its rate limits stay its own organization's.
- The drain acts on a kept delivery for at most 90 s, under the 120 s takeover; a timeout releases the claim.
- Claims carry a random owner token; only the owner finishes or releases one.
- design.md: a free installation keeps at most 100 failures waiting, and its 507s aren't redelivered.

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