Commit graph Bifrost/src/Bifrost.Web/Program.cs
Author SHA1 Message Date
Meta Vens
15f96c408c Heimdall sign-in: attempt cookies live in a ring of two fixed slots, so the Cookie header is bounded by construction; pin the completion form's id
Start takes a free slot or overwrites the one expiring first; parallel starts carry the same request
cookies, choose the same slot and overwrite each other. Complete finds its attempt by scanning the
slots for the posted nonce; an overwritten attempt finds none and is refused like any other. The
per-request counting sweep, its byte budget and the nonce-named cookie are deleted.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-11 22:25:24 +02:00
Meta Vens
4a28cea1f9 Heimdall sign-in: Start sweeps dead and oldest attempt cookies to keep the Cookie header bounded; pin the complete page's real form
Start deletes request attempt cookies that are no live attempt, then the live ones expiring first until the new attempt and the survivors fit 5120 bytes, so the newest attempt always completes and the header stays under nginx's 8 KB. Behavioural tests drive a cookie jar past the bound and read the served page's form fields and action through the test host.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-11 20:41:41 +02:00
Meta Vens
d695674359 Heimdall sign-in: redact the app secret from client logging, expire the attempt cookie at its path, bound the return path
- The HeimdallAuthService client redacts x-heimdall-app-secret from HTTP client logging at every level; a Trace canary test pins it.
- The attempt cookie's deletion carries its Path and no Max-Age (which outranks the 1970 expiry); pinned on success and refusal paths.
- LocalReturnPath is at most 256 characters, else /App, so the attempt cookie stays far below the browser limit; pinned at the bound and with the heaviest-escaping path.
- A set BaseUrl with a blank AppSlug is refused at Start before any Heimdall call; behavioural test.

Builds untested until the verification job at the end of this batch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 08:58:19 +02:00
Meta Vens
ad06e2ffd5 Heimdall completion route: no antiforgery opt-out (the form is read by hand); pin a malformed form body
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 04:43:45 +02:00
Meta Vens
5626532571 Heimdall sign-in: the start result carries the cookie name; fix a test string literal
The commit before this one did not compile (a split string literal in the tests).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 04:41:36 +02:00
Meta Vens
bad2117ea8 Heimdall sign-in: the attempt is a cookie, and a code the browser presents is redeemed at Heimdall
Start puts a per-attempt nonce in the returnTo it sends Heimdall and keeps the attempt (provider,
member flag, local return path, expiry) in a Data Protection cookie named for that nonce. Heimdall's
completion page sends the browser to /auth/heimdall/complete with a code in the URL fragment; the
page posts it back, Bifrost redeems it at Heimdall, requires the redeemed returnTo to name the
cookie's nonce, verifies the access token for the redeemed account, and signs that browser in.

Deleted: the callback route, the wait route, the server-side attempt store, the pending state and
the backend_callback handoff. Added: LocalReturnPath for return targets, Heimdall:AppSecret sent as
x-heimdall-app-secret (member starts are refused without it), a short timeout on the key fetch, and
a key lookup that does not hold the fetch gate for cached keys. Refusals at the completion route all
answer one redirect and log a fixed reason.

Tests are rewritten against a fake Heimdall with start and redeem routes. Not compile-checked by this
commit alone; later commits record the verification.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 04:40:47 +02:00
Meta Vens
e99eea8769 Heimdall token verifier: one process-wide instance owns the key cache
The verifier was registered as a typed client, which is transient, so each request
would have started with an empty key cache. It is now a singleton that takes its
HTTP client from the factory per fetch. Test hosts share one in-memory database
root so EF keeps a single service provider.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 02:55:35 +02:00
Meta Vens
f3b8acbbc5 Heimdall sign-in: accept only a Heimdall-signed token for an attempt Start issued, in the browser that started it
The callback verifies the EdDSA access token against Heimdall's JWKS and takes the
account, display name and member access from its claims; attempts expire, are
bounded, are completed only if issued, and are redeemed once with a per-attempt
binding cookie. Not yet built or tested; the first verification run follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 02:54:13 +02:00
Meta Vens
0c6f9216b6 Merge origin/main into hands/mill-votes-cut-5 2026-10-11 00:06:51 +02:00
Meta Vens
72741198fa Merge hands/mill-votes-cut-3: concept subject registration from the Mill manifest
Held by concept-mill-votes:verdict:cut-3.s2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 23:42:02 +02:00
Meta Vens
af3b712b26 VoterKeyResolver: the one reader and writer of the bifrost_voter device cookie
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 22:48:04 +02:00
Meta Vens
464da6bd50 Tally export: every response under the route varies by Origin
UseConceptTallyCors replaces UseCors and appends Vary: Origin to every
response under the export route, preflights and 404s included, keeping any
Vary already set. A single-origin ASP.NET policy never adds it itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 21:46:51 +02:00
Meta Vens
624cfd1567 Concept tally export and its CORS policy move out of Program.cs
One owner for the route and the policy, so Stryker can mutate them: it
flags every mutant of Program.cs as a compile error (safe mode), which
left the export untested by mutation. Program.cs keeps UseCors and the
two registration calls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 20:20:13 +02:00
Meta Vens
d13b808471 Public concept tally export with one-origin CORS
GET /public/concepts/{collection}/tallies returns per-live-subject up, down and
member counts only, anonymous, Cache-Control public max-age=60. CORS policy
ConceptTallies is built from ConceptVotes:AllowedOrigins, GET only, no
credentials, required on this route alone. Production startup refuses an
allowed origin that is not an exact https origin.

Not yet built or tested when committed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 19:59:51 +02:00
Meta Vens
b17436ce4f Concept subject registry and concepts plan|apply host command
ConceptSubjectRegistry is the only writer of ConceptSubject. ConceptKey is the
one key grammar (anchored with \z), shared with ConceptAppraisalService.
Not yet built or tested at this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 19:58:04 +02:00
Meta Vens
3c135b8e67 Concept votes: subjects, appraisals, voter identity, network tag and their one writer
ConceptAppraisalService is the only appraisal writer; tallies are derived from
rows. VoterIdentity.For decides voter key and class; NetworkPrefix is the only
prefix computation (HMAC tag). NetworkTagSecret is required in production.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 06:31:43 +02:00
Meta Vens
2e0de9601c Trust loopback forwarded headers and pin the Data Protection key ring
UseForwardedHeaders runs first with KnownProxies exactly loopback and
ForwardLimit 1; Data Protection always uses application name "Bifrost";
the startup validator refuses production without DataProtection:KeysPath.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 05:26:38 +02:00
Meta Vens
cde3a78874 Move public crossings onto typed Bifrost transport 2026-07-15 22:16:07 +01:00
Meta Vens
bd3a5a974b Add project-scoped patronage checkout 2026-07-05 19:07:48 +01:00
Meta Vens
23c02be2a6 Add native Bifrost identity registration 2026-06-22 15:07:22 +01:00
Meta Vens
861dff3ed7 Add Stripe patronage checkout integration 2026-06-22 14:08:35 +01:00
Meta Vens
f58a0cbc1b Validate runtime receipt linkage 2026-06-17 11:22:29 +01:00
Meta Vens
f702a708d9 Restrict runtime receipts to bridge token 2026-06-17 10:51:02 +01:00
Meta Vens
cab9d22f78 Receipt governance activity in Bifrost 2026-06-17 05:21:29 +01:00
Meta Vens
118a3efc74 Receipt agent transport lifecycle in Bifrost 2026-06-17 04:49:22 +01:00
Meta Vens
2281b0e63d Gate GitHub bridge actions and receipt agent runs 2026-06-17 04:03:14 +01:00
Meta Vens
7354d482e8 Start Eve governance surface migration 2026-06-09 20:27:46 +01:00
Meta Vens
bb1b1056be Add Heimdall patron support intake 2026-06-09 17:16:27 +01:00
Meta Vens
ba09539561 Add patron support derived voting tiers 2026-06-09 16:28:30 +01:00
Meta Vens
53b8f9a9ab Add Heimdall Discord Patreon access 2026-06-08 21:04:51 +01:00
Meta Vens
f1823c2a59 Containerize Bifrost deployment 2026-05-20 19:07:45 +01:00
Meta Vens
3fd655e1f2 Implement alpha foundation workflow and GitHub sync 2026-04-22 09:50:31 +01:00
Meta Vens
7cbdb93639 Initial Scaffold 2026-04-21 20:08:49 +01:00