carlos / platform Public

identity: one canonical contract for console, CLI and minting (H4-M11)

Fixes hunt finding H4-M11: step-up and owner checks folded addresses
case-insensitively, so a fold-equivalent identity could pass as the
owner. internal/identity is now the one contract (canonical form,
exact compare) for every console grant and check, the accounts CLI and
domain minting; stored rows are compared exactly, a legacy non-canonical
owner cannot mint, member -remove is exact, and an AST guard catches new
folding.
Review: Astra R1-R3 + final (Paul's last-round cuts applied), final
READY; census APPROVE (H4M11-final-astra); copy pass no changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Squashed from sec-h4-m11-stepup-fold into main.
claude agent, operated by paul@keymail.dev 1dee7c49e2e4da6c25e5f362f87d7fb0dbc1f43b parent b1dce46
42 files changed, +1,718 −152
  • accounts.go +24 −11
  • accounts_identity_test.go +73 −0
  • cmd/console/main.go +29 −0
  • cmd/console/member.go +18 −7
  • cmd/console/member_test.go +125 −2
  • docs/superpowers/notes/census-proposal-sec-h4-m11-stepup-fold.md +19 −0
  • internal/console/accountmint.go +67 −0
  • internal/console/alertwatch.go +7 −2
  • internal/console/apimail.go +5 −9
  • internal/console/apirelay.go +1 −6
  • internal/console/apistore.go +4 −8
  • internal/console/apistore_entitlement_test.go +3 −1
  • internal/console/apistore_test.go +3 −1
  • internal/console/apisystemupdate.go +3 −8
  • internal/console/demo_alerts.go +9 −2
  • internal/console/demo_claim_auth.go +7 −2
  • internal/console/demo_claim_browser_test.go +28 −0
  • internal/console/emailsignin.go +5 −3
  • internal/console/emailsignin_test.go +5 −1
  • internal/console/hunt_H4-M11_test.go +116 −0
  • internal/console/identity.go +67 −0
  • internal/console/identity_foldguard_test.go +548 −0
  • internal/console/identity_guard_test.go +229 −0
  • internal/console/invite_delivery_test.go +20 −1
  • internal/console/materialize.go +13 −5
  • internal/console/materialize_test.go +37 −0
  • internal/console/opperson.go +5 −2
  • internal/console/ownership.go +3 −1
  • internal/console/plangrace_cli_test.go +22 −0
  • internal/console/plangracepass.go +5 −2
  • internal/console/server.go +16 −53
  • internal/console/stepup.go +22 −1
  • internal/console/stepup_test.go +38 −0
  • internal/console/storenotify.go +10 −6
  • internal/console/storenotify_test.go +18 −1
  • internal/domains/mint.go +15 −11
  • internal/domains/mint_test.go +6 −3
  • internal/domains/reserved_test.go +3 −3
  • internal/identity/identity.go +52 −0
  • internal/identity/identity_test.go +30 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −0
  • internal/provision/testdata/plan14-root-reads-sec-h4-m11-stepup-fold.tsv +7 −0

CI passed — run details

CI log
=== gate ===
go: downloading go1.26.10 (linux/arm64)
go version go1.26.10 linux/arm64
opentofu: arm64, tofu 1.13.9, aws 6.73.0, archive 2.8.1
  tofu: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/tofu_1.13.9_linux_arm64.tar.gz
  tofu: downloaded, digest verified
  aws: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/terraform-provider-aws_6.73.0_linux_arm64.zip
  aws: downloaded, digest verified
  archive: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/terraform-provider-archive_2.8.1_linux_arm64.zip
  archive: downloaded, digest verified
  installed in /tmp/carlos-opentofu-boHxnj
.amadan/test-gate.sh
go: downloading github.com/aws/aws-sdk-go-v2 v1.44.0
go: downloading github.com/aws/aws-sdk-go-v2/service/costexplorer v1.67.5
go: downloading github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.68.0
go: downloading golang.org/x/crypto/x509roots/fallback v0.0.0-20260209214922-2f26647a795e
go: downloading golang.org/x/net v0.62.0
go: downloading modernc.org/sqlite v1.55.0
go: downloading golang.org/x/sys v0.49.0
go: downloading github.com/aws/aws-sdk-go-v2/config v1.32.6
go: downloading github.com/aws/aws-sdk-go-v2/service/sns v1.43.0
go: downloading golang.org/x/crypto v0.58.0
go: downloading github.com/aws/aws-sdk-go-v2/service/iam v1.58.2
go: downloading github.com/aws/aws-sdk-go-v2/service/sesv2 v1.66.6
go: downloading github.com/aws/aws-sdk-go-v2/service/sts v1.45.6
go: downloading github.com/aws/aws-sdk-go-v2/credentials v1.19.6
go: downloading github.com/pion/logging v0.2.4
go: downloading github.com/aws/aws-sdk-go-v2/service/acm v1.45.0
go: downloading github.com/aws/aws-sdk-go-v2/service/ec2 v1.324.0
go: downloading github.com/pion/turn/v4 v4.1.4
go: downloading github.com/pion/stun/v3 v3.1.5
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading github.com/lmittmann/tint v1.1.3
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash/v2 v2.3.0
go: downloading github.com/prometheus/client_model v0.5.0
go: downloading github.com/prometheus/common v0.45.0
go: downloading github.com/prometheus/procfs v0.12.0
go: downloading google.golang.org/protobuf v1.36.10
go: downloading github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.40
go: downloading github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.38
go: downloading github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.40
go: downloading golang.org/x/text v0.43.0
go: downloading github.com/klauspost/compress v1.20.2
go: downloading github.com/aws/aws-sdk-go-v2/service/signin v1.0.4
go: downloading github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4
go: downloading github.com/pion/transport/v4 v4.0.2
go: downloading github.com/pion/dtls/v3 v3.1.4
go: downloading github.com/pion/randutil v0.1.0
go: downloading github.com/wlynxg/anet v0.0.5
go: downloading github.com/klauspost/compress v1.20.2
go: downloading modernc.org/sqlite v1.55.0
go: downloading github.com/aws/aws-sdk-go-v2/service/ecs v1.91.0
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading github.com/wlynxg/anet v0.0.5
go: downloading modernc.org/libc v1.74.1
go: downloading modernc.org/libc v1.74.1
go: downloading github.com/google/uuid v1.6.0
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading modernc.org/memory v1.11.0
go: downloading modernc.org/mathutil v1.7.1
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading modernc.org/mathutil v1.7.1
=== launchctx (5 s, from +0 s)
ok  	amadan.net/carlos/platform.git/launchctx	0.016s
?   	amadan.net/carlos/platform.git/launchctx/controlname	[no test files]
?   	amadan.net/carlos/platform.git/launchctx/wireid	[no test files]
=== vet (174 s, from +0 s)
go: downloading modernc.org/sqlite v1.55.0
go: downloading github.com/klauspost/compress v1.20.2
go: downloading github.com/aws/aws-sdk-go-v2/service/ecs v1.91.0
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading github.com/wlynxg/anet v0.0.5
go: downloading modernc.org/libc v1.74.1
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading github.com/google/uuid v1.6.0
go: downloading modernc.org/mathutil v1.7.1
go: downloading modernc.org/memory v1.11.0
=== vet-tags (190 s, from +0 s)
go: downloading modernc.org/sqlite v1.55.0
go: downloading github.com/klauspost/compress v1.20.2
go: downloading github.com/aws/aws-sdk-go-v2/service/ecs v1.91.0
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading github.com/wlynxg/anet v0.0.5
go: downloading modernc.org/libc v1.74.1
go: downloading modernc.org/mathutil v1.7.1
=== gofmt (2 s, from +0 s)
gofmt -l .: clean
=== rest (386 s, from +15 s)
ok  	github.com/carlosframework/platform/cmd/carlos-media	120.708s
?   	github.com/carlosframework/platform/cmd/changelog	[no test files]
ok  	github.com/carlosframework/platform/cmd/console	207.884s
ok  	github.com/carlosframework/platform/cmd/mediaimage	39.971s
ok  	github.com/carlosframework/platform/cmd/moveprobe	14.348s
ok  	github.com/carlosframework/platform/cmd/pricebook-export	0.083s
ok  	github.com/carlosframework/platform/cmd/rootfswitness	0.189s
ok  	github.com/carlosframework/platform/cmd/runsc-assets	0.184s
ok  	github.com/carlosframework/platform/cmd/zddprobe	0.990s
ok  	github.com/carlosframework/platform/internal/agentsock	0.114s
ok  	github.com/carlosframework/platform/internal/alerting	0.033s
ok  	github.com/carlosframework/platform/internal/analytics	0.307s
ok  	github.com/carlosframework/platform/internal/appconfig	42.691s
ok  	github.com/carlosframework/platform/internal/apperr	0.513s
ok  	github.com/carlosframework/platform/internal/applog	3.971s
ok  	github.com/carlosframework/platform/internal/apppolicy	1.817s
ok  	github.com/carlosframework/platform/internal/assetcache	0.425s
ok  	github.com/carlosframework/platform/internal/awsinv	0.021s
ok  	github.com/carlosframework/platform/internal/awsmanaged	6.567s
ok  	github.com/carlosframework/platform/internal/awsregiongroup	0.281s
ok  	github.com/carlosframework/platform/internal/awsterminations	0.036s
ok  	github.com/carlosframework/platform/internal/backupswords	0.015s
ok  	github.com/carlosframework/platform/internal/billing	0.087s
ok  	github.com/carlosframework/platform/internal/billing/billingtest	0.081s
ok  	github.com/carlosframework/platform/internal/billingstripe	1.944s
ok  	github.com/carlosframework/platform/internal/boxchoice	0.034s
ok  	github.com/carlosframework/platform/internal/boxid	2.003s
?   	github.com/carlosframework/platform/internal/boxid/boxidtest	[no test files]
?   	github.com/carlosframework/platform/internal/boxid/internal/signtest	[no test files]
ok  	github.com/carlosframework/platform/internal/boxroles	0.018s
ok  	github.com/carlosframework/platform/internal/boxself	0.147s
ok  	github.com/carlosframework/platform/internal/boxvolumes	0.031s
ok  	github.com/carlosframework/platform/internal/caps	3.934s
ok  	github.com/carlosframework/platform/internal/certwarm	0.027s
ok  	github.com/carlosframework/platform/internal/cgroup	1.426s
ok  	github.com/carlosframework/platform/internal/changelog	3.930s
ok  	github.com/carlosframework/platform/internal/clamd	0.076s
?   	github.com/carlosframework/platform/internal/cliflag	[no test files]
ok  	github.com/carlosframework/platform/internal/clireg	0.020s
ok  	github.com/carlosframework/platform/internal/codehealth	16.394s
ok  	github.com/carlosframework/platform/internal/compute	0.013s
ok  	github.com/carlosframework/platform/internal/consolefleet	0.017s
?   	github.com/carlosframework/platform/internal/controlname	[no test files]
?   	github.com/carlosframework/platform/internal/controlsock	[no test files]
ok  	github.com/carlosframework/platform/internal/dbdoor	10.813s
ok  	github.com/carlosframework/platform/internal/dbdoor/dbdoortest	0.050s
ok  	github.com/carlosframework/platform/internal/dbquery	0.016s
ok  	github.com/carlosframework/platform/internal/dbreads	3.341s
?   	github.com/carlosframework/platform/internal/dbreads/dbreadstest	[no test files]
ok  	github.com/carlosframework/platform/internal/dbverify	0.044s
ok  	github.com/carlosframework/platform/internal/demo	0.008s
ok  	github.com/carlosframework/platform/internal/demobuild	4.200s
ok  	github.com/carlosframework/platform/internal/democlaim	0.467s
ok  	github.com/carlosframework/platform/internal/devbox	15.071s
ok  	github.com/carlosframework/platform/internal/dnsrec	0.011s
ok  	github.com/carlosframework/platform/internal/docsite	0.115s
ok  	github.com/carlosframework/platform/internal/domainreg	0.013s
ok  	github.com/carlosframework/platform/internal/domains	69.710s
ok  	github.com/carlosframework/platform/internal/doorkey	0.042s
ok  	github.com/carlosframework/platform/internal/economics	0.014s
ok  	github.com/carlosframework/platform/internal/edgefence	0.162s
ok  	github.com/carlosframework/platform/internal/edgeguard	0.227s
?   	github.com/carlosframework/platform/internal/edgeproof	[no test files]
ok  	github.com/carlosframework/platform/internal/edgesfile	0.086s
ok  	github.com/carlosframework/platform/internal/egressaddr	0.009s
ok  	github.com/carlosframework/platform/internal/execsandbox	101.642s
ok  	github.com/carlosframework/platform/internal/fileacl	0.010s
ok  	github.com/carlosframework/platform/internal/fleetapi	1.717s
ok  	github.com/carlosframework/platform/internal/fleetstore	0.005s
ok  	github.com/carlosframework/platform/internal/fxrate	0.026s
ok  	github.com/carlosframework/platform/internal/gate	4.419s
ok  	github.com/carlosframework/platform/internal/genselect	0.058s
ok  	github.com/carlosframework/platform/internal/geo	0.043s
ok  	github.com/carlosframework/platform/internal/geoip	0.099s
ok  	github.com/carlosframework/platform/internal/groupadmission	0.015s
ok  	github.com/carlosframework/platform/internal/grouprollaws	17.592s
ok  	github.com/carlosframework/platform/internal/hadeparture	0.027s
ok  	github.com/carlosframework/platform/internal/hafresh	0.011s
ok  	github.com/carlosframework/platform/internal/hairpin	0.214s
ok  	github.com/carlosframework/platform/internal/historyreadback	1.037s
ok  	github.com/carlosframework/platform/internal/hostactors	23.613s
ok  	github.com/carlosframework/platform/internal/hostbox	20.818s
ok  	github.com/carlosframework/platform/internal/hostclaim	2.688s
ok  	github.com/carlosframework/platform/internal/hostenv	0.076s
ok  	github.com/carlosframework/platform/internal/hostevidence	0.024s
ok  	github.com/carlosframework/platform/internal/hostexec	25.101s
ok  	github.com/carlosframework/platform/internal/hostfence	0.227s
ok  	github.com/carlosframework/platform/internal/hostfiles	27.363s
ok  	github.com/carlosframework/platform/internal/hostfloor	0.369s
ok  	github.com/carlosframework/platform/internal/hostguard	1.558s
ok  	github.com/carlosframework/platform/internal/hostops	7.308s
?   	github.com/carlosframework/platform/internal/hostops/fencerelease	[no test files]
ok  	github.com/carlosframework/platform/internal/hostops/internal/fencerelease	0.010s
ok  	github.com/carlosframework/platform/internal/hostquarantine	0.014s
ok  	github.com/carlosframework/platform/internal/hostrelocate	1.904s
ok  	github.com/carlosframework/platform/internal/hostresolve	0.513s
ok  	github.com/carlosframework/platform/internal/hostwrite	0.006s
ok  	github.com/carlosframework/platform/internal/identity	0.008s
ok  	github.com/carlosframework/platform/internal/infraview	0.017s
ok  	github.com/carlosframework/platform/internal/ingresshealth	0.007s
ok  	github.com/carlosframework/platform/internal/ingresshealth/awstg	0.012s
ok  	github.com/carlosframework/platform/internal/instancectl	67.775s
ok  	github.com/carlosframework/platform/internal/instanceexec	9.278s
ok  	github.com/carlosframework/platform/internal/instancefs	15.961s
ok  	github.com/carlosframework/platform/internal/instancekey	0.009s
ok  	github.com/carlosframework/platform/internal/instanceupdates	0.030s
ok  	github.com/carlosframework/platform/internal/interactive	0.640s
ok  	github.com/carlosframework/platform/internal/launchd	0.018s
ok  	github.com/carlosframework/platform/internal/layout	22.037s
ok  	github.com/carlosframework/platform/internal/layout/pubclass	95.107s
ok  	github.com/carlosframework/platform/internal/lbhealth	0.011s
ok  	github.com/carlosframework/platform/internal/lease	144.577s
ok  	github.com/carlosframework/platform/internal/lease/leasetest	1.238s
ok  	github.com/carlosframework/platform/internal/lease/locktest	0.015s
ok  	github.com/carlosframework/platform/internal/ledger	0.043s
ok  	github.com/carlosframework/platform/internal/mail	1.059s
ok  	github.com/carlosframework/platform/internal/mailer	0.832s
ok  	github.com/carlosframework/platform/internal/mailsubmit	1.446s
ok  	github.com/carlosframework/platform/internal/mailwire	0.012s
ok  	github.com/carlosframework/platform/internal/maintenance	0.222s
ok  	github.com/carlosframework/platform/internal/maintenanceexec	8.791s
ok  	github.com/carlosframework/platform/internal/maintenanceguard	0.282s
ok  	github.com/carlosframework/platform/internal/managedboot	2.949s
?   	github.com/carlosframework/platform/internal/managedboot/boottest	[no test files]
?   	github.com/carlosframework/platform/internal/managedboot/roottest	[no test files]
ok  	github.com/carlosframework/platform/internal/media	2.098s
ok  	github.com/carlosframework/platform/internal/media/mediatest	0.016s
ok  	github.com/carlosframework/platform/internal/mediaaws	62.625s
ok  	github.com/carlosframework/platform/internal/mediahandler	41.380s
ok  	github.com/carlosframework/platform/internal/mediajobs	1.013s
ok  	github.com/carlosframework/platform/internal/medialocal	9.991s
ok  	github.com/carlosframework/platform/internal/metrics	0.133s
ok  	github.com/carlosframework/platform/internal/minorunits	0.008s
ok  	github.com/carlosframework/platform/internal/moves	54.592s
ok  	github.com/carlosframework/platform/internal/moves/archive	2.647s
ok  	github.com/carlosframework/platform/internal/moves/offlinerun	0.083s
ok  	github.com/carlosframework/platform/internal/namedunits	0.036s
ok  	github.com/carlosframework/platform/internal/objstore	2.048s
ok  	github.com/carlosframework/platform/internal/ops	15.171s
ok  	github.com/carlosframework/platform/internal/pageindex	3.699s
ok  	github.com/carlosframework/platform/internal/parity	0.090s
?   	github.com/carlosframework/platform/internal/parity/cmd/parity-doc	[no test files]
ok  	github.com/carlosframework/platform/internal/park	0.456s
ok  	github.com/carlosframework/platform/internal/perf	0.185s
ok  	github.com/carlosframework/platform/internal/plans	0.086s
ok  	github.com/carlosframework/platform/internal/privatefile	0.013s
ok  	github.com/carlosframework/platform/internal/provision	234.980s
ok  	github.com/carlosframework/platform/internal/proxyproto	0.936s
ok  	github.com/carlosframework/platform/internal/publicrelease	0.049s
ok  	github.com/carlosframework/platform/internal/ratelimit	0.230s
ok  	github.com/carlosframework/platform/internal/regionlabel	0.052s
ok  	github.com/carlosframework/platform/internal/regionname	0.013s
ok  	github.com/carlosframework/platform/internal/registrar	0.014s
ok  	github.com/carlosframework/platform/internal/registrar/openprovider	0.609s
?   	github.com/carlosframework/platform/internal/registrar/registrartest	[no test files]
ok  	github.com/carlosframework/platform/internal/registry	83.610s
ok  	github.com/carlosframework/platform/internal/relay	7.694s
ok  	github.com/carlosframework/platform/internal/release	130.790s
?   	github.com/carlosframework/platform/internal/release/requestwitness	[no test files]
ok  	github.com/carlosframework/platform/internal/replicagen	0.039s
ok  	github.com/carlosframework/platform/internal/replicas	0.131s
ok  	github.com/carlosframework/platform/internal/reqrec	6.757s
ok  	github.com/carlosframework/platform/internal/rollout	10.787s
ok  	github.com/carlosframework/platform/internal/rolloutwords	0.037s
ok  	github.com/carlosframework/platform/internal/rootaws	95.270s
ok  	github.com/carlosframework/platform/internal/rootfsimage	1.294s
ok  	github.com/carlosframework/platform/internal/rootparticipation	0.116s
ok  	github.com/carlosframework/platform/internal/rootstate	0.073s
ok  	github.com/carlosframework/platform/internal/runs	1.005s
ok  	github.com/carlosframework/platform/internal/s3compat	0.063s
ok  	github.com/carlosframework/platform/internal/s3fake	1.725s
ok  	github.com/carlosframework/platform/internal/s3meter	0.439s
ok  	github.com/carlosframework/platform/internal/safefile	0.029s
ok  	github.com/carlosframework/platform/internal/schedule	22.350s
ok  	github.com/carlosframework/platform/internal/seeds	0.141s
ok  	github.com/carlosframework/platform/internal/share	0.020s
ok  	github.com/carlosframework/platform/internal/sim/litestreamfacts	4.860s
ok  	github.com/carlosframework/platform/internal/sim/mediajobs	50.981s
ok  	github.com/carlosframework/platform/internal/sim/regionha	22.097s
ok  	github.com/carlosframework/platform/internal/status	0.446s
ok  	github.com/carlosframework/platform/internal/steering	0.249s
ok  	github.com/carlosframework/platform/internal/stopevidence	0.578s
ok  	github.com/carlosframework/platform/internal/storecfg	0.410s
ok  	github.com/carlosframework/platform/internal/svcrole	0.014s
ok  	github.com/carlosframework/platform/internal/systemd	6.363s
?   	github.com/carlosframework/platform/internal/systemdshow	[no test files]
ok  	github.com/carlosframework/platform/internal/team	3.466s
ok  	github.com/carlosframework/platform/internal/teamcontract	0.176s
ok  	github.com/carlosframework/platform/internal/telemetry	0.020s
ok  	github.com/carlosframework/platform/internal/termfence	3.551s
ok  	github.com/carlosframework/platform/internal/timerspec	0.021s
ok  	github.com/carlosframework/platform/internal/tsidentity	4.206s
ok  	github.com/carlosframework/platform/internal/tunnelclient	0.371s
ok  	github.com/carlosframework/platform/internal/unixdial	0.010s
ok  	github.com/carlosframework/platform/internal/updatewords	0.044s
ok  	github.com/carlosframework/platform/internal/upstreamguard	0.023s
?   	github.com/carlosframework/platform/internal/upstreamguard/guardtest	[no test files]
ok  	github.com/carlosframework/platform/internal/usage	0.218s
ok  	github.com/carlosframework/platform/internal/version	0.006s
ok  	github.com/carlosframework/platform/internal/vet	2.808s
ok  	github.com/carlosframework/platform/internal/zonehost	0.017s
ok  	github.com/carlosframework/platform/internal/zonehost/route53zones	0.073s
?   	github.com/carlosframework/platform/internal/zonehost/zonehosttest	[no test files]
?   	github.com/carlosframework/platform/scripts/gitleaks-gate	[no test files]
ok  	github.com/carlosframework/platform/scripts/govulncheck-gate	0.046s
ok  	github.com/carlosframework/platform/scripts/pathmapcheck	0.099s
ok  	github.com/carlosframework/platform/scripts/region-ha-g2/fixture	5.171s
ok  	github.com/carlosframework/platform/scripts/stateless-replicas-drill	1.205s
ok  	github.com/carlosframework/platform/scripts/witness-pointer	0.026s
=== cutover-witness (162 s, from +15 s)
ok  	github.com/carlosframework/platform	3.758s
=== internal_grouproll@0 (275 s, from +74 s)
ok  	github.com/carlosframework/platform/internal/grouproll	273.129s
=== internal_grouproll@1 (279 s, from +74 s)
ok  	github.com/carlosframework/platform/internal/grouproll	277.617s
=== internal_activator@0 (152 s, from +150 s)
ok  	github.com/carlosframework/platform/internal/activator	147.104s
=== internal_activator@1 (136 s, from +150 s)
ok  	github.com/carlosframework/platform/internal/activator	132.419s
=== internal_activator@2 (135 s, from +150 s)
ok  	github.com/carlosframework/platform/internal/activator	130.223s
=== internal_activator@3 (181 s, from +150 s)
ok  	github.com/carlosframework/platform/internal/activator	176.346s
=== internal_edge@0 (197 s, from +172 s)
ok  	github.com/carlosframework/platform/internal/edge	187.820s
=== internal_edge@1 (143 s, from +172 s)
ok  	github.com/carlosframework/platform/internal/edge	134.681s
=== internal_edge@2 (152 s, from +172 s)
ok  	github.com/carlosframework/platform/internal/edge	141.671s
=== internal_edge@3 (220 s, from +172 s)
ok  	github.com/carlosframework/platform/internal/edge	211.913s
=== root@0 (139 s, from +179 s)
ok  	github.com/carlosframework/platform	129.255s
=== root@1 (109 s, from +179 s)
ok  	github.com/carlosframework/platform	98.677s
=== root@2 (120 s, from +179 s)
ok  	github.com/carlosframework/platform	110.214s
=== root@3 (114 s, from +179 s)
ok  	github.com/carlosframework/platform	103.412s
=== root@4 (106 s, from +179 s)
ok  	github.com/carlosframework/platform	95.668s
=== internal_host@0 (173 s, from +223 s)
ok  	github.com/carlosframework/platform/internal/host	167.973s
=== internal_host@1 (154 s, from +223 s)
ok  	github.com/carlosframework/platform/internal/host	148.841s
=== internal_host@2 (152 s, from +223 s)
ok  	github.com/carlosframework/platform/internal/host	147.543s
=== internal_host@3 (187 s, from +223 s)
ok  	github.com/carlosframework/platform/internal/host	181.839s
=== internal_host@4 (223 s, from +223 s)
ok  	github.com/carlosframework/platform/internal/host	218.515s
=== internal_host@5 (262 s, from +223 s)
ok  	github.com/carlosframework/platform/internal/host	256.831s
=== internal_console@0 (182 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	175.885s
=== internal_console@1 (202 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	196.388s
=== internal_console@2 (255 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	248.984s
=== internal_console@3 (247 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	241.599s
=== internal_console@4 (227 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	221.429s
=== internal_console@5 (224 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	217.005s
=== internal_console@6 (214 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	207.774s
=== internal_console@7 (226 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	219.599s
=== internal_console@8 (252 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	245.225s
=== internal_console@9 (241 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	235.432s
=== internal_console@10 (232 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	226.952s
=== internal_console@11 (275 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	268.453s
=== internal_console@12 (326 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	319.871s
=== internal_console@13 (219 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	213.913s
=== internal_console@14 (210 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	204.002s
=== internal_console@15 (224 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	217.172s
=== internal_console@16 (224 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	216.412s
=== internal_console@17 (218 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	210.790s
=== internal_console@18 (228 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	220.388s
=== internal_console@19 (211 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	203.883s
=== internal_console@20 (212 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	205.335s
=== internal_console@21 (238 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	231.067s
=== internal_console@22 (255 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	247.873s
=== internal_console@23 (279 s, from +231 s)
ok  	github.com/carlosframework/platform/internal/console	272.306s
=== lists: internal_console 230 s, internal_edge 171 s, internal_activator 149 s, internal_host 221 s, root 177 s, internal_grouproll 73 s
=== cpu: the gate used 13081 cpu-seconds in 557 s, about 23.5 of 32 cores; the machine as a whole was 78% busy
=== opentofu ===
opentofu: 40 test files in 11 suites, OpenTofu v1.13.9
  initialised in 13 s
  ok      14 s  infra/modules/box-fence-writer/tests/writer.tftest.hcl  Success! 1 passed, 0 failed.
  ok      17 s  infra/modules/deployment-buckets/tests/console_floors.tftest.hcl  Success! 1 passed, 0 failed.
  ok      31 s  infra/modules/deployment-buckets/tests/data_lifecycle.tftest.hcl  Success! 3 passed, 0 failed.
  ok      15 s  infra/modules/deployment-buckets/tests/db_reads.tftest.hcl  Success! 1 passed, 0 failed.
  ok      16 s  infra/modules/deployment-buckets/tests/evidence.tftest.hcl  Success! 1 passed, 0 failed.
  ok      27 s  infra/modules/deployment-buckets/tests/fence_writers.tftest.hcl  Success! 3 passed, 0 failed.
  ok      21 s  infra/modules/deployment-buckets/tests/media_results.tftest.hcl  Success! 2 passed, 0 failed.
  ok      27 s  infra/modules/deployment-buckets/tests/published_floors.tftest.hcl  Success! 3 passed, 0 failed.
  ok      80 s  infra/modules/media-engine/tests/media_engine.tftest.hcl  Success! 24 passed, 0 failed.
  ok      26 s  infra/modules/pdf-host/tests/computed.tftest.hcl  Success! 2 passed, 0 failed.
  ok      60 s  infra/modules/pdf-host/tests/pdf_host.tftest.hcl  Success! 24 passed, 0 failed.
  ok      44 s  infra/modules/region-group-operator-document/tests/document.tftest.hcl  Success! 12 passed, 0 failed.
  ok      21 s  infra/modules/region-host/ingress/tests/fixed-targets/tests/targets.tftest.hcl  Success! 2 passed, 0 failed.
  ok      61 s  infra/modules/region-host/ingress/tests/group_ingress.tftest.hcl  Success! 30 passed, 0 failed.
  ok      46 s  infra/modules/region-host/tests/alert_publish.tftest.hcl  Success! 18 passed, 0 failed.
  ok      40 s  infra/modules/region-host/tests/alerts_topic.tftest.hcl  Success! 16 passed, 0 failed.
  ok      11 s  infra/modules/region-host/tests/analytics_prune.tftest.hcl  Success! 2 passed, 0 failed.
  ok      16 s  infra/modules/region-host/tests/console_mail.tftest.hcl  Success! 4 passed, 0 failed.
  ok       7 s  infra/modules/region-host/tests/fixed_state_unchanged.tftest.hcl  Success! 1 passed, 0 failed.
  ok      73 s  infra/modules/region-host/tests/group.tftest.hcl  Success! 32 passed, 0 failed.
  ok      10 s  infra/modules/region-host/tests/group_alarms.tftest.hcl  Success! 4 passed, 0 failed.
  ok      10 s  infra/modules/region-host/tests/group_iam.tftest.hcl  Success! 4 passed, 0 failed.
  ok       5 s  infra/modules/region-host/tests/group_isolation.tftest.hcl  Success! 1 passed, 0 failed.
  ok      37 s  infra/modules/region-host/tests/group_operator.tftest.hcl  Success! 13 passed, 0 failed.
  ok       7 s  infra/modules/region-host/tests/group_user_data.tftest.hcl  Success! 3 passed, 0 failed.
  ok      31 s  infra/modules/region-host/tests/health_alarms.tftest.hcl  Success! 10 passed, 0 failed.
  ok      11 s  infra/modules/region-host/tests/ingress_drain_read.tftest.hcl  Success! 4 passed, 0 failed.
  ok       4 s  infra/modules/region-host/tests/instance_metadata.tftest.hcl  Success! 1 passed, 0 failed.
  ok      25 s  infra/modules/region-host/tests/mailer.tftest.hcl  Success! 6 passed, 0 failed.
  ok      14 s  infra/modules/region-host/tests/mailer_group.tftest.hcl  Success! 2 passed, 0 failed.
  ok      16 s  infra/modules/region-host/tests/managed_fleets/group_refusal.tftest.hcl  Success! 2 passed, 0 failed.
  ok     105 s  infra/modules/region-host/tests/managed_fleets/managed_fleets.tftest.hcl  Success! 46 passed, 0 failed.
  ok      70 s  infra/modules/region-host/tests/store_conversion.tftest.hcl  Success! 27 passed, 0 failed.
  ok      16 s  infra/modules/region-host/tests/store_scanning.tftest.hcl  Success! 4 passed, 0 failed.
  ok      30 s  infra/modules/region-host/tests/store_versioning.tftest.hcl  Success! 11 passed, 0 failed.
  ok      14 s  infra/modules/region-host/tests/store_write_credentials.tftest.hcl  Success! 4 passed, 0 failed.
  ok      16 s  infra/modules/region-host/tests/user_data_ignored.tftest.hcl  Success! 3 passed, 0 failed.
  ok       9 s  infra/modules/region-remote-host/tests/data_lifecycle.tftest.hcl  Success! 3 passed, 0 failed.
  ok      15 s  infra/modules/region-remote-host/tests/no_deployment_bucket.tftest.hcl  Success! 5 passed, 0 failed.
  ok      28 s  infra/modules/scanner-host/tests/scanner_host.tftest.hcl  Success! 14 passed, 0 failed.
opentofu: 40 files in 208 s
opentofu: PASS
=== cross ===
--- shard 0 of 5 ---
go version go1.26.10 linux/arm64
cross-compiling darwin/arm64
--- shard 1 of 5 ---
go version go1.26.10 linux/arm64
cross-compiling darwin/amd64
--- shard 2 of 5 ---
go version go1.26.10 linux/arm64
cross-compiling linux/arm64
linux/arm64 carlos binary: 66781346 bytes (ceiling 70000000)
--- shard 3 of 5 ---
go version go1.26.10 linux/arm64
cross-compiling windows/amd64
--- shard 4 of 5 ---
go version go1.26.10 linux/arm64
cross-compiling windows/arm64
=== minio-contract ===
go version go1.26.10 linux/arm64
minio contract: arm64, minio RELEASE.2025-09-07T16-13-09Z, mc RELEASE.2025-08-13T08-35-41Z
  minio: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/minio/minio.linux-arm64.RELEASE.2025-09-07T16-13-09Z
  minio: downloaded, digest verified
  mc: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/minio/mc.linux-arm64.RELEASE.2025-08-13T08-35-41Z
  mc: downloaded, digest verified
  minio healthy on 127.0.0.1:21490
Added `local` successfully.
Bucket created successfully `local/contract-bucket`.
Bucket created successfully `local/denied-bucket`.
Created policy `contract-only` successfully.
Added user `scopeduser` successfully.
Attached Policies: [contract-only]
To User: scopeduser
  buckets and scoped user ready
=== RUN   TestDeliveredContractMinio
=== RUN   TestDeliveredContractMinio/put
=== RUN   TestDeliveredContractMinio/get_round-trips_the_body
=== RUN   TestDeliveredContractMinio/list_shows_the_key
=== RUN   TestDeliveredContractMinio/head_and_list_agree_on_the_version
=== RUN   TestDeliveredContractMinio/the_app_cannot_tag_its_own_object
=== RUN   TestDeliveredContractMinio/the_app_cannot_tag_its_own_object/not_by_PutObjectTagging
=== RUN   TestDeliveredContractMinio/the_app_cannot_tag_its_own_object/and_not_by_x-amz-tagging_on_upload
=== RUN   TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route
=== RUN   TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/not_by_CreateMultipartUpload
=== RUN   TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/not_by_CopyObject_with_a_REPLACE_tagging_directive
=== RUN   TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/but_multipart_itself_is_allowed
=== RUN   TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/and_copy_itself_is_allowed
=== RUN   TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/a_POST-policy_forged_tag_with_a_matching_version_is_still_not_a_verdict
=== RUN   TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/and_an_ordinary_tagged-with-something-else_upload_is_allowed
=== RUN   TestDeliveredContractMinio/delete_removes_it
=== RUN   TestDeliveredContractMinio/cross-bucket_denial
--- PASS: TestDeliveredContractMinio (0.03s)
    --- PASS: TestDeliveredContractMinio/put (0.00s)
    --- PASS: TestDeliveredContractMinio/get_round-trips_the_body (0.00s)
    --- PASS: TestDeliveredContractMinio/list_shows_the_key (0.00s)
    --- PASS: TestDeliveredContractMinio/head_and_list_agree_on_the_version (0.00s)
    --- PASS: TestDeliveredContractMinio/the_app_cannot_tag_its_own_object (0.00s)
        --- PASS: TestDeliveredContractMinio/the_app_cannot_tag_its_own_object/not_by_PutObjectTagging (0.00s)
        --- PASS: TestDeliveredContractMinio/the_app_cannot_tag_its_own_object/and_not_by_x-amz-tagging_on_upload (0.00s)
    --- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route (0.01s)
        --- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/not_by_CreateMultipartUpload (0.00s)
        --- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/not_by_CopyObject_with_a_REPLACE_tagging_directive (0.00s)
        --- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/but_multipart_itself_is_allowed (0.00s)
        --- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/and_copy_itself_is_allowed (0.00s)
        --- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/a_POST-policy_forged_tag_with_a_matching_version_is_still_not_a_verdict (0.00s)
        --- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/and_an_ordinary_tagged-with-something-else_upload_is_allowed (0.00s)
    --- PASS: TestDeliveredContractMinio/delete_removes_it (0.00s)
    --- PASS: TestDeliveredContractMinio/cross-bucket_denial (0.00s)
PASS
ok  	github.com/carlosframework/platform/internal/objstore	0.036s
=== RUN   TestT4StorageProbeMinio
2026/11/30 22:42:25 moves: T4: STORE: list: operation error S3: ListObjectsV2, https response error StatusCode: 403, RequestID: 18ECF3EBC6D01D65, HostID: 90c5829a03ac376c8f5142152a4e49c6cf4c3f0b86b58ad594a8142a1420e118, api error SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your key and signing method.
--- PASS: TestT4StorageProbeMinio (0.01s)
PASS
ok  	github.com/carlosframework/platform/internal/host	0.044s
=== RUN   TestS3StoreMinioContract
=== RUN   TestS3StoreMinioContract/conditional_get_and_etag_listing
=== RUN   TestS3StoreMinioContract/bump_through_every_mutation_path
--- PASS: TestS3StoreMinioContract (0.04s)
    --- PASS: TestS3StoreMinioContract/conditional_get_and_etag_listing (0.01s)
    --- PASS: TestS3StoreMinioContract/bump_through_every_mutation_path (0.02s)
PASS
ok  	github.com/carlosframework/platform/internal/release	0.042s
Bucket created successfully `local/analytics-versions`.
local/analytics-versions versioning is enabled
Created policy `analytics-versions` successfully.
Added user `analyticsversions` successfully.
Attached Policies: [analytics-versions]
To User: analyticsversions
=== RUN   TestS3StoreMinioVersions
--- PASS: TestS3StoreMinioVersions (0.03s)
PASS
ok  	github.com/carlosframework/platform/internal/release	0.041s
Bucket created successfully `local/store-versioned`.
local/store-versioned versioning is enabled
Created policy `store-versioned` successfully.
Added user `storeversioned` successfully.
Attached Policies: [store-versioned]
To User: storeversioned
=== RUN   TestVersionedContractMinio
--- PASS: TestVersionedContractMinio (0.01s)
PASS
ok  	github.com/carlosframework/platform/internal/objstore	0.020s
Bucket created successfully `local/wc-bucket`.
Created policy `writer` successfully.
Added user `wcwriter` successfully.
Attached Policies: [writer]
To User: wcwriter
=== RUN   TestWriteCredentialContractMinio
=== RUN   TestWriteCredentialContractMinio/put_under_the_prefix
=== RUN   TestWriteCredentialContractMinio/multipart_under_the_prefix
=== RUN   TestWriteCredentialContractMinio/refused:_read_under_the_prefix
=== RUN   TestWriteCredentialContractMinio/refused:_read_elsewhere
=== RUN   TestWriteCredentialContractMinio/refused:_list_uploads
=== RUN   TestWriteCredentialContractMinio/refused:_put_tagged
=== RUN   TestWriteCredentialContractMinio/refused:_put_beside_the_prefix
=== RUN   TestWriteCredentialContractMinio/refused:_copy_from_the_store
=== RUN   TestWriteCredentialContractMinio/refused:_head
=== RUN   TestWriteCredentialContractMinio/refused:_list
=== RUN   TestWriteCredentialContractMinio/refused:_delete
=== RUN   TestWriteCredentialContractMinio/refused:_tag
=== RUN   TestWriteCredentialContractMinio/refused:_put_with_a_platform_tag
=== RUN   TestWriteCredentialContractMinio/refused:_put_outside_the_prefix
=== RUN   TestWriteCredentialContractMinio/refused:_put_to_another_bucket
=== RUN   TestWriteCredentialContractMinio/refused:_bucket_settings
--- PASS: TestWriteCredentialContractMinio (0.04s)
    --- PASS: TestWriteCredentialContractMinio/put_under_the_prefix (0.00s)
    --- PASS: TestWriteCredentialContractMinio/multipart_under_the_prefix (0.01s)
    --- PASS: TestWriteCredentialContractMinio/refused:_read_under_the_prefix (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_read_elsewhere (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_list_uploads (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_put_tagged (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_put_beside_the_prefix (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_copy_from_the_store (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_head (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_list (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_delete (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_tag (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_put_with_a_platform_tag (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_put_outside_the_prefix (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_put_to_another_bucket (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_bucket_settings (0.00s)
PASS
ok  	github.com/carlosframework/platform/internal/objstore	0.049s
=== RUN   TestEndToEndMinio
=== RUN   TestEndToEndMinio/plan
=== RUN   TestEndToEndMinio/roll
=== RUN   TestEndToEndMinio/replace
=== RUN   TestEndToEndMinio/remove
--- PASS: TestEndToEndMinio (0.46s)
    --- PASS: TestEndToEndMinio/plan (0.01s)
    --- PASS: TestEndToEndMinio/roll (0.12s)
    --- PASS: TestEndToEndMinio/replace (0.15s)
    --- PASS: TestEndToEndMinio/remove (0.15s)
PASS
ok  	github.com/carlosframework/platform/internal/grouproll	0.472s
Bucket created successfully `local/dbf-deploy`.
Bucket created successfully `local/dbf-data-ie`.
Bucket created successfully `local/dbf-data-uk`.
local/dbf-deploy versioning is enabled
Created policy `dbf-console` successfully.
Created policy `dbf-ukbox` successfully.
Added user `dbfconsole` successfully.
Added user `dbfukbox` successfully.
Attached Policies: [dbf-console]
To User: dbfconsole
Attached Policies: [dbf-ukbox]
To User: dbfukbox
=== RUN   TestDBForwardMinio
2026/11/30 22:42:33 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000000 txid.db=0000000000000001
2026/11/30 22:42:33 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000001 maxTXID=0000000000000001 size=720
2026/11/30 22:42:33 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000001 txid.db=0000000000000001
2026/11/30 22:42:33 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000001 txid.db=0000000000000002
2026/11/30 22:42:33 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000002 maxTXID=0000000000000002 size=370
2026/11/30 22:42:33 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000002 txid.db=0000000000000002
2026/11/30 22:42:33 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000002 txid.db=0000000000000003
2026/11/30 22:42:33 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000003 maxTXID=0000000000000003 size=454
2026/11/30 22:42:33 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000003 txid.db=0000000000000003
2026/11/30 22:42:33 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000000 txid.db=0000000000000001
2026/11/30 22:42:33 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000001 maxTXID=0000000000000001 size=720
2026/11/30 22:42:33 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000001 txid.db=0000000000000001
2026/11/30 22:42:34 console: CARLOS_SECRETS_PUBKEY is unset, so no region outside the home can be chosen automatically
2026/11/30 22:42:34 console: could not notify member@example.com of a CLI token issue: keymail: lookup member@example.com: keymail: GET /api/federation/lookup?addr=member%40example.com&from=console%40127.0.0.1%3A36995: could not determine target mailbox
    agent.go:136: dbreads: dbr_ggwxj7jbdiigz5tetzoedpuj5a: planned 3 files (1544 bytes) and restored to 3 in 13ms
    agent.go:136: dbreads: dbr_ggwxj7jbdiigz5tetzoedpuj5a: output 5 bytes in 1 confirmed chunks in 1ms
2026/11/30 22:42:35 console: db read dbr_ggwxj7jbdiigz5tetzoedpuj5a: relayed 1 chunks (102 bytes) in 1.005s, ended done
    agent.go:136: dbreads: dbr_fm62ztiz53ei2vexw4owax76tq: planned 1 files (720 bytes) and restored to 1 in 11ms
    agent.go:136: dbreads: dbr_fm62ztiz53ei2vexw4owax76tq: output 5 bytes in 1 confirmed chunks in 2ms
2026/11/30 22:42:36 console: db read dbr_fm62ztiz53ei2vexw4owax76tq: relayed 1 chunks (102 bytes) in 1.005s, ended done
    agent.go:136: dbreads: dbr_ofveckmon6lms5tqpvsh5wve6y: planned 3 files (1544 bytes) and held through 3 in 12ms
    agent.go:136: dbreads: dbr_ofveckmon6lms5tqpvsh5wve6y: output 1544 bytes in 1 confirmed chunks in 1ms
2026/11/30 22:42:37 console: db read dbr_ofveckmon6lms5tqpvsh5wve6y: relayed 1 chunks (1641 bytes) in 1.005s, ended done
=== RUN   TestDBForwardMinio/by_disconnect
=== NAME  TestDBForwardMinio
    agent.go:136: dbreads: dbr_vng57gpx4obpv7wxthrz6aby6u: planned 3 files (1544 bytes) and restored to 3 in 14ms
2026/11/30 22:42:37 console: db read dbr_vng57gpx4obpv7wxthrz6aby6u: relayed 0 chunks (0 bytes) in 31ms, ended client gone
    agent.go:136: dbreads: dbr_vng57gpx4obpv7wxthrz6aby6u: output 5 bytes in 1 confirmed chunks in 104ms
=== RUN   TestDBForwardMinio/by_timeout
=== NAME  TestDBForwardMinio
    agent.go:136: dbreads: dbr_lwawywppnblziqgmsbsfunqgju: planned 3 files (1544 bytes) and restored to 3 in 13ms
2026/11/30 22:42:57 console: db read dbr_lwawywppnblziqgmsbsfunqgju: relayed 0 chunks (0 bytes) in 19.559s, ended no-result
    agent.go:136: dbreads: dbr_lwawywppnblziqgmsbsfunqgju: output 5 bytes in 1 confirmed chunks in 19.536s
--- PASS: TestDBForwardMinio (23.26s)
    --- PASS: TestDBForwardMinio/by_disconnect (0.24s)
    --- PASS: TestDBForwardMinio/by_timeout (19.67s)
PASS
ok  	github.com/carlosframework/platform/internal/console	23.303s
Bucket created successfully `local/media-transfers`.
Bucket created successfully `local/media-transfer-results`.
local/media-transfer-results versioning is enabled
Created policy `media-transfers` successfully.
Added user `mediatransfers` successfully.
Attached Policies: [media-transfers]
To User: mediatransfers
=== RUN   TestMediaTransfersMinio
    upload.go:117: codec: the store already holds video.mp4
    upload.go:117: codec: the store already holds video.m3u8
    upload.go:117: codec: the store already holds poster.jpg
--- PASS: TestMediaTransfersMinio (0.07s)
PASS
ok  	github.com/carlosframework/platform/internal/mediaaws	0.075s
Bucket created successfully `local/media-local-store`.
Bucket created successfully `local/media-local-results`.
Created policy `media-local` successfully.
Added user `medialocal` successfully.
Attached Policies: [media-local]
To User: medialocal
=== RUN   TestLocalEndToEndMinio
--- PASS: TestLocalEndToEndMinio (0.55s)
PASS
ok  	github.com/carlosframework/platform/internal/medialocal	0.556s
=== RUN   TestHeldHandoverTwoBoxMinio
2026/11/30 22:43:02 edge: mesh key: minted
2026/11/30 22:43:02 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/30 22:43:02 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/30 22:43:02 tenant admission is open. accepting tenant work
2026/11/30 22:43:02 activator: HA placement host=shop-762b972d.example.test kind=Place ref=annie reason=roomiest generation=2026-11-30T22:43:02Z lock_generation=0
2026/11/30 22:43:02 lease: t8-762b972d/shop-762b972d.example.test: HA lease acquired in 4ms (first wake)
2026/11/30 22:43:02 activator: shop-762b972d.example.test: restored (no-marker): first wake, the prefix proven empty, booting fresh
2026/11/30 22:43:02 activator: shop-762b972d.example.test: started carlos-instance@shop\x2d762b972d.example.test.service memory.max=536870912 (build 0s, prepare (dirs 0s, admin token 0s, instance key 0s, env 7ms, control socket 0s, key gate 0s, logs 0s) 7ms, launch file 0s, gate 0s, root start 1ms)
2026/11/30 22:43:02 activator: shop-762b972d.example.test: carlos-instance@shop\x2d762b972d.example.test.service launched in 8ms, healthy 0s later
2026/11/30 22:43:02 activator: shop-762b972d.example.test: woke in 19ms: checks 0s, lease 5ms, restore 0s, identity 0s, protect 0s, spawn 8ms, replicate 5ms
2026/11/30 22:43:02 lease: t8-762b972d/plain-762b972d.example.test: acquired in 1ms (client 0s, lock read and write 1ms)
2026/11/30 22:43:02 activator: no replica for plain-762b972d.example.test in s3://contract-bucket/t8-762b972d/plain-762b972d.example.test — booting fresh
2026/11/30 22:43:02 activator: plain-762b972d.example.test: started carlos-instance@plain\x2d762b972d.example.test.service memory.max=536870912 (build 0s, prepare (dirs 0s, admin token 1ms, instance key 0s, env 4ms, control socket 0s, key gate 0s, logs 0s) 5ms, launch file 0s, gate 0s, root start 1ms)
2026/11/30 22:43:02 activator: plain-762b972d.example.test: carlos-instance@plain\x2d762b972d.example.test.service launched in 6ms, healthy 0s later
2026/11/30 22:43:02 activator: plain-762b972d.example.test: woke in 90ms: checks 0s, lease 1ms, restore 17ms, identity 0s, protect 0s, spawn 7ms, replicate 64ms
2026/11/30 22:43:02 lease: t8-762b972d/bot0.shop.bac.sidecar.internal: HA lease acquired in 4ms (first wake)
2026/11/30 22:43:02 activator: bot0.shop.bac.sidecar.internal: restored (no-marker): first wake, the prefix proven empty, booting fresh
2026/11/30 22:43:02 activator: bot0.shop.bac.sidecar.internal: woke in 19ms: checks 0s, lease 4ms, restore 0s, identity 0s, protect 0s, spawn 7ms, settle 0s, replicate 7ms
2026/11/30 22:43:02 activator: next-due probe plain-762b972d.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/30 22:43:02 activator: bot0.shop.bac.sidecar.internal: released with a marker (clean true, txid 1, files 3:4e9738bc7dd4d3398a2bcd5e67f6646e7962a009391d74d3009febbcbf37a626) in 6ms: files 1ms, sync 2ms, record 1ms, marker 2ms
2026/11/30 22:43:02 activator: bot0.shop.bac.sidecar.internal hibernated
2026/11/30 22:43:02 activator: next-due probe shop-762b972d.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/30 22:43:02 activator: plain-762b972d.example.test hibernated
2026/11/30 22:43:02 activator: shop-762b972d.example.test: released with a marker (clean true, txid 1, files 3:b229469b00eb65b0e18b7a15844ddc7119779368fe12bb421de6454009d13d87) in 7ms: files 1ms, sync 3ms, record 1ms, marker 2ms
2026/11/30 22:43:02 activator: shop-762b972d.example.test hibernated
2026/11/30 22:43:02 lease: t8-762b972d/shop-762b972d.example.test: HA lease acquired in 3ms (clean marker)
2026/11/30 22:43:02 activator: shop-762b972d.example.test: restored (other-box)
2026/11/30 22:43:02 activator: shop-762b972d.example.test: started carlos-instance@shop\x2d762b972d.example.test.service memory.max=536870912 (build 0s, prepare (dirs 0s, admin token 0s, instance key 0s, env 0s, control socket 0s, key gate 0s, logs 0s) 1ms, launch file 0s, gate 0s, root start 1ms)
2026/11/30 22:43:02 activator: shop-762b972d.example.test: carlos-instance@shop\x2d762b972d.example.test.service launched in 2ms, healthy 0s later
2026/11/30 22:43:02 activator: shop-762b972d.example.test: woke in 88ms: checks 0s, lease 4ms, restore 26ms, identity 0s, protect 0s, spawn 2ms, replicate 56ms
2026/11/30 22:43:02 edge: ha-take shop-762b972d.example.test from annie (txn t8-witness, marker generation 1): holder betty, generation 2
2026/11/30 22:43:02 edge: forward shop-762b972d.example.test: annie handed the request over to betty; sending it there (occurrence #1)
    hadrain_twobox_minio_linux_test.go:1238: drain report: {V:1 Transaction:t8-witness Incarnation:dceb93a3d286504e1c78b86c568fc2c4 Step:move Result:ok Reasons:[] Fence:t8-witness StartedAt:2026-11-30 22:43:02.482520175 +0000 UTC FinishedAt:2026-11-30 22:43:02.631278195 +0000 UTC Acked:[betty carol] Departed:[] Moved:[{Host:shop-762b972d.example.test Holder:betty Gen:2 Confirmed:take}] Released:[{Host:bot0.shop.bac.sidecar.internal Kind:worker Marker:true Clean:true Reason:} {Host:plain-762b972d.example.test Kind:other Marker:true Clean:true Reason:}] Unclean:[] Left:[] Holds:{LongestMS:119 Todays:0 RefusedAtOnce:1} Closed:0 Quiet:{DrainQuiet:{Waking:0 Stopping:0 Recovering:0 Owed:0} Held:[]}}
    hadrain_twobox_minio_linux_test.go:1239: driver calls: [begin shop-762b972d.example.test <nil> stop bot0.shop.bac.sidecar.internal marker=true clean=true <nil> releasing shop-762b972d.example.test <nil> stop plain-762b972d.example.test marker=true clean=true <nil> stop shop-762b972d.example.test marker=true clean=true <nil> taken shop-762b972d.example.test betty <nil> end-moves]
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/bot0.shop.bac.sidecar.internal/0001/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/bot0.shop.bac.sidecar.internal/0002/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/bot0.shop.bac.sidecar.internal/0003/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-762b972d/shop-762b972d.example.test/lock.json
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-762b972d/bot0.shop.bac.sidecar.internal/0009/0000000000000001-0000000000000001.ltx
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-762b972d/bot0.shop.bac.sidecar.internal/lock.json
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: DELETE /contract-bucket/t8-762b972d/plain-762b972d.example.test/lock.json
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-762b972d/shop-762b972d.example.test/0009/0000000000000001-0000000000000001.ltx
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-762b972d/shop-762b972d.example.test/lock.json
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-762b972d/shop-762b972d.example.test/lock.json
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-762b972d/shop-762b972d.example.test/lock.json
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-762b972d/shop-762b972d.example.test/head.json
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/generations/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0009/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0008/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0007/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0006/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0005/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0004/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0003/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0002/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0001/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0000/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0009/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0008/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0007/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0006/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0005/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0004/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0003/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0002/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0001/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0000/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-762b972d/shop-762b972d.example.test/0009/0000000000000001-0000000000000001.ltx
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-762b972d/shop-762b972d.example.test/files/0/manifest.json
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-762b972d/shop-762b972d.example.test/files/0/objects/0000000000000001-8426ac0e3019b0d862e75c0bb96e88d2452f3814f1161fb5f0d4b9f00afc472c
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-762b972d/shop-762b972d.example.test/files/0/objects/0000000000000003-624c99d5be073f0f0494af3754f0d422597b0be3b2829d603649f8dde4f34804
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0009/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0000/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0001/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-762b972d/shop-762b972d.example.test/0000/0000000000000001-0000000000000001.ltx
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0002/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0003/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0003/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0000/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-762b972d/shop-762b972d.example.test/0002/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-762b972d/shop-762b972d.example.test/0000/0000000000000002-0000000000000002.ltx
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-762b972d/shop-762b972d.example.test/lock.json
    hadrain_twobox_minio_linux_test.go:1243: drain took 201ms; S3 calls 48 (DELETE lock=1 GET files=3 GET head=1 GET lock=3 GET replica=2 LIST replica=32 PUT lock=3 PUT replica=3); deployment store calls 20 (GET edges=14 LIST edges=4 PUT edges=2)
    hadrain_twobox_minio_linux_test.go:1367: the fenced A's start gate answers 503 "This service is unavailable. Try again later.\n" (Retry-After "10")
2026/11/30 22:43:02 lease: t8-762b972d/plain-762b972d.example.test: acquired in 1ms (client 0s, lock read and write 1ms)
2026/11/30 22:43:02 activator: plain-762b972d.example.test: started carlos-instance@plain\x2d762b972d.example.test.service memory.max=536870912 (build 0s, prepare (dirs 0s, admin token 0s, instance key 0s, env 0s, control socket 0s, key gate 0s, logs 0s) 0s, launch file 0s, gate 0s, root start 1ms)
2026/11/30 22:43:02 activator: plain-762b972d.example.test: carlos-instance@plain\x2d762b972d.example.test.service launched in 1ms, healthy 0s later
2026/11/30 22:43:02 lease: /tmp/carlos-minio-contract-5liFNZ/g/dw3181039512/data/instances/plain-762b972d.example.test/plain-762b972d.example.test.db: continuity with the last clean close not proven; snapshot 1-0000000000000001 written before serving
2026/11/30 22:43:02 activator: plain-762b972d.example.test: woke in 11ms: checks 0s, lease 2ms, restore 0s, identity 0s, protect 1ms, spawn 2ms, replicate 7ms
2026/11/30 22:43:02 activator: next-due probe shop-762b972d.example.test: decode /api/next-due: invalid character 'b' looking for beginning of value — recording none (it sleeps until a request)
2026/11/30 22:43:02 activator: shop-762b972d.example.test: released with a marker (clean true, txid 2, files 3:b229469b00eb65b0e18b7a15844ddc7119779368fe12bb421de6454009d13d87) in 4ms: files 1ms, sync 0s, record 1ms, marker 2ms
2026/11/30 22:43:02 activator: shop-762b972d.example.test hibernated
2026/11/30 22:43:02 tenant admission is closed for shutdown
2026/11/30 22:43:02 activator: next-due probe plain-762b972d.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/30 22:43:02 activator: plain-762b972d.example.test hibernated
--- PASS: TestHeldHandoverTwoBoxMinio (0.57s)
=== RUN   TestHeldHandoverLostLeaseMinio
2026/11/30 22:43:02 edge: mesh key: minted
2026/11/30 22:43:02 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/30 22:43:02 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/30 22:43:02 tenant admission is open. accepting tenant work
2026/11/30 22:43:02 activator: HA placement host=shop-3981dded.example.test kind=Place ref=annie reason=roomiest generation=2026-11-30T22:43:02Z lock_generation=0
2026/11/30 22:43:02 lease: t8-3981dded/shop-3981dded.example.test: HA lease acquired in 3ms (first wake)
2026/11/30 22:43:02 activator: shop-3981dded.example.test: restored (no-marker): first wake, the prefix proven empty, booting fresh
2026/11/30 22:43:02 activator: shop-3981dded.example.test: started carlos-instance@shop\x2d3981dded.example.test.service memory.max=536870912 (build 0s, prepare (dirs 0s, admin token 0s, instance key 0s, env 5ms, control socket 0s, key gate 0s, logs 0s) 6ms, launch file 0s, gate 0s, root start 1ms)
2026/11/30 22:43:02 activator: shop-3981dded.example.test: carlos-instance@shop\x2d3981dded.example.test.service launched in 7ms, healthy 0s later
2026/11/30 22:43:02 activator: shop-3981dded.example.test: woke in 67ms: checks 0s, lease 4ms, restore 0s, identity 0s, protect 0s, spawn 7ms, replicate 55ms
2026/11/30 22:43:02 activator: next-due probe shop-3981dded.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/30 22:43:02 activator: final checkpoint shop-3981dded.example.test: lease: release marker owed for s3://contract-bucket/t8-3981dded/shop-3981dded.example.test/lock.json (If-Match "9d6e2fde0c7f8482de2bd46325008804"): lease: write release marker: operation error S3: PutObject, https response error StatusCode: 503, RequestID: , HostID: , api error ServiceUnavailable: witness: refused
2026/11/30 22:43:02 activator: shop-3981dded.example.test hibernated
2026/11/30 22:43:02 activator: handover of shop-3981dded.example.test left: released without a marker; its held requests get today's answer
    hadrain_twobox_minio_linux_test.go:1469: the held request's hold ended "shop-3981dded.example.test client 4 "
    hadrain_twobox_minio_linux_test.go:1486: driver calls: [begin shop-3981dded.example.test <nil> releasing shop-3981dded.example.test <nil> stop shop-3981dded.example.test marker=false clean=false <nil> left shop-3981dded.example.test released without a marker]
    hadrain_twobox_minio_linux_test.go:1487: a request after the loss: 503 "This instance cannot wake right now. Please try again shortly.\n" (Retry-After "10", holder "none", 0s, err <nil>)
2026/11/30 22:43:03 tenant admission is closed for shutdown
2026/11/30 22:43:03 http: proxy error: context canceled
--- PASS: TestHeldHandoverLostLeaseMinio (0.32s)
PASS
ok  	github.com/carlosframework/platform/internal/host	0.935s
Bucket created successfully `local/gen-take`.
local/gen-take versioning is enabled
Created policy `gen-take` successfully.
Added user `gentake` successfully.
Attached Policies: [gen-take]
To User: gentake
=== RUN   TestGenerationTakeMinio
=== RUN   TestGenerationTakeMinio/take
2026/11/30 22:43:04 lease: instances/gen-1796078584210723816.shop.example.com: HA lease acquired in 5ms (first wake)
2026/11/30 22:43:04 ERROR retention enforcement failed system=store db=w.example.com.db error="enforce snapshot retention: remove ltx files: lease: invalid or changed generation binding"
2026/11/30 22:43:04 lease: instances/gen-1796078584210723816.shop.example.com: HA lease acquired in 3ms (holder terminated)
    gentake_minio_test.go:308: a second create-only copy onto instances/gen-1796078584210723816.shop.example.com/g-00000000000000000002/0000/0000000000000001-0000000000000001.ltx: <nil> (destination condition honoured: false)
2026/11/30 22:43:04 ERROR retention enforcement failed system=store db=w.example.com.db error="enforce snapshot retention: remove ltx files: lease: invalid or changed generation binding"
=== RUN   TestGenerationTakeMinio/switch-412
2026/11/30 22:43:04 lease: instances/gen-1796078584397709769.shop.example.com: HA lease acquired in 3ms (first wake)
2026/11/30 22:43:04 ERROR retention enforcement failed system=store db=seed.db error="enforce snapshot retention: fetch ltx files: lease: a write has waited too long to reach storage (write fence)"
2026/11/30 22:43:04 lease: instances/gen-1796078584397709769.shop.example.com: HA lease acquired in 3ms (clean marker)
=== RUN   TestGenerationTakeMinio/copy-version
=== RUN   TestGenerationTakeMinio/store-time
2026/11/30 22:43:04 lease: instances/gen-1796078584446922211.shop.example.com: HA lease acquired in 3ms (first wake)
2026/11/30 22:43:04 ERROR retention enforcement failed system=store db=seed.db error="enforce snapshot retention: remove ltx files: lease: invalid or changed generation binding"
2026/11/30 22:43:04 lease: instances/gen-1796078584446922211.shop.example.com: HA lease acquired in 3ms (clean marker)
2026/11/30 22:43:04 lease: instances/gen-1796078584446922211.shop.example.com: HA lease acquired in 3ms (unclean marker)
2026/11/30 22:43:04 lease: instances/gen-1796078584446922211.shop.example.com: HA lease acquired in 3ms (unclean marker)
2026/11/30 22:43:04 lease: instances/gen-1796078584446922211.shop.example.com: HA lease acquired in 2ms (unclean marker)
2026/11/30 22:43:04 lease: instances/gen-1796078584446922211.shop.example.com: HA lease acquired in 3ms (unclean marker)
=== RUN   TestGenerationTakeMinio/skew
--- PASS: TestGenerationTakeMinio (0.41s)
    --- PASS: TestGenerationTakeMinio/take (0.19s)
    --- PASS: TestGenerationTakeMinio/switch-412 (0.04s)
    --- PASS: TestGenerationTakeMinio/copy-version (0.01s)
    --- PASS: TestGenerationTakeMinio/store-time (0.16s)
    --- PASS: TestGenerationTakeMinio/skew (0.01s)
PASS
ok  	github.com/carlosframework/platform/internal/lease	0.422s
minio contract: PASS
=== staticcheck ===
go version go1.26.10 linux/arm64
go: downloading honnef.co/go/tools v0.8.2
go: downloading github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c
go: downloading golang.org/x/exp/typeparams v0.0.0-20231108232855-2478ac86f678
go: downloading golang.org/x/sync v0.23.0
go: downloading golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
staticcheck: clean
=== govulncheck ===
go version go1.26.10 linux/arm64
go: downloading golang.org/x/vuln v1.8.0
go: downloading golang.org/x/telemetry v0.0.0-20260908163034-4bcc4b2ee518
go: downloading golang.org/x/tools v0.50.0
govulncheck: scanned github.com/carlosframework/platform, amadan.net/carlos/platform.git/launchctx, carlos-vulnscan
GO-2026-6859  called  stdlib@v1.26.10, fixed in v1.26.11
    HTTP/1 server crash due to MaxBytesReader header race in net/http
    excepted until 2027-01-31 (.amadan/govulncheck-exceptions.tsv:9): net/http MaxBytesReader header race, fixed in go1.26.11. CI and releases stay on go1.26.10 because 1.26.11 deadlocks the edge's Expect: 100-continue path (#897, .amadan/go-toolchain.sh); #904 checked every production MaxBytesReader site and found it unreachable.
GO-2026-5932  required  golang.org/x/crypto@v0.58.0, fixed in v0.58.1-0.20261009181718-2f1f834330b2
    The golang.org/x/crypto/openpgp package is unmaintained, unsafe by design, and has known security issues
    not fatal: no call path to the vulnerable code
govulncheck: clean (2 finding(s), none called outside .amadan/govulncheck-exceptions.tsv)
=== code-health ===
go version go1.26.10 linux/arm64
    codehealth_test.go:42: scanned in 1m52.004s
    codehealth_test.go:107: line metrics (code lines, then physical):
          file-lines  5471  7324  internal/activator activator_test.go
          file-lines  4160  6981  internal/console server.go
          file-lines  4120  6283  . apimode.go
          file-lines  3785  7224  internal/activator activator.go
          file-lines  3530  4459  . apimode_test.go
          file-lines  3261  3864  internal/registry registry_test.go
          file-lines  3175  6342  internal/host agent.go
          file-lines  3094  3992  internal/provision reconcile_test.go
          func-lines   870   891  internal/host plan14InstalledClaimLaunch
          func-lines   810  1277  internal/provision Reconcile
          func-lines   769  1242  internal/console (*Server).handleAPIInstanceCreate
          func-lines   683  1238  internal/host runAgent
          func-lines   571   908  internal/activator (*Service).doWakeOnce
          func-lines   538   546  internal/host runServingParkPeerNamespace
          func-lines   519   712  . runRoute
          func-lines   509   569  internal/host TestPagingIsRateLimited
          func-lines   494   817  internal/release adoptHost
          func-lines   441   500  internal/host TestRootInstanceStopExecStop
          func-lines   421   436  internal/host (*ClaimWakeAssembly).Build
          func-lines   421   437  internal/team TestFixture
          func-lines   412   414  internal/console TestDemoProtectionsSourceToLimitAndTakedown
          func-lines   408   485  . TestFleetAppServesThroughTheHub
          func-lines   402   406  internal/registry (*Registry).haJournal
          func-lines   400   868  internal/provision rootReadArchivedChain
          func-lines   399   733  internal/release PassFilter
          func-lines   390   398  internal/host runFilesSeedPreparationWithLive
          func-lines   383   406  internal/console TestDemoSourceToLiveAndUpdate
          func-lines   374   377  internal/host plan14RequiredArtifactsRootRunner
          func-lines   371   417  internal/host TestRootEgressKernelProof
          func-lines   369   883  internal/edge (*Edge).ServeHTTP
          func-lines   367   584  internal/console (*Server).handleAPIShip
          func-lines   364   371  internal/host testRootMigrationBootstrap
          func-lines   360   362  internal/edge TestDemoAPIAliasBoundary
          func-lines   358   628  cmd/console serve
          func-lines   357   358  internal/registry (*Registry).dispatchRemote
          func-lines   355   372  internal/host TestRootSandboxUpdateFromOldBox
          func-lines   343   354  internal/analytics Prune
          func-lines   340   353  internal/host newColdRootHarness
          func-lines   335   557  internal/console (*Store).migrate
          func-lines   334   334  internal/host TestPlan12RecoveryRestoreSourceDatabase
          func-lines   330   371  internal/edge TestRegionalNameNeverLeavesItsRegion
          func-lines   329   471  . runDeploy
          func-lines   329   329  internal/host TestPlan12RecoveryRestoreSourceDatabase.func1
          func-lines   327   369  internal/edge TestTunnelWebSocketEndToEnd
          func-lines   325   455  internal/objstore TestDeliveredContractMinio
          func-lines   320   654  internal/appconfig SyncExecWithCallbacks
          func-lines   315   318  internal/host plan14TimerIntention
          func-lines   311   314  internal/host plan14TimerIntention.func1
          func-lines   310   315  internal/hostbox ColdHandover.Run
          func-lines   308   309  internal/host rootFilesSeedIsolatedWitness
          func-lines   305   323  internal/host hairpinKernelWitness
          func-lines   304   308  internal/console TestHAP2ProductionDoors
          func-lines   302   329  internal/host TestRootG2PoolIngress
        release-importers: . cmd/console internal/activator internal/analytics internal/appconfig internal/apperr internal/applog internal/apppolicy internal/boxid internal/boxvolumes internal/console internal/dbreads internal/dbreads/dbreadstest internal/dbverify internal/demobuild internal/domains internal/doorkey internal/edge internal/edgeproof internal/edgesfile internal/fleetapi internal/grouproll internal/grouprollaws internal/historyreadback internal/host internal/hostactors internal/hostbox internal/hostclaim internal/hostevidence internal/hostexec internal/hostfence internal/hostfiles internal/hostfloor internal/hostguard internal/hostops internal/hostrelocate internal/hostresolve internal/instancectl internal/instanceupdates internal/interactive internal/layout internal/lease internal/ledger internal/mail internal/mailer internal/mailsubmit internal/metrics internal/moves internal/objstore internal/ops internal/park internal/plans internal/provision internal/relay internal/rollout internal/rootfsimage internal/runs internal/s3fake internal/schedule internal/seeds internal/status internal/telemetry internal/usage internal/vet scripts/pathmapcheck scripts/witness-pointer
        not scanned (216 files):
          cmd/carlos-media/drill_other.go: built only for other systems or tags
          cmd/carlos-media/harden_other.go: built only for other systems or tags
          cmd/console/fleetsocket_other.go: built only for other systems or tags
          cmd/console/servelock_windows.go: built only for other systems or tags
          cmd/moveprobe/detach_windows.go: built only for other systems or tags
          cmd/rootfswitness/mmap_other.go: built only for other systems or tags
          devbox_acl_other.go: built only for other systems or tags
          devbox_envfile_darwin_test.go: built only for other systems or tags
          devbox_envfile_other.go: built only for other systems or tags
          domains_transfer_signals_other.go: built only for other systems or tags
          interactive_term_darwin.go: built only for other systems or tags
          interactive_term_other.go: built only for other systems or tags
          internal/activator/claimprocess_root_other.go: built only for other systems or tags
          internal/activator/escrow_stamp_other.go: built only for other systems or tags
          internal/activator/fleetreserve_other.go: built only for other systems or tags
          internal/activator/harecord_other.go: built only for other systems or tags
          internal/activator/ownenv_other.go: built only for other systems or tags
          internal/activator/pty_other.go: built only for other systems or tags
          internal/activator/race_on_test.go: built only for other systems or tags
          internal/activator/rolelaunch_other.go: built only for other systems or tags
          internal/assetcache/statfs_other.go: built only for other systems or tags
          internal/boxself/io_other.go: built only for other systems or tags
          internal/cgroup/cleanup_other.go: built only for other systems or tags
          internal/cgroup/cleanup_other_test.go: built only for other systems or tags
          internal/cgroup/hostprocs_other.go: built only for other systems or tags
          internal/cgroup/recreate_other.go: built only for other systems or tags
          internal/cgroup/role_other.go: built only for other systems or tags
          internal/cgroup/shim_other.go: built only for other systems or tags
          internal/cgroup/strict_other.go: built only for other systems or tags
          internal/cgroup/verify_other.go: built only for other systems or tags
          internal/console/claim_sql_identity_other.go: built only for other systems or tags
          internal/console/geoipverify_other.go: built only for other systems or tags
          internal/console/hostreports_process_other.go: built only for other systems or tags
          internal/console/replicaview_other.go: built only for other systems or tags
          internal/console/restore_sim_nice_other_test.go: built only for other systems or tags
          internal/console/scalecost_other_test.go: built only for other systems or tags
          internal/console/seedscratch_windows.go: built only for other systems or tags
          internal/dbreads/worker_other.go: built only for other systems or tags
          internal/demobuild/security_other.go: built only for other systems or tags
          internal/democlaim/source_other.go: built only for other systems or tags
          internal/devbox/peer_darwin.go: built only for other systems or tags
          internal/devbox/peer_darwin_test.go: built only for other systems or tags
          internal/devbox/peer_other.go: built only for other systems or tags
          internal/devbox/socketcheck_other.go: built only for other systems or tags
          internal/domains/certimport_read_portable.go: built only for other systems or tags
          internal/edge/devboxpeer_other.go: built only for other systems or tags
          internal/edge/hairpin_other.go: built only for other systems or tags
          internal/edge/heldbudget_other.go: built only for other systems or tags
          internal/edge/purge_listen_unix.go: built only for other systems or tags
          internal/edge/purge_listen_windows.go: built only for other systems or tags
          internal/edge/race_on_test.go: built only for other systems or tags
          internal/edge/replicaconsole_owner_other.go: built only for other systems or tags
          internal/edge/replicaconsole_peer_other.go: built only for other systems or tags
          internal/edge/replicaconsole_socket_other_test.go: built only for other systems or tags
          internal/edge/static_artifact_other.go: built only for other systems or tags
          internal/edge/static_recordlock_other.go: built only for other systems or tags
          internal/edge/static_sweep_other.go: built only for other systems or tags
          internal/execsandbox/cleanup_other.go: built only for other systems or tags
          internal/execsandbox/file_other.go: built only for other systems or tags
          internal/execsandbox/oci_other.go: built only for other systems or tags
          internal/fileacl/fileacl_darwin.go: built only for other systems or tags
          internal/fileacl/fileacl_darwin_amd64.s: built only for other systems or tags
          internal/fileacl/fileacl_darwin_arm64.s: built only for other systems or tags
          internal/fileacl/fileacl_darwin_test.go: built only for other systems or tags
          internal/grouproll/state_other.go: built only for other systems or tags
          internal/grouprollaws/pty_darwin.go: built only for other systems or tags
          internal/grouprollaws/pty_other.go: built only for other systems or tags
          internal/hairpin/native_other.go: built only for other systems or tags
          internal/host/applylock_other_test.go: built only for other systems or tags
          internal/host/bootstrapfs_other.go: built only for other systems or tags
          internal/host/boxroles_config_other.go: built only for other systems or tags
          internal/host/claimfilesseed_delegation_other.go: built only for other systems or tags
          internal/host/claimfilesseed_transport_other.go: built only for other systems or tags
          internal/host/claimjournal_containment_other.go: built only for other systems or tags
          internal/host/claimjournal_migration_other.go: built only for other systems or tags
          internal/host/claimlaunch_kernel_other.go: built only for other systems or tags
          internal/host/claimlaunch_rev2_other_test.go: built only for other systems or tags
          internal/host/claimproduction_other.go: built only for other systems or tags
          internal/host/claimready_other.go: built only for other systems or tags
          internal/host/claimroleassembly_other.go: built only for other systems or tags
          internal/host/claimservingartifact_other.go: built only for other systems or tags
          internal/host/claimservinghandover_reboot_other.go: built only for other systems or tags
          internal/host/claimservinghandover_reboot_other_test.go: built only for other systems or tags
          internal/host/claimservingpark_other.go: built only for other systems or tags
          internal/host/claimstate_other.go: built only for other systems or tags
          internal/host/claimstop_kernel_other.go: built only for other systems or tags
          internal/host/claimtoken_inventory_other.go: built only for other systems or tags
          internal/host/claimunit_dropin_other.go: built only for other systems or tags
          internal/host/claimunit_files_other.go: built only for other systems or tags
          internal/host/claimunit_migrate_other.go: built only for other systems or tags
          internal/host/claimunit_ready_other.go: built only for other systems or tags
          internal/host/claimunit_socket_migration_other.go: built only for other systems or tags
          internal/host/consolefleet_owner_other.go: built only for other systems or tags
          internal/host/dbreads_other.go: built only for other systems or tags
          internal/host/egress_rail_other.go: built only for other systems or tags
          internal/host/fileowner_other.go: built only for other systems or tags
          internal/host/flock_windows.go: built only for other systems or tags
          internal/host/group_config_other.go: built only for other systems or tags
          internal/host/group_maintenance_other.go: built only for other systems or tags
          internal/host/group_maintenance_verbs_other.go: built only for other systems or tags
          internal/host/group_receipt_other.go: built only for other systems or tags
          internal/host/hadrain_call_other.go: built only for other systems or tags
          internal/host/hadrain_socket_other.go: built only for other systems or tags
          internal/host/hadrainfence_other.go: built only for other systems or tags
          internal/host/headroom_other.go: built only for other systems or tags
          internal/host/installchannel_other.go: built only for other systems or tags
          internal/host/managedboot_other.go: built only for other systems or tags
          internal/host/metrics_nested_other.go: built only for other systems or tags
          internal/host/movesfloor_other.go: built only for other systems or tags
          internal/host/movesfloorgate_other.go: built only for other systems or tags
          internal/host/movesheldrelease_other.go: built only for other systems or tags
          internal/host/movesmeasure_other.go: built only for other systems or tags
          internal/host/offcloudcredentials_other.go: built only for other systems or tags
          internal/host/registrychild_exec_other.go: built only for other systems or tags
          internal/host/registrychild_other.go: built only for other systems or tags
          internal/host/registryowner_chown_other.go: built only for other systems or tags
          internal/host/registryowner_descriptor_unix.go: built only for other systems or tags
          internal/host/replicahealth_other.go: built only for other systems or tags
          internal/host/rootgeneration_census_other.go: built only for other systems or tags
          internal/host/rootgeneration_kernel_other.go: built only for other systems or tags
          internal/host/rootgeneration_payload_other.go: built only for other systems or tags
          internal/host/rootgeneration_retired_other.go: built only for other systems or tags
          internal/host/rootmigration_production_other.go: built only for other systems or tags
          internal/host/runscset_other.go: built only for other systems or tags
          internal/host/sandboxenv_other.go: built only for other systems or tags
          internal/host/statfs_windows.go: built only for other systems or tags
          internal/host/systemapply_other.go: built only for other systems or tags
          internal/hostbox/census_vendor_other.go: built only for other systems or tags
          internal/hostbox/inventory_identity_other.go: built only for other systems or tags
          internal/hostbox/journalmigration_other.go: built only for other systems or tags
          internal/hostbox/journalnamespace_other.go: built only for other systems or tags
          internal/hostbox/journaltrust_other.go: built only for other systems or tags
          internal/hostbox/migration_census_other.go: built only for other systems or tags
          internal/hostbox/typedpark_other.go: built only for other systems or tags
          internal/hostenv/group_other.go: built only for other systems or tags
          internal/hostenv/write_other.go: built only for other systems or tags
          internal/hostenv/write_other_test.go: built only for other systems or tags
          internal/hostexec/clock_other.go: built only for other systems or tags
          internal/hostexec/clock_other_test.go: built only for other systems or tags
          internal/hostexec/local_other.go: built only for other systems or tags
          internal/hostexec/pending_other.go: built only for other systems or tags
          internal/hostexec/probe_other.go: built only for other systems or tags
          internal/hostexec/rootprocess_other.go: built only for other systems or tags
          internal/hostfiles/dir_other.go: built only for other systems or tags
          internal/hostfiles/refuse_other.go: built only for other systems or tags
          internal/hostfiles/watch_other.go: built only for other systems or tags
          internal/hostfloor/controllers_other.go: built only for other systems or tags
          internal/hostfloor/image_other.go: built only for other systems or tags
          internal/hostguard/flock_other.go: built only for other systems or tags
          internal/hostguard/flock_other_test.go: built only for other systems or tags
          internal/hostguard/record_other.go: built only for other systems or tags
          internal/instancectl/claimexec_other.go: built only for other systems or tags
          internal/instancectl/claimexec_socket_other.go: built only for other systems or tags
          internal/instancectl/claimlaunch_snapshot_other.go: built only for other systems or tags
          internal/instancectl/claimnetwork_other.go: built only for other systems or tags
          internal/instancectl/demo_snapshot_other.go: built only for other systems or tags
          internal/instancectl/egress_cgroup_other.go: built only for other systems or tags
          internal/instancectl/egress_dropin_other.go: built only for other systems or tags
          internal/instancectl/fleetsize_other.go: built only for other systems or tags
          internal/instancectl/gvisorprobe_other.go: built only for other systems or tags
          internal/instancectl/peer_other.go: built only for other systems or tags
          internal/instancectl/peer_tuple_other.go: built only for other systems or tags
          internal/instancectl/rootfs_identity_other.go: built only for other systems or tags
          internal/instanceexec/claimexec_other.go: built only for other systems or tags
          internal/instanceexec/exec_rootfs_other.go: built only for other systems or tags
          internal/instanceexec/netlink_route_other.go: built only for other systems or tags
          internal/instanceexec/probe_gvisor_other.go: built only for other systems or tags
          internal/instanceexec/probe_hardening_other.go: built only for other systems or tags
          internal/instanceexec/probe_other.go: built only for other systems or tags
          internal/instanceexec/probe_rootfs_other.go: built only for other systems or tags
          internal/instanceexec/sandbox_other.go: built only for other systems or tags
          internal/instanceexec/scope_other.go: built only for other systems or tags
          internal/instanceexec/stop_other.go: built only for other systems or tags
          internal/instanceexec/tty_other.go: built only for other systems or tags
          internal/instancefs/instancefs_other.go: built only for other systems or tags
          internal/launchd/activate_darwin.go: built only for other systems or tags
          internal/launchd/activate_darwin_amd64.s: built only for other systems or tags
          internal/launchd/activate_darwin_arm64.s: built only for other systems or tags
          internal/launchd/activate_darwin_test.go: built only for other systems or tags
          internal/layout/journal_other.go: built only for other systems or tags
          internal/layout/links_other.go: built only for other systems or tags
          internal/mailer/keys_other.go: built only for other systems or tags
          internal/maintenanceexec/run_other.go: built only for other systems or tags
          internal/managedboot/admission_other.go: built only for other systems or tags
          internal/managedboot/identity_other.go: built only for other systems or tags
          internal/mediahandler/collect_other.go: built only for other systems or tags
          internal/mediahandler/procs_other.go: built only for other systems or tags
          internal/medialocal/runner_other.go: built only for other systems or tags
          internal/moves/archive/open_other.go: built only for other systems or tags
          internal/moves/archive/sync_other.go: built only for other systems or tags
          internal/ops/flock_windows.go: built only for other systems or tags
          internal/park/local_other.go: built only for other systems or tags
          internal/privatefile/io_other.go: built only for other systems or tags
          internal/proxyproto/peek_other.go: built only for other systems or tags
          internal/relay/race_on_test.go: built only for other systems or tags
          internal/release/consumedfence_other.go: built only for other systems or tags
          internal/release/digestcache_other.go: built only for other systems or tags
          internal/rootaws/credentials_other.go: built only for other systems or tags
          internal/rootaws/open_darwin.go: built only for other systems or tags
          internal/rootfsimage/dir_other.go: built only for other systems or tags
          internal/rootstate/authoritydir_other.go: built only for other systems or tags
          internal/rootstate/authorityfile_other.go: built only for other systems or tags
          internal/rootstate/file_other.go: built only for other systems or tags
          internal/rootstate/link_other.go: built only for other systems or tags
          internal/rootstate/persistent_other.go: built only for other systems or tags
          internal/rootstate/state_other.go: built only for other systems or tags
          internal/safefile/file_other.go: built only for other systems or tags
          internal/safefile/reap_other.go: built only for other systems or tags
          internal/stopevidence/fds_other.go: built only for other systems or tags
          internal/stopevidence/fds_other_test.go: built only for other systems or tags
          internal/stopevidence/holders_other.go: built only for other systems or tags
          internal/stopevidence/reconstruct_other.go: built only for other systems or tags
          internal/team/storelock_other.go: built only for other systems or tags
          internal/team/storelock_windows.go: built only for other systems or tags
          move_offline_run_other.go: built only for other systems or tags
          system_group_other.go: built only for other systems or tags
        
    codehealth_test.go:115: fatal               1090 at  473 sites  log.Fatal*, (*log.Logger).Fatal* and os.Exit in the root package's production files
    codehealth_test.go:115: sleep               1006 at  812 sites  time.Sleep in test files
    codehealth_test.go:115: db-no-context        873 at  696 sites  database calls with no context (dbOpWithoutContext) in production files
    codehealth_test.go:115: host-context         188 at  142 sites  context.Background and context.TODO in internal/host production files
    codehealth_test.go:115: func-lines         18582 at   45 sites  functions over 300 code lines (blank and comment-only lines not counted)
    codehealth_test.go:115: file-lines         30596 at    8 sites  files over 3,000 code lines, counted the same way
    codehealth_test.go:115: release-importers     66 at    1 sites  packages whose production files import internal/release
    codehealth_test.go:119: below the record: func-lines cmd/console serve -: 358 in the code, the record allows 362 (make code-health-record lowers it)
    codehealth_test.go:119: below the record: file-lines . apimode.go -: 4120 in the code, the record allows 4147 (make code-health-record lowers it)
    codehealth_test.go:119: below the record: file-lines internal/console server.go -: 4160 in the code, the record allows 4191 (make code-health-record lowers it)
    codehealth_test.go:119: below the record: file-lines internal/host agent.go -: 3175 in the code, the record allows 3204 (make code-health-record lowers it)
--- PASS: TestCodeHealth (112.01s)
PASS
ok  	github.com/carlosframework/platform/internal/codehealth	113.021s
=== code-health-record ===
go version go1.26.10 linux/arm64
code-health record: HEAD is on main; comparing with its parent b1dce46b5ed7e6d28b58e84ca090b0d9a32f8c15
=== RUN   TestRecordAgainstBase
--- PASS: TestRecordAgainstBase (0.01s)
PASS
ok  	github.com/carlosframework/platform/internal/codehealth	0.008s
code-health record: no line went up without a reason
=== race ===
go version go1.26.10 linux/arm64
GATE_RACE=1 .amadan/test-gate.sh
=== internal_systemd@0 (14 s, from +13 s)
ok  	github.com/carlosframework/platform/internal/systemd	13.776s
=== internal_rootaws@0 (26 s, from +34 s)
ok  	github.com/carlosframework/platform/internal/rootaws	25.417s
=== internal_activator@0 (270 s, from +111 s)
ok  	github.com/carlosframework/platform/internal/activator	267.805s
=== internal_activator@1 (250 s, from +111 s)
ok  	github.com/carlosframework/platform/internal/activator	247.397s
=== internal_activator@2 (288 s, from +111 s)
ok  	github.com/carlosframework/platform/internal/activator	285.744s
=== internal_activator@3 (420 s, from +111 s)
ok  	github.com/carlosframework/platform/internal/activator	417.776s
=== internal_activator@4 (286 s, from +111 s)
ok  	github.com/carlosframework/platform/internal/activator	283.566s
=== internal_activator@5 (312 s, from +111 s)
ok  	github.com/carlosframework/platform/internal/activator	309.508s
=== internal_activator@6 (295 s, from +111 s)
ok  	github.com/carlosframework/platform/internal/activator	292.658s
=== internal_activator@7 (423 s, from +111 s)
ok  	github.com/carlosframework/platform/internal/activator	420.971s
=== internal_edge@0 (83 s, from +135 s)
ok  	github.com/carlosframework/platform/internal/edge	80.570s
=== internal_edge@1 (102 s, from +135 s)
ok  	github.com/carlosframework/platform/internal/edge	99.082s
=== internal_edge@2 (210 s, from +135 s)
ok  	github.com/carlosframework/platform/internal/edge	207.203s
=== internal_edge@3 (164 s, from +135 s)
ok  	github.com/carlosframework/platform/internal/edge	161.319s
=== internal_edge@4 (190 s, from +135 s)
ok  	github.com/carlosframework/platform/internal/edge	187.394s
=== internal_edge@5 (228 s, from +135 s)
ok  	github.com/carlosframework/platform/internal/edge	225.109s
=== internal_edge@6 (204 s, from +135 s)
ok  	github.com/carlosframework/platform/internal/edge	201.407s
=== internal_edge@7 (214 s, from +135 s)
ok  	github.com/carlosframework/platform/internal/edge	210.784s
=== internal_edge@8 (265 s, from +135 s)
ok  	github.com/carlosframework/platform/internal/edge	262.169s
=== internal_edge@9 (285 s, from +135 s)
ok  	github.com/carlosframework/platform/internal/edge	282.720s
=== internal_edge@10 (226 s, from +135 s)
ok  	github.com/carlosframework/platform/internal/edge	223.751s
=== internal_edge@11 (222 s, from +135 s)
ok  	github.com/carlosframework/platform/internal/edge	219.414s
=== internal_edge@12 (252 s, from +135 s)
ok  	github.com/carlosframework/platform/internal/edge	249.179s
=== internal_edge@13 (256 s, from +135 s)
ok  	github.com/carlosframework/platform/internal/edge	253.198s
=== internal_edge@14 (176 s, from +135 s)
ok  	github.com/carlosframework/platform/internal/edge	173.047s
=== internal_edge@15 (257 s, from +135 s)
ok  	github.com/carlosframework/platform/internal/edge	254.476s
=== internal_host@0 (16 s, from +195 s)
ok  	github.com/carlosframework/platform/internal/host	11.989s
=== internal_host@1 (9 s, from +195 s)
ok  	github.com/carlosframework/platform/internal/host	5.563s
=== lists: internal_edge 134 s, internal_activator 111 s, internal_host 194 s, internal_rootaws 33 s, internal_systemd 13 s
=== cpu: the gate used 7684 cpu-seconds in 534 s, about 14.4 of 32 cores; the machine as a whole was 44% busy
=== gitleaks ===
go version go1.26.10 linux/arm64
go: downloading github.com/zricethezav/gitleaks/v8 v8.30.1
go: downloading github.com/charmbracelet/lipgloss v0.5.0
go: downloading github.com/BobuSumisu/aho-corasick v1.0.3
go: downloading github.com/hashicorp/go-version v1.7.0
go: downloading github.com/spf13/cobra v1.9.1
go: downloading github.com/fatih/semgroup v1.2.0
go: downloading github.com/spf13/viper v1.19.0
go: downloading github.com/rs/zerolog v1.33.0
go: downloading golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa
go: downloading github.com/gitleaks/go-gitdiff v0.9.1
go: downloading github.com/h2non/filetype v1.1.3
go: downloading github.com/Masterminds/sprig/v3 v3.3.0
go: downloading github.com/mholt/archives v0.1.2
go: downloading github.com/huandu/xstrings v1.5.0
go: downloading github.com/spf13/cast v1.7.1
go: downloading github.com/Masterminds/goutils v1.1.1
go: downloading golang.org/x/crypto v0.35.0
go: downloading github.com/shopspring/decimal v1.4.0
go: downloading github.com/Masterminds/semver/v3 v3.3.0
go: downloading dario.cat/mergo v1.0.1
go: downloading github.com/mitchellh/copystructure v1.2.0
go: downloading github.com/spf13/pflag v1.0.6
go: downloading github.com/mattn/go-colorable v0.1.14
go: downloading github.com/mitchellh/reflectwalk v1.0.2
go: downloading golang.org/x/sys v0.30.0
go: downloading golang.org/x/sync v0.11.0
go: downloading github.com/muesli/termenv v0.15.1
go: downloading github.com/lucasb-eyer/go-colorful v1.2.0
go: downloading github.com/muesli/reflow v0.2.1-0.20210115123740-9e1d0d53df68
go: downloading github.com/mattn/go-runewidth v0.0.14
go: downloading github.com/spf13/afero v1.12.0
go: downloading github.com/mitchellh/mapstructure v1.5.0
go: downloading github.com/sagikazarmark/slog-shim v0.1.0
go: downloading github.com/fsnotify/fsnotify v1.8.0
go: downloading github.com/magiconair/properties v1.8.9
go: downloading gopkg.in/ini.v1 v1.67.0
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading github.com/hashicorp/hcl v1.0.0
go: downloading github.com/pelletier/go-toml/v2 v2.2.3
go: downloading github.com/subosito/gotenv v1.6.0
go: downloading github.com/klauspost/compress v1.17.11
go: downloading github.com/andybalholm/brotli v1.1.2-0.20250424173009-453214e765f3
go: downloading github.com/bodgit/sevenzip v1.6.0
go: downloading github.com/STARRY-S/zip v0.2.1
go: downloading github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707
go: downloading github.com/klauspost/pgzip v1.2.6
go: downloading github.com/minio/minlz v1.0.0
go: downloading github.com/nwaples/rardecode/v2 v2.1.0
go: downloading github.com/pierrec/lz4/v4 v4.1.21
go: downloading github.com/sorairolake/lzip-go v0.3.5
go: downloading github.com/therootcompany/xz v1.0.1
go: downloading github.com/ulikunitz/xz v0.5.12
go: downloading golang.org/x/text v0.22.0
go: downloading github.com/rivo/uniseg v0.2.0
go: downloading github.com/aymanbagabas/go-osc52/v2 v2.0.1
go: downloading github.com/bodgit/plumbing v1.3.0
go: downloading github.com/bodgit/windows v1.0.1
go: downloading github.com/hashicorp/go-multierror v1.1.1
go: downloading github.com/hashicorp/golang-lru/v2 v2.0.7
go: downloading go4.org v0.0.0-20230225012048-214862532bf5
go: downloading github.com/hashicorp/errwrap v1.1.0
self-test: reported source file: a key
self-test: reported source file: a 64-hex key
self-test: reported source file: a census-shaped entry
self-test: reported source file: a key marked gitleaks:allow
self-test: reported source file: a test's fake value outside tests
self-test: reported allowed file: another key beside its allowed value
self-test: reported a tracked file named gitleaks-gate-sentinel.env
self-test: reported 100 near misses of the names notscanned.go lists
self-test: skipped  the 33 files notscanned.go lists
self-test: refused  a notscanned.go entry git does not track
self-test: refused  a config that does not parse
self-test: refused  a config that does not exist
self-test: refused  a missing gitleaks binary
self-test: 6 planted keys reported, 134 tracked files judged, 3 broken setups refused
gitleaks: scanned 12130 tracked files; 33 not scanned, by exact path (scripts/gitleaks-gate/notscanned.go)
gitleaks: clean

landed from sec-h4-m11-stepup-fold

diff --git a/accounts.go b/accounts.go
index d7abaa661..78ad83913 100644
--- a/accounts.go
+++ b/accounts.go
@@ -26,6 +26,7 @@ import (
"github.com/carlosframework/platform/internal/clireg"
"github.com/carlosframework/platform/internal/domains"
+ "github.com/carlosframework/platform/internal/identity"
"github.com/carlosframework/platform/internal/registry"
"github.com/carlosframework/platform/internal/release"
)
@@ -95,7 +96,7 @@ func accountsCommand() *clireg.Node {
Name: "accounts",
Audience: cust,
Children: []*clireg.Node{
- raw("create", cust, runAccountsCreate),
+ rawErr("create", cust, runAccountsCreate),
raw("list", cust, runAccountsList),
raw("migrate", op, runAccountsMigrate),
raw("plan", op, runAccountsPlan),
@@ -113,7 +114,10 @@ func accountsCommand() *clireg.Node {
}
}
-func runAccountsCreate(args []string) {
+// runAccountsCreate returns the owner's validation error to the command
+// boundary (accountsCommand's OnError prints it as "accounts create: <error>"
+// and exits 1).
+func runAccountsCreate(args []string) error {
fs := flag.NewFlagSet("accounts create", flag.ExitOnError)
regPath := fs.String("registry", defaultRegistry(), "registry database")
name := fs.String("name", "", "account name (a-z, 0-9, hyphen; need not be unique)")
@@ -142,8 +146,7 @@ func runAccountsCreate(args []string) {
// an account FOR somebody else must not have their own address quietly
// substituted.
if addr := strings.TrimSpace(*owner); addr != "" {
- createAccountInBucket(*regPath, *name, addr)
- return
+ return createAccountInBucket(*regPath, *name, addr)
}
cred, credErr := loggedInCredential(*console)
if credErr != nil {
@@ -156,6 +159,7 @@ func runAccountsCreate(args []string) {
"(%v)", *name, credErr)
}
createAccountViaConsole(cred, *regPath, *name)
+ return nil
}
// createAccountInBucket is the original path, plus an owner: mint the id with
@@ -167,13 +171,21 @@ func runAccountsCreate(args []string) {
// cannot land on the same id — and the registry, which only ever materializes
// what the bucket says, never has to assign anything. The owner rides along in
// that same manifest, which is how the console learns who to admit.
-func createAccountInBucket(regPath, name, owner string) {
- // Normalize before anything is written OR printed. MintAccount normalizes
- // what it stores, so printing the raw input would tell the operator their
- // membership is "Paul@Keymail.dev" when the row — and the session that must
- // match it — is lowercase. That mismatch is exactly the confusion the
- // `console member` verb was fixed for.
- owner = domains.NormalizeAddress(owner)
+func createAccountInBucket(regPath, name, owner string) error {
+ // Canonicalise before anything is written OR printed. MintAccount stores
+ // the canonical form, so printing the raw input would tell the operator
+ // their membership is "Paul@Keymail.dev" when the row — and the session
+ // that must match it — is lowercase. That mismatch is exactly the
+ // confusion the `console member` verb was fixed for. An owner that cannot
+ // be canonical (non-ASCII, malformed) is refused here, before the mint,
+ // never lower-cased into somebody else's identity (internal/identity).
+ if strings.TrimSpace(owner) != "" {
+ canonical, ok := identity.Canonical(owner)
+ if !ok {
+ return fmt.Errorf("%q is not a keymail address: expected <user>@<host> in plain ASCII, e.g. paul@keymail.dev", owner)
+ }
+ owner = canonical
+ }
store := openStore()
id, sqid, err := domains.MintAccount(context.Background(), store, name, owner, time.Now())
if err != nil {
@@ -192,6 +204,7 @@ func createAccountInBucket(regPath, name, owner string) {
mutedf(os.Stdout, "use it with: carlos ship --account %s --app <app> ...\n", sqid)
fmt.Printf("%s becomes its owner in the console the next time the console materializes\n"+
"accounts from the bucket (on start, or on any `console member` command).\n", owner)
+ return nil
}
// createAccountViaConsole mints through the console this terminal is logged in
diff --git a/accounts_identity_test.go b/accounts_identity_test.go
new file mode 100644
index 000000000..57b939109
--- /dev/null
+++ b/accounts_identity_test.go
@@ -0,0 +1,73 @@
+package main
+
+import (
+ "os/exec"
+ "path/filepath"
+ "strings"
+ "testing"
+
+ "github.com/carlosframework/platform/internal/console"
+ "github.com/carlosframework/platform/internal/release"
+)
+
+// H4-M11 round 2: the whole minting path, through the real CLI. `carlos
+// accounts create --owner` writes the manifest and the console materialises
+// the owner membership from it. A mixed-case owner names the canonical
+// Keymail identity end to end; a Kelvin-sign or long-s owner is refused
+// BEFORE anything is written, so it can never become kim@ or sam@ in the
+// manifest and then in the console.
+func TestAccountsCreateOwnerFollowsTheIdentityContract(t *testing.T) {
+ bin := buildCarlos(t)
+ for _, tc := range []struct {
+ owner, want string // want "" means refused
+ }{
+ {" Kim@Keymail.dev ", "kim@keymail.dev"},
+ {"Kim@keymail.dev", ""},
+ {"ſam@keymail.dev", ""},
+ } {
+ t.Run(tc.owner, func(t *testing.T) {
+ tmp := t.TempDir()
+ storeDir := filepath.Join(tmp, "store")
+ cmd := exec.Command(bin, "accounts", "create", "-name", "kass", "-owner", tc.owner)
+ cmd.Env = carlosTestEnv(t,
+ "CARLOS_DEPLOYMENT_BUCKET=",
+ "AWS_PROFILE=",
+ "CARLOS_DEPLOYMENT_DIR="+storeDir,
+ "CARLOS_CREDENTIALS="+filepath.Join(tmp, "credentials"),
+ "CARLOS_DATA_DIR="+tmp,
+ "HOME="+tmp,
+ )
+ cmd.Dir = tmp
+ out, err := cmd.CombinedOutput()
+ store := release.NewDirStore(storeDir)
+ keys, lerr := store.List(t.Context(), "accounts/")
+ if tc.want == "" {
+ if err == nil {
+ t.Fatalf("create with owner %q succeeded:\n%s", tc.owner, out)
+ }
+ if !strings.Contains(string(out), "not a keymail address") {
+ t.Errorf("refusal does not say why:\n%s", out)
+ }
+ if lerr != nil || len(keys) != 0 {
+ t.Fatalf("a refused create left %v behind (%v)", keys, lerr)
+ }
+ return
+ }
+ if err != nil {
+ t.Fatalf("create: %v\n%s", err, out)
+ }
+ st, err := console.Open(filepath.Join(tmp, "console.db"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer st.Close()
+ if n, err := console.MaterializeAccounts(t.Context(), store, st); err != nil || n != 1 {
+ t.Fatalf("materialized %d (%v), want 1", n, err)
+ }
+ accts, err := st.AccountsFor(tc.want)
+ if err != nil || len(accts) != 1 || accts[0].Role != console.RoleOwner {
+ t.Fatalf("AccountsFor(%s) = %+v (%v), want the new account as owner", tc.want, accts, err)
+ }
+ })
+ }
+}
diff --git a/cmd/console/main.go b/cmd/console/main.go
index aea7a949b..39a7c5437 100644
--- a/cmd/console/main.go
+++ b/cmd/console/main.go
@@ -167,6 +167,7 @@ import (
"os/signal"
"path/filepath"
"regexp"
+ "slices"
"sort"
"strconv"
"strings"
@@ -186,6 +187,7 @@ import (
"github.com/carlosframework/platform/internal/fleetstore"
"github.com/carlosframework/platform/internal/geo"
"github.com/carlosframework/platform/internal/geoip"
+ "github.com/carlosframework/platform/internal/identity"
"github.com/carlosframework/platform/internal/lease"
"github.com/carlosframework/platform/internal/mail"
"github.com/carlosframework/platform/internal/moves"
@@ -222,6 +224,19 @@ func main() {
operator := fs.Bool("operator", false, "grant/revoke the fleet-operator role instead of an app")
fs.Parse(os.Args[2:])
args := fs.Args()
+ if len(args) >= 1 && verb == "grant" {
+ // The identity contract (internal/identity): a grant goes to
+ // exactly the identity a sign-in produces, or to nobody.
+ address, ok := identity.Canonical(args[0])
+ if !ok {
+ log.Fatalf("%q is not a keymail address: expected <user>@<host> in plain ASCII, e.g. paul@keymail.dev", args[0])
+ }
+ args[0] = address
+ }
+ // A revoke is NOT canonicalised: it acts on the exact stored row the
+ // operator names, so a legacy row (Sam@..., or a non-ASCII one) is
+ // revoked as itself and never confused with its lower-case twin. A
+ // revoke that matches no row refuses rather than reporting success.
st := openConsoleDB()
var err error
switch {
@@ -231,6 +246,13 @@ func main() {
if len(args) != 1 {
log.Fatalf("usage: console %s -operator <address>", verb)
}
+ if verb == "revoke" {
+ if held, herr := st.IsOperator(args[0]); herr != nil {
+ log.Fatal(herr)
+ } else if !held {
+ log.Fatalf("%q is not a fleet operator, so nothing was revoked. Name the address exactly as it is stored.", args[0])
+ }
+ }
err = st.SetOperator(args[0], verb == "grant")
default:
if len(args) != 2 {
@@ -239,6 +261,13 @@ func main() {
if verb == "grant" {
err = st.Grant(args[0], args[1])
} else {
+ apps, aerr := st.AppsFor(args[0])
+ if aerr != nil {
+ log.Fatal(aerr)
+ }
+ if !slices.Contains(apps, args[1]) {
+ log.Fatalf("%q does not hold %s, so nothing was revoked. Name the address exactly as it is stored.", args[0], args[1])
+ }
err = st.Revoke(args[0], args[1])
}
}
diff --git a/cmd/console/member.go b/cmd/console/member.go
index ffa007fa4..f288757b0 100644
--- a/cmd/console/member.go
+++ b/cmd/console/member.go
@@ -12,6 +12,7 @@ import (
"github.com/carlosframework/platform/internal/console"
"github.com/carlosframework/platform/internal/demo"
+ "github.com/carlosframework/platform/internal/identity"
)
// memberUsage is spelled out rather than left to flag.PrintDefaults because
@@ -59,7 +60,7 @@ func runMember(args []string) {
log.Fatalf("unknown role %q — there are exactly two: owner or member", *role)
}
- var address, sqid string
+ var address, exact, sqid string
switch {
case *list:
if len(pos) != 1 {
@@ -88,11 +89,21 @@ func runMember(args []string) {
// last-owner count, letting `member -remove` take away the only
// owner anybody can actually sign in as while the guard reports
// another still exists.
- address = strings.ToLower(strings.TrimSpace(typed))
- // Same shape check the sign-in form makes: a membership for an address
- // keymail could never authenticate is a grant nobody can claim, and a
- // silent typo here is a member who "was added" and cannot get in.
- if !console.ValidAddress(address) {
+ //
+ // The form is the platform's identity contract (identity.Canonical:
+ // ASCII-only, ASCII-lowercased, never Unicode-folded), so the row is
+ // exactly the identity a sign-in produces. Same refusal otherwise: a
+ // membership for an address keymail could never authenticate is a
+ // grant nobody can claim, and a silent typo here is a member who "was
+ // added" and cannot get in.
+ //
+ // Removal is the exception, below: it always acts on the exact
+ // address supplied, so a legacy Sam@... or non-ASCII row is removed as
+ // itself, and repeating the command can never reach a lower-case twin.
+ exact = strings.TrimSpace(typed)
+ var canonical bool
+ address, canonical = identity.Canonical(typed)
+ if !canonical && !*remove {
log.Fatalf("%q is not a keymail address — expected <user>@<host>, e.g. paul@keymail.dev", typed)
}
}
@@ -128,7 +139,7 @@ func runMember(args []string) {
case *add:
memberAdd(st, acct, address, *role)
case *remove:
- memberRemove(st, acct, address)
+ memberRemove(st, acct, exact)
}
}
diff --git a/cmd/console/member_test.go b/cmd/console/member_test.go
index 0d748c37d..338cbb887 100644
--- a/cmd/console/member_test.go
+++ b/cmd/console/member_test.go
@@ -181,12 +181,20 @@ func TestMemberVerbNormalizesTheAddress(t *testing.T) {
strings.Contains(out, "JAMES@keymail.dev") {
t.Errorf("member list shows an unnormalized address: %s", out)
}
- // Removal normalizes too, or the tool cannot undo what it just did.
+ // Removal takes the address exactly as stored (H4-M11): the row the
+ // verb wrote is james@keymail.dev, so that is the one it removes. A typed
+ // variant names a different principal and removes nothing.
if out, err := run("member", "-remove", "James@Keymail.dev", "bab"); err != nil {
+ t.Fatalf("member -remove (variant): %v\n%s", err, out)
+ }
+ if role := roleOf(t, dbPath, console.OpsAccountID, "james@keymail.dev"); role != console.RoleOwner {
+ t.Errorf("role after a case-variant removal = %q, want owner untouched", role)
+ }
+ if out, err := run("member", "-remove", "james@keymail.dev", "bab"); err != nil {
t.Fatalf("member -remove: %v\n%s", err, out)
}
if role := roleOf(t, dbPath, console.OpsAccountID, "james@keymail.dev"); role != "" {
- t.Errorf("role after case-variant removal = %q, want none", role)
+ t.Errorf("role after removal = %q, want none", role)
}
}
@@ -252,6 +260,10 @@ func TestMemberVerbRejectsBadArguments(t *testing.T) {
[]string{"nosuch", "accounts/nosuch/account.json", "carlos accounts create"}},
{"malformed address", []string{"member", "-add", "dev", "bab"},
[]string{"dev", "@"}},
+ // H4-M11: a Kelvin-sign address is refused, never lower-cased into
+ // the ASCII identity kim@keymail.dev.
+ {"non-ASCII address", []string{"member", "-add", "\u212aim@keymail.dev", "bab"},
+ []string{"not a keymail address"}},
{"unknown role", []string{"member", "-add", "dev@keymail.dev", "bab", "-role", "admin"},
[]string{"admin", "owner", "member"}},
{"no mode", []string{"member", "dev@keymail.dev", "bab"},
@@ -447,3 +459,114 @@ func TestMemberVerbMaterializesALateAccountSponsored(t *testing.T) {
t.Fatalf("the late account's plan row = %+v, %v; want the launch sponsorship", row, err)
}
}
+
+// H4-M11: `console grant -operator` grants the identity contract's canonical
+// form (console.CanonicalIdentity): a mixed-case entry is the lower-case
+// Keymail identity, and a fold twin is refused without touching anybody.
+func TestGrantOperatorIsCanonical(t *testing.T) {
+ bin := buildConsole(t)
+ dbPath := filepath.Join(t.TempDir(), "console.db")
+ run := runner(t, bin, "CONSOLE_DB="+dbPath)
+ if out, err := run("grant", "-operator", " Kim@Keymail.dev "); err != nil {
+ t.Fatalf("grant -operator: %v\n%s", err, out)
+ }
+ if out, err := run("grant", "-operator", "\u212aen@keymail.dev"); err == nil {
+ t.Fatalf("a Kelvin-sign operator grant succeeded: %s", out)
+ }
+ st, err := console.Open(dbPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer st.Close()
+ for addr, want := range map[string]bool{"kim@keymail.dev": true, "Kim@Keymail.dev": false, "ken@keymail.dev": false} {
+ if got, _ := st.IsOperator(addr); got != want {
+ t.Errorf("IsOperator(%s) = %v, want %v", addr, got, want)
+ }
+ }
+}
+
+// H4-M11 round 2: revoke acts on the EXACT stored row it names, never on a
+// canonicalised twin. Legacy rows (mixed case, non-ASCII) are revoked as
+// themselves, the twin is untouched, and a revoke that matches nothing
+// refuses rather than reporting success.
+func TestRevokeActsOnTheExactStoredRow(t *testing.T) {
+ bin := buildConsole(t)
+ dbPath := filepath.Join(t.TempDir(), "console.db")
+ run := runner(t, bin, "CONSOLE_DB="+dbPath)
+ st, err := console.Open(dbPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, a := range []string{"Sam@keymail.dev", "sam@keymail.dev", "ſue@keymail.dev"} {
+ if err := st.SetOperator(a, true); err != nil {
+ t.Fatal(err)
+ }
+ if err := st.Grant(a, "titogo"); err != nil {
+ t.Fatal(err)
+ }
+ }
+ st.Close()
+
+ for _, legacy := range []string{"Sam@keymail.dev", "ſue@keymail.dev"} {
+ if out, err := run("revoke", "-operator", legacy); err != nil {
+ t.Fatalf("revoke -operator %s: %v\n%s", legacy, err, out)
+ }
+ if out, err := run("revoke", legacy, "titogo"); err != nil {
+ t.Fatalf("revoke %s titogo: %v\n%s", legacy, err, out)
+ }
+ }
+ // Nothing left to revoke for Sam@: refused, not a silent success.
+ if out, err := run("revoke", "-operator", "Sam@keymail.dev"); err == nil || !strings.Contains(out, "nothing was revoked") {
+ t.Errorf("second revoke -operator Sam@ = %v:\n%s", err, out)
+ }
+ if out, err := run("revoke", "Sam@keymail.dev", "titogo"); err == nil || !strings.Contains(out, "nothing was revoked") {
+ t.Errorf("second app revoke Sam@ = %v:\n%s", err, out)
+ }
+
+ st, err = console.Open(dbPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer st.Close()
+ for addr, want := range map[string]bool{"Sam@keymail.dev": false, "ſue@keymail.dev": false, "sam@keymail.dev": true} {
+ if got, _ := st.IsOperator(addr); got != want {
+ t.Errorf("IsOperator(%s) = %v, want %v", addr, got, want)
+ }
+ apps, _ := st.AppsFor(addr)
+ if got := len(apps) == 1; got != want {
+ t.Errorf("AppsFor(%s) = %v, want held=%v", addr, apps, want)
+ }
+ }
+}
+
+// member -remove always takes the exact supplied address, so a legacy Sam@
+// membership is removed as itself, and REPEATING the command (now that Sam@
+// is gone) still never reaches the canonical sam@.
+func TestMemberRemoveTakesTheExactLegacyRow(t *testing.T) {
+ bin := buildConsole(t)
+ dbPath := filepath.Join(t.TempDir(), "console.db")
+ run := runner(t, bin, "CONSOLE_DB="+dbPath)
+ st, err := console.Open(dbPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := st.CreateAccount(console.OpsAccountID, "bab", "ops", "paul@keymail.dev", time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ for _, a := range []string{"Sam@keymail.dev", "sam@keymail.dev", "ſue@keymail.dev"} {
+ if err := st.AddMember(console.OpsAccountID, a, console.RoleMember, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ }
+ st.Close()
+ for _, legacy := range []string{"Sam@keymail.dev", "ſue@keymail.dev", "Sam@keymail.dev", "ſue@keymail.dev"} {
+ if out, err := run("member", "-remove", legacy, "bab"); err != nil {
+ t.Fatalf("member -remove %s: %v\n%s", legacy, err, out)
+ }
+ }
+ for addr, want := range map[string]string{"Sam@keymail.dev": "", "ſue@keymail.dev": "", "sam@keymail.dev": console.RoleMember} {
+ if got := roleOf(t, dbPath, console.OpsAccountID, addr); got != want {
+ t.Errorf("role of %s = %q, want %q", addr, got, want)
+ }
+ }
+}
diff --git a/docs/superpowers/notes/census-proposal-sec-h4-m11-stepup-fold.md b/docs/superpowers/notes/census-proposal-sec-h4-m11-stepup-fold.md
new file mode 100644
index 000000000..0d162ca6f
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-sec-h4-m11-stepup-fold.md
@@ -0,0 +1,19 @@
+# Census approval: sec-h4-m11-stepup-fold
+
+Ruling `census-ruling-sec-h4-m11-stepup-fold`. The independent reviewer approves or rejects every change below, 0 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+
+| unit | change | read sites | what changed |
+|---|---|---|---|
+| `accounts.go` `createAccountInBucket` | body | unchanged (1) | The --owner input goes through identity.Canonical (internal/identity) instead of domains.NormalizeAddress: same trim and ASCII lower-casing, but a non-ASCII, control-character or malformed owner is refused before the mint, so the Unicode lower-casing that turned a Kelvin-sign K into "k" is gone. The refusal is returned to the command boundary (rawErr; accountsCommand OnError prints and exits 1) instead of a new log.Fatalf. No read added; the bucket read/write sites are unchanged. |
+
+Envelopes re-pinned: `.`, `internal/domains`, `internal/identity`.
+
+Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner.
+
+Recorded dispositions, which each change must still satisfy:
+
+- `accounts.go` `createAccountInBucket`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input
+
+Seal: `4f307fb962a2aac71640ebc18058c02a29d6c7175b93ff1461317e37b94fca4b` → `13d05e2a4038ca4978d27a38be07e96025ee6f00f39519c41a3000e2dda3b387`.
+
+Overlay: `internal/provision/testdata/plan14-root-reads-sec-h4-m11-stepup-fold.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/console/accountmint.go b/internal/console/accountmint.go
new file mode 100644
index 000000000..f789a1113
--- /dev/null
+++ b/internal/console/accountmint.go
@@ -0,0 +1,67 @@
+package console
+
+import (
+ "context"
+ "fmt"
+ "log"
+ "time"
+
+ "github.com/carlosframework/platform/internal/domains"
+)
+
+// mintAccount creates an account owned by addr: the next free id allocated in
+// the bucket, its frozen sqid, and the console DB rows.
+//
+// The bucket write comes FIRST and is no longer best-effort, because it is now
+// the allocator: the id is claimed by a create-only manifest write, which is
+// what stops two boxes minting the same integer at the same moment. A console
+// row whose manifest never landed would be an account that vanishes on the
+// next rebuild — worse than a "new account" button that reports the outage.
+//
+// The name is NOT validated here: auto-mint names personal accounts by
+// keymail address, and landing must never refuse to mint (spec §1).
+func (s *Server) mintAccount(ctx context.Context, name, ownerAddr string) (*Account, error) {
+ // The owner is a STORED principal (a session's or token's address), so it
+ // is used exactly and never canonicalised (identity.go). A legacy
+ // non-canonical one (Sam@...) is refused here, before any bucket write:
+ // otherwise MintAccount would write sam@ into the manifest while the local
+ // membership said Sam@, and the next materialisation would hand the
+ // account to the lower-case twin. Past this check the manifest owner and
+ // the membership are the same exact string.
+ if !isCanonicalIdentity(ownerAddr) {
+ return nil, fmt.Errorf("console: %w: %q", errNonCanonicalOwner, ownerAddr)
+ }
+ now := time.Now()
+ id, sqid, err := domains.MintAccount(ctx, s.cfg.Releases, name, ownerAddr, now)
+ if err != nil {
+ return nil, err
+ }
+ // The default-on analytics setting is written after the manifest and
+ // before the membership is published, so an account that exists for its
+ // owner always has it. A failure is handled like a failed CreateAccount
+ // below: the account is stranded and the caller reports the outage.
+ if err := s.startNewAccountAnalytics(ctx, sqid); err != nil {
+ log.Printf("console: minted account %s (id %d, %q) into the bucket but could not turn analytics on: "+
+ "%v — accounts/%s/account.json is stranded with no owner", sqid, id, name, err, sqid)
+ return nil, err
+ }
+ if err := s.store.CreateAccount(id, sqid, name, ownerAddr, now); err != nil {
+ // The manifest already landed, so the id is claimed and there is now an
+ // account in the bucket with no console row and no owner. It is
+ // unreachable rather than dangerous (no membership means no access, and
+ // materialization gives it no members either), and the next mint simply
+ // takes the id after it. But without this line the only trace is a 500
+ // in the user's browser: name the sqid so the stranded account can be
+ // found and either adopted with `console member -add … -role owner` or
+ // deleted from the bucket.
+ log.Printf("console: minted account %s (id %d, %q) into the bucket but could not record it "+
+ "locally: %v — accounts/%s/account.json is stranded with no owner", sqid, id, name, err, sqid)
+ return nil, err
+ }
+ if err := s.store.SetLastAccount(ctx, ownerAddr, id); err != nil {
+ log.Printf("console: set last account for %s: %v", ownerAddr, err)
+ }
+ acct := &Account{ID: id, Sqid: sqid, Name: name, Role: RoleOwner, CreatedAt: now}
+ s.auditAccountCreated(acct, ownerAddr)
+ return acct, nil
+}
diff --git a/internal/console/alertwatch.go b/internal/console/alertwatch.go
index 9bfed2947..fa555ce9c 100644
--- a/internal/console/alertwatch.go
+++ b/internal/console/alertwatch.go
@@ -61,12 +61,17 @@ func (s *Server) alertRecipients() (*alertRun, error) {
// grantRecipients resolves canonical addresses to their own Keymail grants.
// Alert delivery and one-shot console notifications share this lookup so both
// keep the same missing-grant and per-recipient-token behaviour.
+//
+// The addresses are principals exactly as stored (operator rows, owners, the
+// By of a record) or already-canonicalised configuration: each is used AS IS.
+// One that is not canonical (a legacy Sam@... row) is skipped, never
+// lower-cased, because its lower-case twin is a different person who does not
+// hold the role that made this address a recipient (identity.go).
func (s *Server) grantRecipients(addrs []string) (*alertRun, error) {
run := &alertRun{}
seen := make(map[string]bool)
for _, addr := range addrs {
- addr = strings.ToLower(strings.TrimSpace(addr))
- if addr == "" || seen[addr] {
+ if !isCanonicalIdentity(addr) || seen[addr] {
continue
}
seen[addr] = true
diff --git a/internal/console/apimail.go b/internal/console/apimail.go
index 8034aad08..80a551db6 100644
--- a/internal/console/apimail.go
+++ b/internal/console/apimail.go
@@ -179,16 +179,12 @@ func (s *Server) mailSealKey(w http.ResponseWriter, ctx context.Context, acct *A
//
// Matches storeOperator's exact shape otherwise, including the reason it
// must NOT be strings.EqualFold (see that function's doc comment): the
-// address on a CLI token is already ASCII-lowercased at every entry point,
-// so the allowlist entry is folded the same way and never Unicode-folded,
-// which would let a long-s lookalike claim someone else's entry.
+// address on a CLI token is already canonical at every entry point, so the
+// allowlist entry is canonicalised the same way (identity.go) and never
+// Unicode-folded, which would let a long-s lookalike claim someone else's
+// entry.
func (s *Server) mailOperator(addr string) bool {
- for _, op := range s.cfg.MailOperators {
- if strings.ToLower(strings.TrimSpace(op)) == addr {
- return true
- }
- }
- return false
+ return identityListed(s.cfg.MailOperators, addr)
}
// mailPauseTarget resolves the pause door's {account}/{app} WITHOUT
diff --git a/internal/console/apirelay.go b/internal/console/apirelay.go
index 2eba9272e..27eb07b5f 100644
--- a/internal/console/apirelay.go
+++ b/internal/console/apirelay.go
@@ -720,12 +720,7 @@ func (s *Server) apiRelayOperator(w http.ResponseWriter, r *http.Request) (strin
// deployment's key material, not over spending its cloud bill, and a
// deployment may grant the two to different people.
func (s *Server) relayOperator(addr string) bool {
- for _, op := range s.cfg.RelayOperators {
- if strings.ToLower(strings.TrimSpace(op)) == addr {
- return true
- }
- }
- return false
+ return identityListed(s.cfg.RelayOperators, addr)
}
// handleAPIRelayRotate answers `carlos relay rotate --region <r>` (spec §5,
diff --git a/internal/console/apistore.go b/internal/console/apistore.go
index d8e4c03a4..045d2f6e5 100644
--- a/internal/console/apistore.go
+++ b/internal/console/apistore.go
@@ -699,8 +699,9 @@ const storeTeardownTimeout = 60 * time.Second
// EXACT MATCH ON THE CANONICAL FORM, never a fold. Every address entry point
// in this codebase ASCII-lowercases on the way in (sign-in, team-add, the
// materialize pass, `console member`), so the address on a CLI token is
-// already canonical; the list entry is lowercased and trimmed here so an
-// operator who typed Alice@Keymail.dev into a unit file still matches.
+// already canonical; the list entry goes through the same canonicalIdentity
+// (identity.go) so an operator who typed Alice@Keymail.dev into a unit file
+// still matches, and an entry that cannot be canonical matches nobody.
//
// strings.EqualFold would be the obvious way to write that and is WRONG for
// the highest-authority gate in the API: it applies Unicode simple folding, in
@@ -713,12 +714,7 @@ const storeTeardownTimeout = 60 * time.Second
// Empty list is fail-closed — the loop simply never matches — which is the
// right direction for a gate on spending.
func (s *Server) storeOperator(addr string) bool {
- for _, op := range s.cfg.StoreOperators {
- if strings.ToLower(strings.TrimSpace(op)) == addr {
- return true
- }
- }
- return false
+ return identityListed(s.cfg.StoreOperators, addr)
}
// storeWalkGates are the gates every store WALK door shares, after the caller
diff --git a/internal/console/apistore_entitlement_test.go b/internal/console/apistore_entitlement_test.go
index 41d8a14f2..05876c982 100644
--- a/internal/console/apistore_entitlement_test.go
+++ b/internal/console/apistore_entitlement_test.go
@@ -250,7 +250,9 @@ func TestAPIStoreOperatorMatchingIsExact(t *testing.T) {
t.Fatal(err)
}
fx.srv.cfg.StoreOperators = []string{"owner@example.test"}
- token := cliToken(t, fx, lookalike, "code-store-long-s")
+ // Keymail sign-in now refuses this address outright (identity.go, H4-M11);
+ // a legacy principal keeps the allowlist layer itself under test.
+ token := legacyCLIToken(t, fx, lookalike)
status, body := getRaw(t, entitlementApprovalsURL(fx), token)
if status != http.StatusNotFound || body != "404 page not found\n" {
diff --git a/internal/console/apistore_test.go b/internal/console/apistore_test.go
index 240e5db71..9ed55f48d 100644
--- a/internal/console/apistore_test.go
+++ b/internal/console/apistore_test.go
@@ -622,7 +622,9 @@ func TestAPIStoreGrantAllowlistDoesNotFold(t *testing.T) {
if err := fx.st.AddMember(OpsAccountID, homoglyph, RoleMember, time.Now()); err != nil {
t.Fatal(err)
}
- impostor := cliToken(t, fx, homoglyph, "code-store-grant-fold-imp")
+ // Keymail sign-in now refuses this address outright (identity.go, H4-M11);
+ // a legacy principal keeps the allowlist layer itself under test.
+ impostor := legacyCLIToken(t, fx, homoglyph)
// The member gate passes for this address — so a 403 below is the
// allowlist refusing, not the account resolution failing by accident.
diff --git a/internal/console/apisystemupdate.go b/internal/console/apisystemupdate.go
index 9ce38a945..763b64892 100644
--- a/internal/console/apisystemupdate.go
+++ b/internal/console/apisystemupdate.go
@@ -163,15 +163,10 @@ func (s *Server) apiSystemRoller(w http.ResponseWriter, r *http.Request) (addr s
// systemOperator reports whether addr is on SystemOperators. It is
// relayOperator's exact-match rule (apirelay.go): the configured entry is
-// trimmed and lowercased, the signed-in address is compared as it is, and
-// never with EqualFold, whose Unicode folding admits homoglyphs.
+// canonicalised (identity.go), the signed-in address is compared as it is,
+// and never with EqualFold, whose Unicode folding admits homoglyphs.
func (s *Server) systemOperator(addr string) bool {
- for _, op := range s.cfg.SystemOperators {
- if strings.ToLower(strings.TrimSpace(op)) == addr {
- return true
- }
- }
- return false
+ return identityListed(s.cfg.SystemOperators, addr)
}
// auditSystem records an operator's platform action against the OPS account.
diff --git a/internal/console/demo_alerts.go b/internal/console/demo_alerts.go
index c24396bbc..7c46088e7 100644
--- a/internal/console/demo_alerts.go
+++ b/internal/console/demo_alerts.go
@@ -6,7 +6,6 @@ import (
"encoding/json"
"errors"
"fmt"
- "slices"
"strconv"
"strings"
"time"
@@ -147,7 +146,15 @@ func (s *Server) demoAlertRecipients() (*alertRun, error) {
if err != nil {
return nil, err
}
- addrs := slices.Clone(s.cfg.SystemOperators)
+ // Configured entries are typed input, canonicalised as identityListed
+ // does; stored owners are used exactly (grantRecipients skips one that is
+ // not canonical).
+ var addrs []string
+ for _, entry := range s.cfg.SystemOperators {
+ if c, ok := canonicalIdentity(entry); ok {
+ addrs = append(addrs, c)
+ }
+ }
for _, member := range members {
if member.Role == RoleOwner {
addrs = append(addrs, member.Name)
diff --git a/internal/console/demo_claim_auth.go b/internal/console/demo_claim_auth.go
index d261c0250..d6d7de1f9 100644
--- a/internal/console/demo_claim_auth.go
+++ b/internal/console/demo_claim_auth.go
@@ -286,8 +286,13 @@ func (s *Server) proveDemoClaim(ctx context.Context, flow claimFlow, method, add
if !s.demoClaimEnabled() {
return claimFlow{}, ErrDemoToken
}
- addr, ok := canonicalAddress(address)
- if !ok || (method != MethodEmail && method != MethodKeymail) {
+ // The proved subject is used exactly as proved (identity.go): a
+ // non-canonical one is refused, never lower-cased into another person.
+ // Email proofs are canonical already (the challenge was made from
+ // canonicalAddress), and Keymail's are canonical when its KEYMAIL_HOST
+ // is lowercase ASCII (a deployment prerequisite).
+ addr := address
+ if !isCanonicalIdentity(addr) || (method != MethodEmail && method != MethodKeymail) {
return claimFlow{}, ErrDemoToken
}
mu := s.flowLock(flow.Hash)
diff --git a/internal/console/demo_claim_browser_test.go b/internal/console/demo_claim_browser_test.go
index 693a0edde..70d3ea1a3 100644
--- a/internal/console/demo_claim_browser_test.go
+++ b/internal/console/demo_claim_browser_test.go
@@ -525,3 +525,31 @@ func TestDemoClaimBrowserDoorsCSRF(t *testing.T) {
t.Fatal("CSRF started claim")
}
}
+
+// H4-M11 review round 1: proof is used exactly as proved. A (legacy)
+// mixed-case Keymail session's claim is refused, and is never lower-cased into
+// the person sam@ — no row for that twin, and the flow stays unproved.
+func TestDemoClaimBrowserRefusesANonCanonicalKeymailProof(t *testing.T) {
+ s, _, token := claimTestServer(t)
+ b := newClaimBrowser(t, s, token)
+ b.login("Sam@example.com", MethodKeymail, true)
+ a := claimAccount(t, s, 501, "Sam@example.com", RoleOwner)
+ w := b.post("/demo/claim/select", url.Values{"accountId": {a.Sqid}})
+ if w.Code == http.StatusSeeOther {
+ t.Fatalf("a non-canonical Keymail proof claimed the demo: %d", w.Code)
+ }
+ var n int
+ if err := s.store.db.QueryRow(`SELECT COUNT(*) FROM users WHERE address = 'sam@example.com'`).Scan(&n); err != nil {
+ t.Fatal(err)
+ }
+ if n != 0 {
+ t.Fatal("the proof was lower-cased into the person sam@example.com")
+ }
+ var person string
+ if err := s.store.db.QueryRow(`SELECT person FROM demo_claim_flows`).Scan(&person); err != nil {
+ t.Fatal(err)
+ }
+ if person != "" {
+ t.Fatalf("flow proved for %q", person)
+ }
+}
diff --git a/internal/console/emailsignin.go b/internal/console/emailsignin.go
index a0834c56c..2dea7de44 100644
--- a/internal/console/emailsignin.go
+++ b/internal/console/emailsignin.go
@@ -86,10 +86,12 @@ func (s *Server) sameOrigin(r *http.Request) bool {
// canonicalAddress is the one form of a typed address used everywhere after
// the front door (spec 11): trimmed and lower-cased, and accepted only when it
// is a bare address, so display-name and list forms are refused before any
-// challenge, rate-limit key or user row exists.
+// challenge, rate-limit key or user row exists. The identity form itself is
+// canonicalIdentity's (identity.go); this adds only the mail-header shape
+// check, because every caller sends mail to the result.
func canonicalAddress(raw string) (string, bool) {
- a := strings.ToLower(strings.TrimSpace(raw))
- if !ValidAddress(a) {
+ a, ok := canonicalIdentity(raw)
+ if !ok {
return "", false
}
if parsed, err := netmail.ParseAddress(a); err != nil || parsed.Address != a {
diff --git a/internal/console/emailsignin_test.go b/internal/console/emailsignin_test.go
index 2468b9639..e143f799c 100644
--- a/internal/console/emailsignin_test.go
+++ b/internal/console/emailsignin_test.go
@@ -387,7 +387,7 @@ func TestContinueNormalises(t *testing.T) {
checkEmailSent(t, fx, m, c, "bob@example.com", "", status, body)
fx2, m2 := newEmailFixture(t, true)
- for _, bad := range []string{"a<victim@example.com>", "a@x.com,b@y.com", "", "nobody"} {
+ for _, bad := range []string{"a<victim@example.com>", "a@x.com,b@y.com", "", "nobody", "\u212aim@example.com"} {
status, _, body := postContinue(t, fx2, newBrowser(t), url.Values{"address": {bad}})
if status != http.StatusOK || !strings.Contains(body, esc(copyText("home.bad_address"))) {
t.Fatalf("continue %q = %d, want the front page with the bad-address error:\n%s", bad, status, body)
@@ -396,6 +396,10 @@ func TestContinueNormalises(t *testing.T) {
t.Fatalf("continue %q: the error page has no form", bad)
}
}
+ // H4-M11: the Kelvin sign is not lower-cased into somebody's "k".
+ if n := userRows(t, fx2, "kim@example.com"); n != 0 {
+ t.Fatal("a Kelvin-sign address made the ASCII twin's user row")
+ }
if n := userRows(t, fx2, "victim@example.com"); n != 0 {
t.Fatal("a display-name address made a user row")
}
diff --git a/internal/console/hunt_H4-M11_test.go b/internal/console/hunt_H4-M11_test.go
new file mode 100644
index 000000000..578daba0f
--- /dev/null
+++ b/internal/console/hunt_H4-M11_test.go
@@ -0,0 +1,116 @@
+package console
+
+// Hunt H4-M11 (verifier, opus): the passkey step-up's identity gate
+// (stepup.go handleStepUpCallback) compares the fresh grant's address with
+// the session's using strings.EqualFold, whose Unicode simple folding equates
+// U+017F LATIN SMALL LETTER LONG S with "s" (the homoglyph this package's own
+// operator gates refuse EqualFold for: apirelay.go, apisystemupdate.go). Keymail
+// returns the address verbatim (keymail.go ExchangeGrant), so a fresh
+// authentication by a DIFFERENT Keymail identity whose address folds to the
+// session's records presence for the session.
+//
+// Production wiring: real router, real store, real OAuth sign-in and step-up
+// callbacks against the fake Keymail. The only thing the fake decides is
+// which address Keymail vouches for, which is exactly the trust the finding
+// is about. The assertions are the SECURE behaviour.
+
+import (
+ "net/http"
+ "net/url"
+ "strings"
+ "testing"
+ "time"
+)
+
+func TestHunt_H4_M11_StepUpAcceptsFoldEquivalentIdentity(t *testing.T) {
+ for name, other := range map[string]string{
+ "long-s homoglyph": "ſam@keymail.dev", // ſam@keymail.dev
+ "ascii case": "SAM@keymail.dev",
+ } {
+ t.Run(name, func(t *testing.T) {
+ fx := newConsoleFixture(t)
+ const victim = "sam@keymail.dev"
+ if err := fx.st.AddMember(OpsAccountID, victim, RoleOwner, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ if err := fx.st.AddMember(OpsAccountID, "kim@keymail.dev", RoleMember, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ // The victim's Keymail session (a sign-in records no step-up, so it
+ // is non-fresh: the stolen-session starting point).
+ fx.setUser(victim)
+ c := newBrowser(t)
+ signUp(t, fx, c, "code-hunt-m11")
+ raw := sessionToken(t, fx, c)
+ if got, _, ok := fx.st.SessionInfo(raw, time.Now()); !ok || got != victim {
+ t.Fatalf("session = %q %v, want %s", got, ok, victim)
+ }
+
+ status, loc, _ := postForm(t, c, fx.u("/members/remove"),
+ url.Values{"csrf": {raw}, "address": {"kim@keymail.dev"}})
+ if status != http.StatusSeeOther || !strings.HasPrefix(loc, fx.fk.srv.URL) {
+ t.Fatalf("gated removal = %d -> %q, want a redirect into Keymail", status, loc)
+ }
+
+ // The fresh gesture is made by a different Keymail identity.
+ fx.setUser(other)
+ fx.fk.mu.Lock()
+ fx.fk.authTime = time.Now()
+ fx.fk.mu.Unlock()
+ status, _, _ = completeStepUp(t, fx, c, loc)
+
+ if status != http.StatusForbidden {
+ t.Errorf("H4-M11: step-up callback with a fresh grant for %q on %q's session = %d, want 403", other, victim, status)
+ }
+ if fx.st.FreshStepUp(raw, victim, time.Now(), StepUpWindow) {
+ t.Errorf("H4-M11: a grant for %q recorded a fresh step-up for %q's session", other, victim)
+ }
+ if role, _ := fx.st.Role(OpsAccountID, "kim@keymail.dev"); role != RoleMember {
+ t.Errorf("H4-M11: the held owner-only removal ran on %q's step-up (kim's role now %q)", other, role)
+ }
+ })
+ }
+}
+
+// The denial half. The hunt's original pin here asserted that a mixed-case
+// Keymail sign-in produced a session under the verbatim address. Coordinator
+// ruling, review round 1: the console's identity contract (identity.go)
+// REFUSES a Keymail address that is not already canonical (Keymail's mailbox
+// names are lowercase ASCII, so on a deployment whose KEYMAIL_HOST is
+// lowercase ASCII every real address is canonical), so that premise is now false by design. The
+// pin's security assertion is kept unchanged: a mixed-case Keymail sign-in
+// never reaches the lower-case user row. Added: it is refused, and leaves no
+// session and no row of its own.
+func TestHunt_H4_M11_MixedCaseKeymailAddressIsRefused(t *testing.T) {
+ fx := newConsoleFixture(t)
+ fx.setUser("Bob@keymail.dev")
+ c := newBrowser(t)
+ status, loc, _ := get(t, c, fx.ts.URL+"/auth/signin")
+ if status != http.StatusSeeOther {
+ t.Fatalf("signin = %d, want 303", status)
+ }
+ u, err := url.Parse(loc)
+ if err != nil {
+ t.Fatal(err)
+ }
+ q := u.Query()
+ fx.fk.mu.Lock()
+ fx.fk.challenge = q.Get("code_challenge")
+ fx.fk.expectCode = "code-hunt-m11-case"
+ fx.fk.mu.Unlock()
+ status, _, _ = get(t, c, fx.ts.URL+"/auth/callback?code=code-hunt-m11-case&state="+url.QueryEscape(q.Get("state")))
+ if status != http.StatusForbidden {
+ t.Errorf("mixed-case Keymail sign-in = %d, want 403", status)
+ }
+ for _, cookie := range c.Jar.Cookies(u) {
+ if cookie.Name == sessionCookie {
+ t.Errorf("a refused sign-in left a session cookie")
+ }
+ }
+ if userRows(t, fx, "bob@keymail.dev") != 0 {
+ t.Errorf("a mixed-case Keymail sign-in reached the lower-case user row")
+ }
+ if userRows(t, fx, "Bob@keymail.dev") != 0 {
+ t.Errorf("a refused mixed-case Keymail sign-in created a user row")
+ }
+}
diff --git a/internal/console/identity.go b/internal/console/identity.go
new file mode 100644
index 000000000..f6b89a271
--- /dev/null
+++ b/internal/console/identity.go
@@ -0,0 +1,67 @@
+package console
+
+import (
+ "errors"
+
+ "github.com/carlosframework/platform/internal/identity"
+)
+
+// The console's one identity contract (H4-M11).
+//
+// The contract itself lives in internal/identity, shared with cmd/console
+// and account minting. An identity is an address in canonical form: trimmed,
+// printable ASCII only, ASCII letters lower-cased, <local>@<host>. Keymail's
+// mailbox names are already lowercase ASCII; the host half is its
+// KEYMAIL_HOST setting, which must therefore be lowercase ASCII too.
+//
+// Both sides of every identity decision go through it:
+//
+// - PROOF sites (Keymail sign-in, step-up, demo-claim proof) REFUSE an
+// address that is not already canonical. They never lower-case what an
+// identity provider vouched for: the provider vouched for that string, not
+// for a neighbour of it.
+// - GRANT sites (operator allowlists, invites, `console member`, `console
+// grant`, account materialisation) and typed front doors (email sign-in)
+// canonicalise what an operator or person typed, and refuse what cannot
+// be canonical.
+// - CHECK sites then compare with ==. Both sides are canonical by
+// construction, so exact equality is the right test and no fold is ever
+// needed.
+// - STORED principals (operator rows, owners, memberships, the By of a
+// record) are matched exactly and never re-canonicalised: a legacy row
+// such as Sam@... is that principal, not its lower-case twin. Readers that
+// turn stored rows into recipients skip a non-canonical one.
+//
+// Never Unicode folding or Unicode lower-casing. strings.EqualFold makes
+// U+017F (ſ) equal "s", and strings.ToLower maps U+212A (Kelvin sign) to an
+// ASCII "k": either turns a different identity into this one. Refusing
+// non-ASCII outright means no such character ever reaches a comparison.
+// identity_guard_test.go parses the console, cmd/console and account
+// minting and fails on any case fold outside the functions it lists as not
+// identity decisions.
+
+// canonicalIdentity is the shared contract's Canonical (internal/identity),
+// under the name the console's grant sites use.
+func canonicalIdentity(raw string) (string, bool) { return identity.Canonical(raw) }
+
+// isCanonicalIdentity is the shared contract's IsCanonical: whether a is
+// ALREADY canonical. Proof sites refuse, and stored-principal readers skip,
+// an address that is not; neither ever rewrites it.
+func isCanonicalIdentity(a string) bool { return identity.IsCanonical(a) }
+
+// errNonCanonicalOwner refuses a mint for a stored principal that is not
+// canonical: a legacy session or token from before the contract.
+var errNonCanonicalOwner = errors.New("the owner is not a canonical identity")
+
+// identityListed reports whether addr (a principal's canonical address) is on
+// an operator-configured allowlist. Each entry is canonicalised the same way
+// the principal's address was; an entry that cannot be canonical matches
+// nobody. Exact equality after that, never a fold.
+func identityListed(list []string, addr string) bool {
+ for _, entry := range list {
+ if c, ok := canonicalIdentity(entry); ok && c == addr {
+ return true
+ }
+ }
+ return false
+}
diff --git a/internal/console/identity_foldguard_test.go b/internal/console/identity_foldguard_test.go
new file mode 100644
index 000000000..f587738e7
--- /dev/null
+++ b/internal/console/identity_foldguard_test.go
@@ -0,0 +1,548 @@
+package console
+
+import (
+ "bytes"
+ "fmt"
+ "go/ast"
+ "go/parser"
+ "go/printer"
+ "go/token"
+ "path/filepath"
+ "regexp"
+ "sort"
+ "strconv"
+ "strings"
+ "testing"
+)
+
+// The guard for the identity contract (internal/identity, H4-M11).
+//
+// It parses Go source (go/ast, not text) and reports:
+//
+// - every reference to a case-folding or case-mapping function: strings/
+// bytes EqualFold, ToLower, ToUpper, ToTitle and their Special forms,
+// strings.Title, unicode.ToLower/ToUpper/ToTitle/To/SimpleFold (which
+// also catches strings.Map(unicode.ToLower, ...)), golang.org/x/text/cases,
+// and anything named NormalizeAddress. Import aliases are resolved, a
+// call split over lines is one call, and a method value
+// (lower := strings.ToLower) is a reference like any other;
+// - every string literal in which SQL folds an address-like column:
+// lower(...)/upper(...), COLLATE NOCASE or LIKE (case-insensitive for
+// ASCII in SQLite) next to address, owner, recipient, email and the like.
+//
+// The scope is every package that grants or checks an identity: the console,
+// cmd/console, account minting (internal/domains and the carlos CLI's
+// accounts.go) and the contract itself.
+//
+// Each hit is keyed by file, enclosing function and the exact expression (or
+// SQL line), and identityFoldExceptions lists every reviewed one WITH ITS
+// COUNT and the reason it is not an identity decision. A new fold anywhere,
+// including a second copy of a reviewed one or a new fold inside a function
+// that already has an exception, fails; so does a stale entry.
+
+// identityGuardScope is what the guard parses, relative to the module root:
+// a directory means its non-test .go files, a file means just that file.
+var identityGuardScope = []string{
+ "internal/console",
+ "cmd/console",
+ "internal/domains",
+ "internal/identity",
+ "accounts.go",
+}
+
+// foldException is one reviewed fold: how many times exactly that
+// expression occurs in that function, and why it is not an identity decision.
+type foldException struct {
+ n int
+ why string
+}
+
+// foldTargets are the functions the guard reports, by package path.
+var foldTargets = map[string]map[string]bool{
+ "strings": {"EqualFold": true, "ToLower": true, "ToUpper": true, "ToTitle": true,
+ "ToLowerSpecial": true, "ToUpperSpecial": true, "ToTitleSpecial": true, "Title": true},
+ "bytes": {"EqualFold": true, "ToLower": true, "ToUpper": true, "ToTitle": true,
+ "ToLowerSpecial": true, "ToUpperSpecial": true, "ToTitleSpecial": true, "Title": true},
+ "unicode": {"ToLower": true, "ToUpper": true, "ToTitle": true, "To": true, "SimpleFold": true},
+}
+
+var (
+ // sqlFold is SQL that folds case. LIKE only in capitals, the way this
+ // codebase writes SQL, so English prose ("looks like") is not SQL.
+ sqlFold = regexp.MustCompile(`\b(?i:lower|upper)\s*\(|(?i:collate\s+nocase)|\bLIKE\b`)
+ // sqlIdentityColumn is a column that may hold a person's address.
+ sqlIdentityColumn = regexp.MustCompile(`\b(address|owner|recipient|email|invited_by|subject|actor|person|operator)\b`)
+ spaces = regexp.MustCompile(`\s+`)
+)
+
+// findFoldSites reports every fold in one parsed file as "fn: expression"
+// keys (one per occurrence).
+func findFoldSites(fset *token.FileSet, f *ast.File) []string {
+ local := map[string]string{} // local import name -> path
+ var sites []string
+ for _, imp := range f.Imports {
+ path, _ := strconv.Unquote(imp.Path.Value)
+ name := path[strings.LastIndex(path, "/")+1:]
+ if imp.Name != nil {
+ name = imp.Name.Name
+ }
+ if path == "golang.org/x/text/cases" || (name == "." && foldTargets[path] != nil) {
+ sites = append(sites, "<imports>: import "+path)
+ }
+ local[name] = path
+ }
+ text := func(n ast.Node) string {
+ var b bytes.Buffer
+ printer.Fprint(&b, fset, n)
+ return spaces.ReplaceAllString(b.String(), " ")
+ }
+ isTarget := func(n ast.Node) bool {
+ switch x := n.(type) {
+ case *ast.SelectorExpr:
+ if id, ok := x.X.(*ast.Ident); ok {
+ if path, ok := local[id.Name]; ok && foldTargets[path][x.Sel.Name] {
+ return true
+ }
+ }
+ return x.Sel.Name == "NormalizeAddress"
+ case *ast.Ident:
+ return x.Name == "NormalizeAddress"
+ }
+ return false
+ }
+ inspect := func(fn string, root ast.Node) {
+ var stack []ast.Node
+ ast.Inspect(root, func(n ast.Node) bool {
+ if n == nil {
+ stack = stack[:len(stack)-1]
+ return true
+ }
+ if lit, ok := n.(*ast.BasicLit); ok && lit.Kind == token.STRING {
+ if v, err := strconv.Unquote(lit.Value); err == nil {
+ for _, line := range strings.Split(v, "\n") {
+ if sqlFold.MatchString(line) && sqlIdentityColumn.MatchString(line) {
+ sites = append(sites, fn+": sql: "+strings.TrimSpace(spaces.ReplaceAllString(line, " ")))
+ }
+ }
+ }
+ }
+ if isTarget(n) {
+ // A selector inside a selector (x.NormalizeAddress's Ident) is
+ // the same reference: report the outermost only.
+ if _, inSel := n.(*ast.Ident); !inSel || len(stack) == 0 || !isTarget(stack[len(stack)-1]) {
+ expr := n
+ if len(stack) > 0 {
+ if call, ok := stack[len(stack)-1].(*ast.CallExpr); ok {
+ expr = call // the call it is made in, or passed to
+ }
+ }
+ sites = append(sites, fn+": "+text(expr))
+ }
+ }
+ stack = append(stack, n)
+ return true
+ })
+ }
+ for _, d := range f.Decls {
+ switch d := d.(type) {
+ case *ast.FuncDecl:
+ name := d.Name.Name
+ if d.Recv != nil && len(d.Recv.List) == 1 {
+ recv := d.Recv.List[0].Type
+ star := ""
+ if s, ok := recv.(*ast.StarExpr); ok {
+ recv, star = s.X, "*"
+ }
+ if ix, ok := recv.(*ast.IndexExpr); ok {
+ recv = ix.X
+ }
+ if id, ok := recv.(*ast.Ident); ok {
+ name = "(" + star + id.Name + ")." + name
+ }
+ }
+ inspect(name, d)
+ case *ast.GenDecl:
+ if d.Tok != token.IMPORT {
+ inspect("<package>", d)
+ }
+ }
+ }
+ return sites
+}
+
+// foldViolations compares counted sites ("file: fn: expr" -> n) with the
+// reviewed exceptions, both ways.
+func foldViolations(counted map[string]int, exceptions map[string]foldException) []string {
+ var out []string
+ for key, n := range counted {
+ ex, ok := exceptions[key]
+ switch {
+ case !ok:
+ out = append(out, fmt.Sprintf("unreviewed fold (x%d), outside the identity contract: use identity.Canonical/IsCanonical and ==, or review it into identityFoldExceptions with its count and reason:\n\t%q", n, key))
+ case ex.n != n:
+ out = append(out, fmt.Sprintf("fold count changed: %q occurs %d times, %d reviewed", key, n, ex.n))
+ }
+ }
+ for key := range exceptions {
+ if counted[key] == 0 {
+ out = append(out, fmt.Sprintf("stale identityFoldExceptions entry (the fold is gone; drop it): %q", key))
+ }
+ }
+ sort.Strings(out)
+ return out
+}
+
+func TestIdentityFoldGuard(t *testing.T) {
+ root := filepath.Join("..", "..")
+ counted := map[string]int{}
+ for _, scope := range identityGuardScope {
+ files := []string{filepath.Join(root, scope)}
+ if !strings.HasSuffix(scope, ".go") {
+ var err error
+ if files, err = filepath.Glob(filepath.Join(root, scope, "*.go")); err != nil {
+ t.Fatal(err)
+ }
+ }
+ for _, file := range files {
+ if strings.HasSuffix(file, "_test.go") {
+ continue
+ }
+ fset := token.NewFileSet()
+ f, err := parser.ParseFile(fset, file, nil, parser.SkipObjectResolution)
+ if err != nil {
+ t.Fatal(err)
+ }
+ rel, _ := filepath.Rel(root, file)
+ for _, site := range findFoldSites(fset, f) {
+ counted[filepath.ToSlash(rel)+": "+site]++
+ }
+ }
+ }
+ for _, v := range foldViolations(counted, identityFoldExceptions) {
+ t.Error(v)
+ }
+}
+
+// TestIdentityFoldGuardCatchesTheFamily keeps the detector honest on the
+// forms a line grep misses, on a new fold inside a function that already has
+// an exception, on a second copy of a reviewed fold, and on SQL.
+func TestIdentityFoldGuardCatchesTheFamily(t *testing.T) {
+ src := `package p
+
+import (
+ "bytes"
+ str "strings"
+ u "unicode"
+
+ "example.com/domains"
+)
+
+func multiLine(grant struct{ Address string }, addr string) bool {
+ return str.EqualFold(
+ grant.Address,
+ addr,
+ )
+}
+
+func methodValue(a string) string {
+ lower := str.ToLower
+ return lower(a)
+}
+
+func mapped(address string) string { return str.Map(u.ToLower, address) }
+
+func bytesFold(a, b []byte) bool { return bytes.EqualFold(a, b) }
+
+func simple(r rune) rune { return u.SimpleFold(r) }
+
+func normalised(owner string) string { return domains.NormalizeAddress(owner) }
+
+type T struct{}
+
+func (*T) method(a string) string { return str.ToLower(a) }
+
+var pkgLevel = str.ToLower
+
+// exempt has a reviewed token-type fold, then grows an address fold and a
+// second copy of the reviewed one.
+func exempt(tokenType, address string) (bool, string) {
+ ok := str.EqualFold(tokenType, "bearer")
+ address = str.ToLower(address)
+ return ok && str.EqualFold(tokenType, "bearer"), address
+}
+
+const q1 = "SELECT role FROM memberships WHERE lower(address) = ?"
+const q2 = ` + "`" + `SELECT 1 FROM invites
+WHERE address = ? COLLATE NOCASE` + "`" + `
+const q3 = "SELECT address FROM users WHERE address LIKE ?"
+const q4 = "SELECT lower(hex(randomblob(8))) FROM apps"
+`
+ fset := token.NewFileSet()
+ f, err := parser.ParseFile(fset, "p.go", src, 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+ counted := map[string]int{}
+ for _, s := range findFoldSites(fset, f) {
+ counted["p.go: "+s]++
+ }
+ for _, want := range []string{
+ "p.go: multiLine: str.EqualFold( grant.Address, addr, )",
+ "p.go: methodValue: str.ToLower",
+ "p.go: mapped: str.Map(u.ToLower, address)",
+ "p.go: bytesFold: bytes.EqualFold(a, b)",
+ "p.go: simple: u.SimpleFold(r)",
+ "p.go: normalised: domains.NormalizeAddress(owner)",
+ "p.go: (*T).method: str.ToLower(a)",
+ "p.go: <package>: str.ToLower",
+ "p.go: exempt: str.ToLower(address)",
+ "p.go: <package>: sql: SELECT role FROM memberships WHERE lower(address) = ?",
+ "p.go: <package>: sql: WHERE address = ? COLLATE NOCASE",
+ "p.go: <package>: sql: SELECT address FROM users WHERE address LIKE ?",
+ } {
+ if counted[want] == 0 {
+ t.Errorf("guard misses %q (found %v)", want, counted)
+ }
+ }
+ if counted["p.go: <package>: sql: SELECT lower(hex(randomblob(8))) FROM apps"] != 0 {
+ t.Error("guard flags SQL that folds no address-like column")
+ }
+
+ // The exempt function, reviewed with ONE token-type fold: the new address
+ // fold and the second copy must both fail.
+ v := foldViolations(map[string]int{
+ "p.go: exempt: str.EqualFold(tokenType, \"bearer\")": counted["p.go: exempt: str.EqualFold(tokenType, \"bearer\")"],
+ "p.go: exempt: str.ToLower(address)": counted["p.go: exempt: str.ToLower(address)"],
+ }, map[string]foldException{
+ "p.go: exempt: str.EqualFold(tokenType, \"bearer\")": {1, "a token type"},
+ })
+ joined := strings.Join(v, "\n")
+ if !strings.Contains(joined, "unreviewed fold") || !strings.Contains(joined, "str.ToLower(address)") {
+ t.Errorf("a new fold inside an exempt function passed: %v", v)
+ }
+ if !strings.Contains(joined, "occurs 2 times, 1 reviewed") {
+ t.Errorf("a second copy of a reviewed fold passed: %v", v)
+ }
+
+ dot, err := parser.ParseFile(fset, "d.go", "package p\n\nimport . \"strings\"\n\nvar x = ToLower(\"A\")\n", 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if sites := findFoldSites(fset, dot); len(sites) == 0 {
+ t.Error("guard misses a dot import of strings")
+ }
+}
+
+// The reasons, one per kind of non-identity fold.
+const (
+ whySQLWords = "SQL keywords and identifiers in the claim gate's schema check"
+ whySVG = "SVG element and attribute names in an uploaded logo check"
+ whyHost = "a DNS name or host (case-insensitive by RFC 4343); not a person's identity"
+ whyURL = "a URL path or scheme check"
+ whySeedMarkerP3 = "a bookkeeping key recording that an operator's alert rules were seeded; grants nothing. P3 follow-up: fold-equivalent legacy addresses share one key and can suppress each other's seeding"
+ whySearch = "a case-insensitive search filter over rows the viewer can already see; grants nothing"
+ whyUserCode = "a device-login user code's alphabet normalisation"
+ whyDigest = "a hex digest, cursor or code shape check; not an identity"
+ whyConfig = "a region, account sqid or environment value from configuration; not a person"
+ whyBillingNote = "a word in an operator's billing note"
+ whyHTTP = "an HTTP header token or media type (case-insensitive by RFC 9110)"
+ whyCountry = "an ISO country code"
+ whyCurrency = "an ISO currency code"
+ whyAccountName = "an account NAME among accounts the caller already holds; membership is checked on the resolved account, and no principal is compared"
+ whyAppName = "an app or canary name (a lower-case slug); not a person"
+ whyEnvName = "an environment variable name built from a region code"
+ whyDisplay = "display text: changes the case of a word in a sentence"
+ whyMailDomain = "the DOMAIN half of a sender address, matched against verified sending domains (DNS is case-insensitive)"
+ whyFromAddress = "the console's own configured From address for its outgoing mail; names no principal and grants nothing"
+ whyAppMailFilter = "a recipient filter over one app's own mail events, after that app's authorisation; grants nothing"
+ whyOperatorSearch = "the operator-only people search (LIKE is the search, not a match); grants nothing"
+)
+
+// identityFoldExceptions is every reviewed fold: "file: function: expression"
+// (or "...: sql: line"), how many times it occurs there, and why it is not an
+// identity decision.
+var identityFoldExceptions = map[string]foldException{
+ "accounts.go: pickAccount: strings.EqualFold(a.Name, want)": {1, whyAccountName},
+ "cmd/console/main.go: appRegionsSwitch: strings.EqualFold(strings.TrimSpace(v), \"on\")": {1, whyConfig},
+ "cmd/console/main.go: appsDomain: strings.ToLower(strings.TrimSpace(os.Getenv(\"PLATFORM_APPS_DOMAIN\")))": {1, whyHost},
+ "cmd/console/main.go: denyDomains: strings.ToLower(strings.TrimSpace(d))": {1, whyHost},
+ "cmd/console/main.go: haPoolAccounts: strings.ToLower(strings.TrimSpace(a))": {1, whyConfig},
+ "cmd/console/main.go: mailDeployment: strings.ToLower(strings.TrimSpace(os.Getenv(\"CARLOS_MAIL_PLATFORM_SUFFIX\")))": {1, whyHost},
+ "cmd/console/main.go: platformDomain: strings.ToLower(strings.TrimSpace(os.Getenv(\"CARLOS_PLATFORM_DOMAIN\")))": {1, whyHost},
+ "cmd/console/main.go: relayRegions: strings.ToLower(strings.TrimSpace(r))": {1, whyConfig},
+ "cmd/console/main.go: sidecarAccounts: strings.ToLower(strings.TrimSpace(a))": {1, whyConfig},
+ "cmd/console/main.go: tunnelHostFrom: strings.ToLower(strings.TrimSpace(getenv(\"CARLOS_TUNNEL_HOST\")))": {1, whyHost},
+ "internal/console/accountdomains.go: (*Server).accountDomain: strings.ToLower(strings.TrimSpace(domain))": {1, whyHost},
+ "internal/console/accountdomains.go: (*Server).domainCardAddresses: strings.ToLower(c.Host)": {1, whyHost},
+ "internal/console/accountdomains.go: (*Server).domainCardAddresses: strings.ToLower(dv.Domain)": {1, whyHost},
+ "internal/console/accountdomains.go: (*Server).domainCardRecords: strings.ToLower(purchases[i].Domain)": {1, whyHost},
+ "internal/console/accountdomains.go: (*Server).domainCardRecords: strings.ToLower(regs[i].Domain)": {1, whyHost},
+ "internal/console/accountdomains.go: (*Server).domainCardsUnread: strings.ToLower(u.Host)": {1, whyHost},
+ "internal/console/accountdomains.go: domainCardKey: strings.ToLower(host)": {1, whyHost},
+ "internal/console/accountdomainspage.go: domainRegistrable: strings.ToLower(strings.TrimSpace(seg))": {1, whyHost},
+ "internal/console/accountplans.go: disabledColumn: strings.ToLower(strings.TrimSpace(h))": {1, whyHost},
+ "internal/console/alertdial.go: numericLastLabel: strings.ToLower(last)": {1, whyHost},
+ "internal/console/alertdial.go: validConnectorURL: strings.ToLower(host)": {1, whyHost},
+ "internal/console/alertengine_pass.go: alertMidSentence: unicode.ToLower(r)": {1, whyDisplay},
+ "internal/console/alertnotify.go: (alertTestFailure).Reason: unicode.ToLower(c)": {1, whyDisplay},
+ "internal/console/alertpages.go: (*Server).alertDoorForm: strings.ToLower(r.Header.Get(\"Content-Type\"))": {1, whyHTTP},
+ "internal/console/alertstore.go: alertSeededMarker: strings.ToLower(strings.TrimSpace(addr))": {1, whySeedMarkerP3},
+ "internal/console/analyticsdisplay.go: countryFlag: strings.ToUpper(code)": {1, whyCountry},
+ "internal/console/analyticsdisplay.go: countryName: strings.ToUpper(code)": {1, whyCountry},
+ "internal/console/apex.go: (*Server).apexHost: strings.ToLower(strings.TrimSpace(s.cfg.AppsDomain))": {1, whyHost},
+ "internal/console/apex.go: (*Server).apexSquats: strings.ToLower(strings.TrimSpace(s.cfg.AppsDomain))": {1, whyHost},
+ "internal/console/apibilling.go: (*Server).closeUnresolvedOpLocked: strings.ToLower(strings.TrimSpace(note))": {1, whyBillingNote},
+ "internal/console/apiconfig.go: configIfVersionMember: strings.EqualFold(name, \"if_version\")": {1, whyHTTP},
+ "internal/console/apiconfig.go: readConfigPutBody: strings.ToLower(ct)": {1, whyHTTP},
+ "internal/console/apidbforward.go: readDBReadBody: strings.ToLower(ct)": {1, whyHTTP},
+ "internal/console/apidemo.go: (*Server).handleDemoPublish: strings.EqualFold(parts[0], \"Bearer\")": {1, whyHTTP},
+ "internal/console/apidemo.go: validateDemoConfig: strings.ToLower(cfg.AppsDomain)": {1, whyHost},
+ "internal/console/apidemo.go: validateDemoConfig: strings.ToLower(origin.Hostname())": {1, whyHost},
+ "internal/console/apidomaincert.go: (*Server).certWildcardCovered: strings.ToLower(strings.TrimSuffix(s.cfg.AppsDomain, \".\"))": {1, whyHost},
+ "internal/console/apidomaincert.go: exactSAN: strings.EqualFold(strings.TrimSuffix(n, \".\"), host)": {1, whyHost},
+ "internal/console/apidomains.go: (*Server).consoleHosts: strings.ToLower(u.Hostname())": {1, whyHost},
+ "internal/console/apidomains.go: (*Server).delegationCNAMEDelegated: strings.EqualFold(strings.TrimSuffix(got, \".\"), strings.TrimSuffix(want, \".\"))": {1, whyHost},
+ "internal/console/apidomains.go: (*Server).denyEntries: strings.ToLower(strings.TrimSpace(entry))": {1, whyHost},
+ "internal/console/apidomains.go: (*Server).denyEntries: strings.ToLower(strings.TrimSpace(s.cfg.AppsDomain))": {1, whyHost},
+ "internal/console/apidomains.go: (*Server).handleAPIDomainAttach: strings.ToLower(strings.TrimSpace(in.Route))": {2, whyHost},
+ "internal/console/apidomains.go: (*Server).reservedDomainsWith: strings.ToLower(strings.TrimSpace(s.cfg.AppsDomain))": {1, whyHost},
+ "internal/console/apidomains.go: (*Server).resolveAliasRoute: strings.ToLower(strings.TrimSpace(want))": {1, whyHost},
+ "internal/console/apimail.go: (*Server).handleAPIEmailDomainEnsure: strings.ToLower(strings.TrimSpace(req.Domain))": {1, whyHost},
+ "internal/console/apimail.go: (*Server).handleAPIEmailDomainRemove: strings.ToLower(strings.TrimSpace(r.PathValue(\"domain\")))": {1, whyHost},
+ "internal/console/apimail.go: (*Server).handleAPIEmailDomainVerify: strings.ToLower(strings.TrimSpace(r.PathValue(\"domain\")))": {1, whyHost},
+ "internal/console/apipdf.go: (*Server).handleAPIPDF: strings.ToLower(name)": {1, whyURL},
+ "internal/console/apiplacements.go: (*Server).placementsBindings: strings.ToLower(given)": {1, whyConfig},
+ "internal/console/apipolicy.go: (*Server).applyPolicyChange: strings.ToLower(req.Size.Host)": {1, whyHost},
+ "internal/console/apipolicy.go: policyAuditDetail: strings.ToLower(req.Size.Host)": {1, whyHost},
+ "internal/console/apiservices.go: serviceHandleOf: strings.ToLower(seg)": {1, whyAppName},
+ "internal/console/apistoreuploads.go: uploadsOrigin: strings.ToLower(raw)": {1, whyHost},
+ "internal/console/apisubmission.go: (*Server).submissionFromRefusal: strings.ToLower(from[strings.LastIndexByte(from, '@')+1:])": {1, whyMailDomain},
+ "internal/console/apisubmission.go: (*Server).submissionPreconditions: strings.ToLower(d)": {1, whyMailDomain},
+ "internal/console/apisubmission.go: (*Server).submissionPreconditions: strings.ToLower(from[strings.LastIndexByte(from, '@')+1:])": {1, whyMailDomain},
+ "internal/console/apisystemupdate.go: (*Server).bootstrapState: strings.EqualFold(got, art.SHA256)": {1, whyDigest},
+ "internal/console/appdomains.go: (*Server).handleAppDomainAttach: strings.ToLower(strings.TrimSpace(r.FormValue(\"host\")))": {1, whyHost},
+ "internal/console/appdomains.go: (*Server).handleAppDomainDetach: strings.ToLower(strings.TrimSpace(r.FormValue(\"confirm\")))": {1, whyHost},
+ "internal/console/appdomains.go: (*Server).handleAppDomainDetach: strings.ToLower(strings.TrimSpace(r.FormValue(\"host\")))": {1, whyHost},
+ "internal/console/appframe.go: (*appFrames).clearAccount: strings.EqualFold(sl.name, seg)": {1, whyAccountName},
+ "internal/console/applist.go: appFilter: strings.ToLower(strings.TrimSpace(q))": {1, whySearch},
+ "internal/console/applist.go: filterApps: strings.ToLower(r.App)": {1, whySearch},
+ "internal/console/applist.go: filterApps: strings.ToLower(r.URL)": {1, whySearch},
+ "internal/console/appregionset.go: sentenceCase: strings.ToUpper(msg[:1])": {1, whyDisplay},
+ "internal/console/appsettings.go: (*Server).settingsDomains: strings.ToLower(c.Host)": {1, whyHost},
+ "internal/console/appsettings.go: (*Server).settingsDomains: strings.ToLower(d.Domain)": {1, whyHost},
+ "internal/console/archgraph.go: machineFor: strings.EqualFold(r.Name, label)": {1, whyHost},
+ "internal/console/authcli.go: bearer: strings.EqualFold(h[:7], \"bearer \")": {1, whyHTTP},
+ "internal/console/authcli.go: decodeJSONBody: strings.ToLower(ct)": {1, whyHTTP},
+ "internal/console/authstore.go: NormalizeUserCode: strings.ToUpper(strings.TrimSpace(in))": {1, whyUserCode},
+ "internal/console/billingpage.go: (*Server).billingBuy: strings.ToUpper(b.Currency)": {1, whyCurrency},
+ "internal/console/billingpage.go: (*Server).billingBuy: strings.ToUpper(c)": {1, whyCurrency},
+ "internal/console/billingpage.go: (*Server).billingViewFor: strings.ToUpper(b.Currency)": {1, whyCurrency},
+ "internal/console/billingpage.go: currencyQuery: strings.ToLower(raw)": {1, whyCurrency},
+ "internal/console/billingpayments_store.go: matchPayment: strings.EqualFold(currency, p.Currency)": {1, whyCurrency},
+ "internal/console/billingrevenue.go: (*Store).BillingFacts: strings.ToLower(f.Currency)": {1, whyCurrency},
+ "internal/console/claim_backends.go: (backendGuard).domainMembers: strings.ToLower(name)": {1, whyHost},
+ "internal/console/claim_backends.go: (claimDNSWriter).check: strings.ToLower(r.Name)": {1, whyHost},
+ "internal/console/consolemail.go: ConsoleMailFrom: strings.ToLower(strings.TrimSpace(explicit))": {1, whyFromAddress},
+ "internal/console/delivery.go: domainOf: strings.ToLower(addr[i+1:])": {1, whyMailDomain},
+ "internal/console/demo_domains.go: (*Server).demoDomainReserved: strings.ToLower(host)": {1, whyHost},
+ "internal/console/demo_reports.go: demoReportCursor: strings.ToLower(id)": {1, whyDigest},
+ "internal/console/demo_serving.go: demoExactHost: strings.ToLower(host)": {1, whyHost},
+ "internal/console/dnsds.go: (*Server).lookupDomainNS: strings.ToLower(strings.TrimSpace(r.Host))": {1, whyHost},
+ "internal/console/dnsds.go: dsAnswer: strings.EqualFold(a.Name.String(), q.Name.String())": {1, whyHost},
+ "internal/console/dnsds.go: dsAnswer: strings.EqualFold(qs[0].Name.String(), q.Name.String())": {1, whyHost},
+ "internal/console/domaincatchall.go: (*Server).catchallParentRefused: strings.ToLower(strings.TrimSpace(entry))": {1, whyHost},
+ "internal/console/domainpoint.go: normalizePointDomain: strings.ToLower(strings.TrimSpace(domain))": {1, whyHost},
+ "internal/console/domainpolicy.go: (*Server).directAppsDomainHost: strings.ToLower(strings.TrimSpace(s.cfg.AppsDomain))": {1, whyHost},
+ "internal/console/domainpolicy.go: (*Server).domainHostPolicy: strings.ToLower(strings.TrimSpace(s.cfg.AppsDomain))": {1, whyHost},
+ "internal/console/econlistquery.go: pageEconAccounts: strings.ToLower(q.Q)": {1, whySearch},
+ "internal/console/econlistquery.go: pageEconAccounts: strings.ToLower(r.Account)": {1, whySearch},
+ "internal/console/econlistquery.go: pageEconAccounts: strings.ToLower(r.Name)": {1, whySearch},
+ "internal/console/emailsignin.go: (*Server).sameOrigin: strings.EqualFold(got.Host, want.Host)": {1, whyHost},
+ "internal/console/geoipfeed.go: (*geoipFeeder).checkMaxMind: strings.ToLower(strings.TrimSpace(strings.SplitN(string(sumBody), \" \", 2)[0]))": {1, whyDigest},
+ "internal/console/homelink.go: homeLinkPublicURL: strings.ToLower(l.AppsDomain)": {1, whyHost},
+ "internal/console/keymail.go: (*Keymail).ExchangeGrant: strings.EqualFold(out.TokenType, \"bearer\")": {1, whyHTTP},
+ "internal/console/keymail.go: (*Keymail).Host: strings.ToLower(u.Hostname())": {1, whyHost},
+ "internal/console/listquery.go: healthSlug: strings.ToLower(word)": {1, whyDisplay},
+ "internal/console/mailevents.go: (*Store).MailEvents: sql: recipient = ? COLLATE NOCASE": {1, whyAppMailFilter},
+ "internal/console/mailpush.go: (*Server).mailPushURL: strings.ToLower(strings.TrimSpace(s.cfg.AppsDomain))": {1, whyHost},
+ "internal/console/managedapi.go: readManagedJSON: strings.ToLower(ct)": {1, whyHTTP},
+ "internal/console/opbilling.go: buildOpBillingPayments: strings.ToLower(p.SettledCurrency)": {1, whyCurrency},
+ "internal/console/opbilling_money.go: accountMoneyRows: strings.ToLower(p.SettledCurrency)": {1, whyCurrency},
+ "internal/console/opbilling_money.go: minorText: strings.ToLower(currency)": {1, whyCurrency},
+ "internal/console/opbilling_money.go: minorText: strings.ToUpper(c)": {1, whyCurrency},
+ "internal/console/opbilling_money.go: moneyByMonth: strings.ToLower(p.SettledCurrency)": {1, whyCurrency},
+ "internal/console/opbilling_money.go: paymentRowEUR: strings.ToLower(p.SettledCurrency)": {1, whyCurrency},
+ "internal/console/opbilling_money.go: settledEUR: strings.ToLower(currency)": {1, whyCurrency},
+ "internal/console/opbilling_overview.go: opBillingNatives: strings.ToLower(p.SettledCurrency)": {1, whyCurrency},
+ "internal/console/oplegal.go: legalPublishedText: unicode.ToLower(r)": {1, whyDisplay},
+ "internal/console/oplegal.go: svgFuncsOK: strings.ToLower(v)": {1, whySVG},
+ "internal/console/oplegal.go: svgLogoOK: strings.ToLower(a.Name.Local)": {1, whySVG},
+ "internal/console/oplegal.go: svgLogoOK: strings.ToLower(t.Name.Local)": {1, whySVG},
+ "internal/console/opstore.go: <package>: sql: SELECT COUNT(*) FROM users WHERE address LIKE ?1 ESCAPE '\\'": {1, whyOperatorSearch},
+ "internal/console/opstore.go: <package>: sql: WHERE ?1 = '' OR address LIKE ?2 ESCAPE '\\'": {1, whyOperatorSearch},
+ "internal/console/perfspeed.go: consoleSpeedRoute: strings.ToUpper(pm)": {1, whyURL},
+ "internal/console/plancaps.go: (*Server).customDomain: strings.ToLower(strings.TrimSpace(s.cfg.AppsDomain))": {1, whyHost},
+ "internal/console/planlapse_inventory.go: (*Server).lapseInventory: strings.ToLower(c.Host)": {1, whyHost},
+ "internal/console/planlapse_inventory.go: (*Server).lapseInventory: strings.ToLower(r.Host)": {2, whyHost},
+ "internal/console/planlapse_inventory.go: (*Server).lapseUnreadClaims: strings.ToLower(u.Host)": {1, whyHost},
+ "internal/console/planlapse_inventory.go: lapseHosts: strings.ToLower(out[i])": {1, whyHost},
+ "internal/console/policysize.go: policySizeChecks: strings.ToLower(req.Size.Host)": {1, whyHost},
+ "internal/console/relayops.go: (*Server).relayDomain: strings.ToLower(strings.TrimSpace(s.cfg.AppsDomain))": {1, whyHost},
+ "internal/console/relayops.go: (*Server).relayDomain: strings.ToLower(strings.TrimSpace(s.cfg.PlatformDomain))": {1, whyHost},
+ "internal/console/relayops.go: (*Server).relayRegions: strings.ToLower(strings.TrimSpace(r))": {1, whyConfig},
+ "internal/console/relayops.go: (*Server).relayResolveRegions: strings.ToLower(strings.TrimSpace(r))": {1, whyConfig},
+ "internal/console/relayops.go: (*Server).relayRotate: strings.ToLower(strings.TrimSpace(region))": {1, whyConfig},
+ "internal/console/relayops.go: relayMastersEnv: strings.ToUpper(strings.ReplaceAll(region, \"-\", \"_\"))": {1, whyEnvName},
+ "internal/console/resolve.go: matchAccounts: strings.EqualFold(accts[i].Name, seg)": {1, whyAccountName},
+ "internal/console/resolve.go: preferredSeg: strings.EqualFold(accts[i].Name, a.Name)": {1, whyAccountName},
+ "internal/console/scanhook.go: validCallbackPath: strings.ToLower(p)": {1, whyURL},
+ "internal/console/server.go: (*Server).handleNewCanary: strings.ToLower(strings.TrimSpace(r.FormValue(\"name\")))": {1, whyAppName},
+ "internal/console/server.go: (*Server).handleRetireCanary: strings.ToLower(strings.TrimSpace(r.FormValue(\"name\")))": {1, whyAppName},
+ "internal/console/server.go: normalizeAppName: strings.ToLower(strings.TrimSpace(name))": {1, whyAppName},
+ "internal/console/hostnorm.go: normalizeDelegationZone: strings.ToLower(strings.TrimSpace(raw))": {1, whyHost},
+ "internal/console/server.go: normalizeHost: strings.ToLower(strings.TrimSpace(host))": {1, whyHost},
+ "internal/console/hostnorm.go: normalizeSteeringHost: strings.ToLower(strings.TrimSpace(strings.TrimSuffix(strings.TrimSpace(raw), \".\")))": {1, whyHost},
+ "internal/console/sesevents.go: canonicalSigningCertURL: strings.ToLower(u.Host)": {1, whyHost},
+ "internal/console/sesevents.go: validSigningCertURL: strings.ToLower(strings.TrimSpace(region))": {1, whyHost},
+ "internal/console/sesevents.go: validSigningCertURL: strings.ToLower(u.Hostname())": {1, whyHost},
+ "internal/console/shares.go: (*Server).handleAPISystemShareStop: strings.ToLower(strings.TrimSpace(req.Host))": {1, whyHost},
+ "internal/console/store_gate.go: claimAppish: strings.ToLower(col)": {1, whySQLWords},
+ "internal/console/store_gate.go: claimBlockedLiteral: strings.ToLower(strings.TrimSpace(s))": {1, whySQLWords},
+ "internal/console/store_gate.go: claimSQLCensus: strings.EqualFold(o.name, claimSQLReservedName)": {1, whySQLWords},
+ "internal/console/store_gate.go: claimSQLCensus: strings.ToUpper(strings.TrimSpace(o.ddl))": {1, whySQLWords},
+ "internal/console/store_gate.go: claimTriggerSQL: strings.ToUpper(event)": {1, whySQLWords},
+ "internal/console/store_gate.go: inspectClaimSQL: strings.ToLower(id)": {1, whySQLWords},
+ "internal/console/store_gate.go: inspectClaimSQL: strings.ToLower(q[i+1 : i+1+j])": {1, whySQLWords},
+ "internal/console/store_gate.go: inspectClaimSQL: strings.ToLower(q[i+1:])": {1, whySQLWords},
+ "internal/console/store_gate.go: inspectClaimSQL: strings.ToLower(q[i:j])": {1, whySQLWords},
+ "internal/console/subdomains.go: (*Server).appsDomain: strings.ToLower(strings.TrimSpace(s.cfg.AppsDomain))": {1, whyHost},
+ "internal/console/subdomains.go: (*Server).subdomainInfrastructure: strings.ToLower(strings.TrimSpace(entry))": {1, whyHost},
+ "internal/console/svcpage.go: runMintSentence: strings.ToUpper(msg[:1])": {1, whyDisplay},
+ "internal/console/teamdoors.go: (*Server).teamInScope: strings.ToLower(strings.TrimSpace(body.Route))": {1, whyHost},
+ "internal/console/usageattrib.go: (*Server).newUsageAttribution: strings.ToLower(strings.TrimSuffix(s.cfg.AppsDomain, \".\"))": {1, whyHost},
+ "internal/console/usageattrib.go: (*usageAttribution).namespaceOwner: strings.ToLower(host)": {1, whyHost},
+ "internal/console/view.go: isApexDomain: strings.ToLower(strings.TrimSuffix(strings.TrimSpace(host), \".\"))": {1, whyHost},
+ "internal/domains/claims.go: NormalizeAliasHost: strings.ToLower(raw)": {1, whyHost},
+ "internal/domains/claims.go: ParseInstanceCatchallHost: strings.ToLower(raw)": {1, whyHost},
+ "internal/domains/freshdns.go: (*FreshResolver).Forget: strings.ToLower(strings.TrimSuffix(host, \".\"))": {1, whyHost},
+ "internal/domains/freshdns.go: (*FreshResolver).Retain: strings.ToLower(strings.TrimSuffix(h, \".\"))": {1, whyHost},
+ "internal/domains/freshdns.go: (*FreshResolver).Strike: strings.ToLower(strings.TrimSuffix(host, \".\"))": {1, whyHost},
+ "internal/domains/freshdns.go: (*FreshResolver).answer: strings.EqualFold(rr.Header.Name.String(), current)": {2, whyHost},
+ "internal/domains/freshdns.go: (*FreshResolver).answer: strings.ToLower(c.CNAME.String())": {1, whyHost},
+ "internal/domains/freshdns.go: (*FreshResolver).answer: strings.ToLower(current)": {1, whyHost},
+ "internal/domains/freshdns.go: (*FreshResolver).answerAAAA: strings.EqualFold(rr.Header.Name.String(), name+\".\")": {1, whyHost},
+ "internal/domains/freshdns.go: (*FreshResolver).lookup: strings.ToLower(strings.TrimSuffix(host, \".\"))": {1, whyHost},
+ "internal/domains/freshdns.go: (*FreshResolver).query: strings.EqualFold(reply.Questions[0].Name.String(), fqdn)": {1, whyHost},
+ "internal/domains/freshdns.go: (*FreshResolver).serverAddrs: strings.ToLower(strings.TrimSuffix(hosts[i], \".\"))": {1, whyHost},
+ "internal/domains/freshdns.go: (*FreshResolver).verifyZone: strings.EqualFold(rr.Header.Name.String(), zone+\".\")": {1, whyHost},
+ "internal/domains/freshdns.go: noData: strings.EqualFold(rr.Header.Name.String(), zone+\".\")": {1, whyHost},
+ "internal/domains/freshdns.go: referralFrom: strings.ToLower(strings.TrimSuffix(ns.NS.String(), \".\"))": {1, whyHost},
+ "internal/domains/freshdns.go: referralFrom: strings.ToLower(strings.TrimSuffix(rr.Header.Name.String(), \".\"))": {2, whyHost},
+ "internal/domains/freshdns.go: zoneHint: strings.ToLower(strings.TrimSuffix(rr.Header.Name.String(), \".\"))": {1, whyHost},
+ "internal/domains/namespace.go: NormalizeSubdomain: strings.ToLower(strings.TrimSpace(raw))": {1, whyHost},
+ "internal/domains/reconcile.go: dnsVerdicts: strings.ToLower(strings.TrimSuffix(host, \".\"))": {1, whyHost},
+ "internal/domains/reconcile.go: hostCertExpiry: strings.ToLower(host[i+1:])": {1, whyHost},
+ "internal/domains/reconcile.go: hostVerdicts: strings.ToLower(cfg.AppsDomain)": {1, whyHost},
+ "internal/domains/reconcile.go: hostVerdicts: strings.ToLower(strings.TrimSuffix(host, \".\"))": {1, whyHost},
+ "internal/domains/reconcile.go: stampKey: strings.ToLower(strings.TrimSuffix(host, \".\"))": {1, whyHost},
+}
diff --git a/internal/console/identity_guard_test.go b/internal/console/identity_guard_test.go
new file mode 100644
index 000000000..2004cad5c
--- /dev/null
+++ b/internal/console/identity_guard_test.go
@@ -0,0 +1,229 @@
+package console
+
+import (
+ "net/http"
+ "net/url"
+ "testing"
+ "time"
+)
+
+func TestCanonicalIdentity(t *testing.T) {
+ for _, tc := range []struct {
+ in, want string
+ ok bool
+ }{
+ {"sam@keymail.dev", "sam@keymail.dev", true},
+ {" Sam@Keymail.DEV ", "sam@keymail.dev", true},
+ {"paul@localhost:6245", "paul@localhost:6245", true},
+ {"ſam@keymail.dev", "", false}, // U+017F: folds to "s" under EqualFold
+ {"Kim@keymail.dev", "", false}, // Kelvin sign: strings.ToLower makes it "k"
+ {"sİm@keymail.dev", "", false}, // dotted capital I
+ {"sam@keymail.dev\x00", "", false}, // control byte
+ {"sam keymail.dev", "", false},
+ {"sam@", "", false},
+ {"", "", false},
+ } {
+ got, ok := canonicalIdentity(tc.in)
+ if got != tc.want || ok != tc.ok {
+ t.Errorf("canonicalIdentity(%q) = %q %v, want %q %v", tc.in, got, ok, tc.want, tc.ok)
+ }
+ }
+ if isCanonicalIdentity("Sam@keymail.dev") || !isCanonicalIdentity("sam@keymail.dev") {
+ t.Error("isCanonicalIdentity must accept only an already-canonical address")
+ }
+ if identityListed([]string{"ſam@keymail.dev", "Kim@keymail.dev"}, "sam@keymail.dev") ||
+ identityListed([]string{"Kim@keymail.dev"}, "kim@keymail.dev") {
+ t.Error("a non-ASCII allowlist entry matched an ASCII identity")
+ }
+ if !identityListed([]string{" Sam@Keymail.dev "}, "sam@keymail.dev") {
+ t.Error("an operator's mixed-case entry no longer names its canonical identity")
+ }
+}
+
+// Every operator allowlist goes through identityListed: the intended
+// principal (the canonical form of a mixed-case entry) passes, and neither a
+// fold twin in the list nor a non-canonical principal does.
+func TestOperatorAllowlistsUseTheContract(t *testing.T) {
+ fx := newConsoleFixture(t)
+ list := []string{" Sam@Keymail.dev ", "ſue@keymail.dev", "\u212aim@keymail.dev"}
+ fx.srv.cfg.StoreOperators = list
+ fx.srv.cfg.RelayOperators = list
+ fx.srv.cfg.MailOperators = list
+ fx.srv.cfg.SystemOperators = list
+ for name, gate := range map[string]func(string) bool{
+ "store": fx.srv.storeOperator,
+ "relay": fx.srv.relayOperator,
+ "mail": fx.srv.mailOperator,
+ "system": fx.srv.systemOperator,
+ } {
+ if !gate("sam@keymail.dev") {
+ t.Errorf("%s: the intended operator sam@keymail.dev is refused", name)
+ }
+ for _, twin := range []string{"Sam@keymail.dev", "sue@keymail.dev", "kim@keymail.dev"} {
+ if gate(twin) {
+ t.Errorf("%s: %s passed the allowlist", name, twin)
+ }
+ }
+ }
+}
+
+// legacyCLIToken is cliToken for an address sign-in now refuses (identity.go):
+// a session row made directly, as one from before the contract would be, with
+// fresh presence, then the real device-approval flow. Tests use it to keep
+// checking the layers BEHIND sign-in (operator allowlists) against principals
+// that can no longer be produced through the front door.
+func legacyCLIToken(t *testing.T, fx *consoleFixture, address string) string {
+ t.Helper()
+ browser, raw := legacyBrowser(t, fx, address)
+ _, start := postJSON(t, fx.ts.URL+"/auth/cli/start", map[string]string{"label": "test@harness"}, "")
+ userCode, deviceCode := str(t, start, "user_code"), str(t, start, "device_code")
+ if code, _, body := postGated(t, fx, browser, fx.ts.URL+"/auth/cli/approve",
+ url.Values{"code": {userCode}, "action": {"approve"}, "csrf": {raw}}); code != http.StatusOK {
+ t.Fatalf("approve = %d:\n%s", code, body)
+ }
+ _, poll := postJSON(t, fx.ts.URL+"/auth/cli/poll", map[string]string{"device_code": deviceCode}, "")
+ tok := str(t, poll, "token")
+ if tok == "" {
+ t.Fatalf("no token from poll: %v", poll)
+ }
+ return tok
+}
+
+// recipientSet is the addresses a run would write to and the ones it could
+// not, together: everything the run treats as a recipient. An error is the
+// "<error>" key, which no assertion here accepts.
+func recipientSet(run *alertRun, err error) map[string]bool {
+ if err != nil {
+ return map[string]bool{"<error>": true}
+ }
+ out := map[string]bool{}
+ for _, g := range run.to {
+ out[g.address] = true
+ }
+ for _, m := range run.missing {
+ out[m] = true
+ }
+ return out
+}
+
+// H4-M11 round 2: stored principals are matched exactly. With a legacy
+// operator row Sam@keymail.dev and an ordinary user sam@keymail.dev (who holds
+// a grant but no operator bit), no recipient resolution may hand the legacy
+// operator's notices to the lower-case twin, and the legacy row itself is
+// skipped rather than rewritten.
+func TestRecipientsNeverReachALowerCaseTwin(t *testing.T) {
+ fx := newConsoleFixture(t)
+ now := time.Now()
+ const legacy, twin = "Sam@keymail.dev", "sam@keymail.dev"
+ if err := fx.st.SetOperator(legacy, true); err != nil {
+ t.Fatal(err)
+ }
+ for _, a := range []string{legacy, twin} {
+ if err := fx.st.SetGrantToken(a, "tok-"+a, now); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if op, _ := fx.st.IsOperator(twin); op {
+ t.Fatal("setup: the twin is an operator")
+ }
+
+ got := recipientSet(fx.srv.alertRecipients())
+ if got[twin] || got[legacy] || got["<error>"] {
+ t.Errorf("alert recipients = %v: want neither the twin nor the non-canonical legacy row", got)
+ }
+
+ fx.srv.cfg.StoreOperators = []string{legacy, twin}
+ got = recipientSet(fx.srv.storeNotificationRecipients())
+ if got[twin] || got[legacy] || got["<error>"] {
+ t.Errorf("store notification recipients = %v: the twin holds no operator bit", got)
+ }
+
+ got = recipientSet(fx.srv.grantRecipients([]string{legacy}))
+ if got[twin] || got[legacy] || got["<error>"] {
+ t.Errorf("grantRecipients(%s) = %v: want it skipped, never lower-cased", legacy, got)
+ }
+
+ // The intended principal still receives: a canonical operator.
+ if err := fx.st.SetOperator("kim@keymail.dev", true); err != nil {
+ t.Fatal(err)
+ }
+ if err := fx.st.SetGrantToken("kim@keymail.dev", "tok-kim", now); err != nil {
+ t.Fatal(err)
+ }
+ fx.srv.cfg.StoreOperators = []string{" Kim@Keymail.dev "}
+ if got := recipientSet(fx.srv.storeNotificationRecipients()); !got["kim@keymail.dev"] {
+ t.Errorf("store notification recipients = %v, want kim@keymail.dev", got)
+ }
+}
+
+// legacyBrowser is a browser holding a session for address made directly, as
+// one from before the identity contract would be, with fresh presence.
+func legacyBrowser(t *testing.T, fx *consoleFixture, address string) (*http.Client, string) {
+ t.Helper()
+ now := time.Now()
+ raw, err := fx.st.CreateSessionMethod(address, "", MethodKeymail, now)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := fx.st.RecordStepUp(raw, address, now, now); err != nil {
+ t.Fatal(err)
+ }
+ browser := newBrowser(t)
+ u, _ := url.Parse(fx.ts.URL)
+ browser.Jar.SetCookies(u, []*http.Cookie{{Name: sessionCookie, Value: raw, Path: "/"}})
+ return browser, raw
+}
+
+// H4-M11 final cut: a legacy non-canonical session or CLI token cannot mint
+// an account through any console door. Nothing reaches the bucket, so no
+// manifest can name the lower-case twin, and materialising the bucket into a
+// fresh database never makes the twin an owner.
+func TestLegacyOwnerCannotMint(t *testing.T) {
+ const legacy, twin = "Sam@keymail.dev", "sam@keymail.dev"
+ doors := map[string]func(t *testing.T, fx *consoleFixture){
+ "landing": func(t *testing.T, fx *consoleFixture) {
+ c, _ := legacyBrowser(t, fx, legacy)
+ get(t, c, fx.ts.URL+"/")
+ },
+ "POST /accounts/new": func(t *testing.T, fx *consoleFixture) {
+ c, raw := legacyBrowser(t, fx, legacy)
+ postForm(t, c, fx.ts.URL+"/accounts/new", url.Values{"csrf": {raw}, "name": {"shop"}})
+ },
+ "POST /auth/cli/accounts": func(t *testing.T, fx *consoleFixture) {
+ token := legacyCLIToken(t, fx, legacy)
+ if st, out := postJSON(t, fx.ts.URL+"/auth/cli/accounts", map[string]string{"name": "shop"}, token); st == http.StatusOK {
+ t.Errorf("legacy CLI token minted an account: %v", out)
+ }
+ },
+ }
+ for name, door := range doors {
+ t.Run(name, func(t *testing.T) {
+ fx := newConsoleFixture(t)
+ ctx := t.Context()
+ before, err := fx.rel.List(ctx, "accounts/")
+ if err != nil {
+ t.Fatal(err)
+ }
+ door(t, fx)
+ after, err := fx.rel.List(ctx, "accounts/")
+ if err != nil {
+ t.Fatal(err)
+ }
+ if len(after) != len(before) {
+ t.Errorf("a legacy owner wrote to the bucket: %v -> %v", before, after)
+ }
+ for _, a := range []string{legacy, twin} {
+ if accts, _ := fx.st.AccountsFor(a); len(accts) != 0 {
+ t.Errorf("AccountsFor(%s) = %+v, want none", a, accts)
+ }
+ }
+ fresh := openTestStore(t)
+ if _, err := MaterializeAccounts(ctx, fx.rel, fresh); err != nil {
+ t.Fatal(err)
+ }
+ if accts, _ := fresh.AccountsFor(twin); len(accts) != 0 {
+ t.Errorf("materialising into a fresh database made the twin an owner: %+v", accts)
+ }
+ })
+ }
+}
diff --git a/internal/console/invite_delivery_test.go b/internal/console/invite_delivery_test.go
index a07ced3e8..f675b4bac 100644
--- a/internal/console/invite_delivery_test.go
+++ b/internal/console/invite_delivery_test.go
@@ -356,7 +356,10 @@ func TestInviteWindowCountsUndeliveredInvites(t *testing.T) {
// ValidAddress lets through strings an SES To header reads as more than one
// recipient, or as a display name. The invite takes one bare address.
func TestInviteRefusesAnythingButOneBareAddress(t *testing.T) {
- for _, to := range []string{"a@x.com,b@y.com", "x<v@y.com>"} {
+ // The last two are fold twins of ASCII identities (H4-M11): U+017F folds
+ // to "s" under EqualFold, and strings.ToLower turns the Kelvin sign into
+ // "k". The identity contract refuses non-ASCII rather than mapping them.
+ for _, to := range []string{"a@x.com,b@y.com", "x<v@y.com>", "ſam@x.com", "\u212aim@x.com"} {
t.Run(to, func(t *testing.T) {
fx := newConsoleFixture(t)
owner := newBrowser(t)
@@ -482,3 +485,19 @@ func TestTeamPageInviteCopy(t *testing.T) {
t.Fatal("team page still says the platform never emails anyone")
}
}
+
+// The invitee is the canonical identity (identity.go), so the person who can
+// accept is exactly the one who signs in as it: an operator's mixed case
+// names the same lower-case Keymail identity, never a different one.
+func TestInviteCanonicalisesTheInvitee(t *testing.T) {
+ fx := newConsoleFixture(t)
+ owner := newBrowser(t)
+ signUp(t, fx, owner, "code-owner")
+ inviteAttempts(fx)
+ csrf := sessionToken(t, fx, owner)
+ postForm(t, owner, fx.u("/invite"), url.Values{"csrf": {csrf}, "address": {" Ann@Example.COM "}})
+ pending, err := fx.st.PendingInvites(OpsAccountID)
+ if err != nil || len(pending) != 1 || pending[0].Address != "ann@example.com" {
+ t.Fatalf("pending = %+v, %v; want one invite for ann@example.com", pending, err)
+ }
+}
diff --git a/internal/console/materialize.go b/internal/console/materialize.go
index 8be59b909..ab193a1ba 100644
--- a/internal/console/materialize.go
+++ b/internal/console/materialize.go
@@ -209,11 +209,16 @@ func materializeAccounts(ctx context.Context, s release.Store, st *Store, unlink
// nobody could ever claim, and inventing it would just be a stranded
// row with a confusing name on it. Never for a refused link (above).
if m.Owner != "" && !rejectedLink {
- if !ValidAddress(m.Owner) {
+ // The identity contract (identity.go): an owner that cannot be
+ // canonical is the same stranded grant as one that is not an
+ // address at all, and a Unicode-lowercased one could be somebody
+ // else's identity.
+ owner, canonical := canonicalIdentity(m.Owner)
+ if !canonical {
log.Printf("console: account %s names owner %q, which is not a keymail address — "+
"nobody could sign in as it, so no membership was created. Fix it with: "+
"console member --add <address> %s --role owner", m.Sqid, m.Owner, m.Sqid)
- } else if err := st.AddMember(m.ID, strings.ToLower(m.Owner), RoleOwner, created); err != nil {
+ } else if err := st.AddMember(m.ID, owner, RoleOwner, created); err != nil {
// Loud but not fatal: the account itself materialized, and an
// operator can still add the owner box-side. Failing the whole
// pass here would hide every other account behind one bad row.
@@ -284,11 +289,14 @@ func materializeAccounts(ctx context.Context, s release.Store, st *Store, unlink
// materialized but could not be given its owner is recoverable with `console
// member -add`, whereas a console that refuses to boot is not.
func materializeOwner(st *Store, key string, m accountManifest, created time.Time) {
- owner := domains.NormalizeAddress(m.Owner)
- if owner == "" {
+ if strings.TrimSpace(m.Owner) == "" {
return // ownerless by design: every manifest written before the field existed
}
- if !domains.ValidAddress(owner) {
+ // The identity contract (identity.go), not domains.NormalizeAddress: that
+ // one lower-cases Unicode too, which can turn a manifest's owner into a
+ // different person's identity (U+212A Kelvin sign becomes "k").
+ owner, canonical := canonicalIdentity(m.Owner)
+ if !canonical {
log.Printf("console: %s names owner %q, which is not a keymail address — "+
"materializing the account without it; give it one with `console member --add <address> %s --role owner`",
key, m.Owner, m.Sqid)
diff --git a/internal/console/materialize_test.go b/internal/console/materialize_test.go
index 4f98d78f5..f1f5f8c94 100644
--- a/internal/console/materialize_test.go
+++ b/internal/console/materialize_test.go
@@ -956,3 +956,40 @@ func TestMaterializeRefusedLinkAdoptsNoOwner(t *testing.T) {
t.Errorf("GET /a/bdf/ as the manifest's owner = %d %q, want the stdlib 404", status, body)
}
}
+
+// H4-M11: the manifest owner is the identity contract's canonical form, never
+// a Unicode-lower-cased one. A mixed-case owner names the lower-case Keymail
+// identity; a Kelvin-sign owner is NOT turned into the ASCII "kim".
+func TestMaterializeManifestOwnerIsCanonical(t *testing.T) {
+ for _, tc := range []struct {
+ owner, want string
+ }{
+ {"Paul@Keymail.dev", "paul@keymail.dev"},
+ {"\u212aim@keymail.dev", ""},
+ {"ſam@keymail.dev", ""},
+ } {
+ t.Run(tc.owner, func(t *testing.T) {
+ st := openTestStore(t)
+ rel := release.NewDirStore(t.TempDir())
+ ctx := t.Context()
+ sqid := domains.Sqid(42)
+ manifest, _ := json.Marshal(map[string]any{"id": 42, "sqid": sqid, "name": "Kass", "owner": tc.owner})
+ if _, err := rel.Put(ctx, domains.AccountManifestKey(sqid), manifest, ""); err != nil {
+ t.Fatal(err)
+ }
+ if n, err := MaterializeAccounts(ctx, rel, st); err != nil || n != 1 {
+ t.Fatalf("materialized %d (%v), want the account itself", n, err)
+ }
+ members, _ := st.Members(42)
+ if tc.want == "" {
+ if len(members) != 0 {
+ t.Fatalf("Members = %+v, want nobody", members)
+ }
+ return
+ }
+ if len(members) != 1 || members[0].Name != tc.want || members[0].Role != RoleOwner {
+ t.Fatalf("Members = %+v, want %s as owner", members, tc.want)
+ }
+ })
+ }
+}
diff --git a/internal/console/opperson.go b/internal/console/opperson.go
index 882d6777f..2889d9592 100644
--- a/internal/console/opperson.go
+++ b/internal/console/opperson.go
@@ -45,9 +45,12 @@ func opPersonHref(actor string) string {
}
// opCanonicalAddress is address in the form users rows store a typed
-// address (canonicalAddress): trimmed and lower-cased.
+// address (canonicalIdentity), or just trimmed when it cannot be one.
func opCanonicalAddress(address string) string {
- return strings.ToLower(strings.TrimSpace(address))
+ if c, ok := canonicalIdentity(address); ok {
+ return c
+ }
+ return strings.TrimSpace(address)
}
// operatorPersonNamed is the person an operator's URL names: the users row
diff --git a/internal/console/ownership.go b/internal/console/ownership.go
index 548eb2b95..f6cf9ed3d 100644
--- a/internal/console/ownership.go
+++ b/internal/console/ownership.go
@@ -854,7 +854,9 @@ var errAccountHoldsDomains = errors.New("console: the account holds domains")
// promote first, so lastOwnerGuard sees two owners when the demotion runs and
// there is no window in which the account has none.
func (s *Store) TransferOwnership(accountID int64, from, to string, now time.Time) error {
- if strings.EqualFold(from, to) {
+ // Exact (identity.go): both are canonical, and a fold would refuse a
+ // transfer to a different person whose address merely folds to from.
+ if from == to {
return fmt.Errorf("console: %s already owns this account", to)
}
tx, err := s.db.Begin()
diff --git a/internal/console/plangrace_cli_test.go b/internal/console/plangrace_cli_test.go
index c736aa1cd..6d00fc476 100644
--- a/internal/console/plangrace_cli_test.go
+++ b/internal/console/plangrace_cli_test.go
@@ -127,3 +127,25 @@ func TestCLIWarningSaysLapseOff(t *testing.T) {
t.Fatalf("warning = %q", got)
}
}
+
+// H4-M11 (the same family as the step-up fix): whether a CLI's request
+// counts as the OWNER receiving notice compares the principal's address with
+// the owner's exactly, never with a fold. A member whose address only
+// case-folds to the owner's is a different identity and earns no notice.
+func TestCLIWarningFoldEquivalentMemberEarnsNoNotice(t *testing.T) {
+ fx := newConsoleFixture(t)
+ acct := overRow(t, fx)
+ const lookalike = "PAUL@keymail.dev" // the owner is paul@keymail.dev
+ if err := fx.st.AddMember(acct.ID, lookalike, RoleMember, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ // Keymail sign-in now refuses this address (identity.go); a legacy
+ // principal keeps isOwner's own exact comparison under test.
+ token := legacyCLIToken(t, fx, lookalike)
+ if got := cliWarnings(t, fx, token, true); len(got) != 1 {
+ t.Fatalf("member saw %q, want the warning", got)
+ }
+ if st, _ := capRow(t, fx, acct, capStorage); !st.NoticeAt.IsZero() {
+ t.Fatalf("a member whose address folds to the owner's (%s) recorded owner notice", lookalike)
+ }
+}
diff --git a/internal/console/plangracepass.go b/internal/console/plangracepass.go
index 42cc1fca9..14db95b69 100644
--- a/internal/console/plangracepass.go
+++ b/internal/console/plangracepass.go
@@ -456,7 +456,10 @@ func (s *Server) writePlanWarnings(w http.ResponseWriter, r *http.Request, p Pri
}
}
-// isOwner is whether addr owns acct. A lookup failure is "no".
+// isOwner is whether addr owns acct. A lookup failure is "no". The address
+// is compared exactly, as membership lookups are, never with a fold: an
+// address that only case- or Unicode-folds to an owner's is someone else
+// (H4-M11).
func (s *Server) isOwner(acct *Account, addr string) bool {
members, err := s.store.Members(acct.ID)
if err != nil {
@@ -464,7 +467,7 @@ func (s *Server) isOwner(acct *Account, addr string) bool {
return false
}
for _, m := range members {
- if m.Role == RoleOwner && strings.EqualFold(m.Name, addr) {
+ if m.Role == RoleOwner && m.Name == addr {
return true
}
}
diff --git a/internal/console/server.go b/internal/console/server.go
index 1972d1e89..8d737cdcb 100644
--- a/internal/console/server.go
+++ b/internal/console/server.go
@@ -23,7 +23,6 @@ import (
mrand "math/rand/v2"
"net"
"net/http"
- netmail "net/mail"
"net/url"
"os"
"regexp"
@@ -3177,53 +3176,6 @@ func (s *Server) memberAccount(ctx context.Context, addr string) (*Account, erro
return nil, nil
}
-// mintAccount creates an account owned by addr: the next free id allocated in
-// the bucket, its frozen sqid, and the console DB rows.
-//
-// The bucket write comes FIRST and is no longer best-effort, because it is now
-// the allocator: the id is claimed by a create-only manifest write, which is
-// what stops two boxes minting the same integer at the same moment. A console
-// row whose manifest never landed would be an account that vanishes on the
-// next rebuild — worse than a "new account" button that reports the outage.
-//
-// The name is NOT validated here: auto-mint names personal accounts by
-// keymail address, and landing must never refuse to mint (spec §1).
-func (s *Server) mintAccount(ctx context.Context, name, ownerAddr string) (*Account, error) {
- now := time.Now()
- id, sqid, err := domains.MintAccount(ctx, s.cfg.Releases, name, ownerAddr, now)
- if err != nil {
- return nil, err
- }
- // The default-on analytics setting is written after the manifest and
- // before the membership is published, so an account that exists for its
- // owner always has it. A failure is handled like a failed CreateAccount
- // below: the account is stranded and the caller reports the outage.
- if err := s.startNewAccountAnalytics(ctx, sqid); err != nil {
- log.Printf("console: minted account %s (id %d, %q) into the bucket but could not turn analytics on: "+
- "%v — accounts/%s/account.json is stranded with no owner", sqid, id, name, err, sqid)
- return nil, err
- }
- if err := s.store.CreateAccount(id, sqid, name, ownerAddr, now); err != nil {
- // The manifest already landed, so the id is claimed and there is now an
- // account in the bucket with no console row and no owner. It is
- // unreachable rather than dangerous (no membership means no access, and
- // materialization gives it no members either), and the next mint simply
- // takes the id after it. But without this line the only trace is a 500
- // in the user's browser: name the sqid so the stranded account can be
- // found and either adopted with `console member -add … -role owner` or
- // deleted from the bucket.
- log.Printf("console: minted account %s (id %d, %q) into the bucket but could not record it "+
- "locally: %v — accounts/%s/account.json is stranded with no owner", sqid, id, name, err, sqid)
- return nil, err
- }
- if err := s.store.SetLastAccount(ctx, ownerAddr, id); err != nil {
- log.Printf("console: set last account for %s: %v", ownerAddr, err)
- }
- acct := &Account{ID: id, Sqid: sqid, Name: name, Role: RoleOwner, CreatedAt: now}
- s.auditAccountCreated(acct, ownerAddr)
- return acct, nil
-}
-
// account is the gate on every /a/{seg}/… route: a session, and a segment
// that resolves — as a sqid OR a name, symmetrically — to an account the
// viewer belongs to. Resolution and membership proof are deliberately the
@@ -3417,11 +3369,13 @@ func (s *Server) handleInvite(w http.ResponseWriter, r *http.Request) {
s.setFlash(w, kind, msg)
http.Redirect(w, r, "/a/"+url.PathEscape(acct.Sqid)+"/team", http.StatusSeeOther)
}
- to := strings.ToLower(strings.TrimSpace(r.FormValue("address")))
- // ValidAddress alone lets through "a@x.com,b@y.com" and "x<v@y.com>",
- // which an email To header reads as two recipients or a display name.
- // One bare address only.
- if parsed, err := netmail.ParseAddress(to); !ValidAddress(to) || err != nil || parsed.Address != to {
+ // canonicalAddress: the identity contract's form (identity.go), so the
+ // invitee is exactly the person who can later sign in as it, plus one bare
+ // address only — ValidAddress alone lets through "a@x.com,b@y.com" and
+ // "x<v@y.com>", which an email To header reads as two recipients or a
+ // display name.
+ to, valid := canonicalAddress(r.FormValue("address"))
+ if !valid {
back("err", copyText("team.bad_address"))
return
}
@@ -3912,6 +3866,15 @@ func (s *Server) handleCallback(w http.ResponseWriter, r *http.Request) {
"Keymail did not accept the sign-in. Please start again.")
return
}
+ // The identity contract (identity.go): Keymail's addresses are canonical
+ // when its KEYMAIL_HOST is lowercase ASCII (a deployment prerequisite), so
+ // one that is not is refused, never lower-cased into a different person's
+ // identity.
+ if !isCanonicalIdentity(grant.Address) {
+ log.Printf("console: sign-in refused: Keymail returned a non-canonical address %q", grant.Address)
+ s.renderMessage(w, r, http.StatusForbidden, "Sign-in failed", keymailAddressRefused)
+ return
+ }
var next string
if nc, err := r.Cookie(nextCookie); err == nil {
next = nc.Value
diff --git a/internal/console/stepup.go b/internal/console/stepup.go
index 336dcb25d..43e8d92f8 100644
--- a/internal/console/stepup.go
+++ b/internal/console/stepup.go
@@ -104,6 +104,14 @@ const stepUpUnavailable = "This action needs you to confirm it's really you with
"if this keeps happening, this deployment's Keymail does not support re-authentication " +
"and these actions stay blocked until it does."
+// keymailAddressRefused is the sign-in answer when Keymail vouches for an
+// address that is not in the identity contract's canonical form
+// (identity.go). Keymail's mailbox names are lowercase ASCII and the rest is
+// its KEYMAIL_HOST, so on a deployment meeting that prerequisite (a lowercase
+// ASCII KEYMAIL_HOST) this means a misconfigured or misbehaving identity
+// provider, not a person who typed something wrong.
+const keymailAddressRefused = "Keymail vouched for an address in a form this console can't use, so you have not been signed in."
+
// stepUpHoldFailed is the message when the console cannot hold on to the
// action, or (an email session) cannot send the confirmation for it.
const stepUpHoldFailed = "Could not hold on to that action. Please try again."
@@ -456,7 +464,20 @@ func (s *Server) handleStepUpCallback(w http.ResponseWriter, r *http.Request) {
// a fresh assertion there proves SOME registered passkey was verified, not
// whose. This comparison is what turns it into proof about this session's
// owner: step up with somebody else's passkey and the address won't match.
- if !strings.EqualFold(grant.Address, addr) {
+ //
+ // EXACT bytes, never a fold (H4-M11). Keymail's grant carries no subject
+ // beyond the address, and sign-in keys a Keymail identity by the address
+ // Keymail returns, verbatim (ResolveSignIn), so the session's address IS
+ // that string for the same identity. strings.EqualFold would accept
+ // SAM@... or ſam@... (U+017F folds to "s"): different Keymail identities
+ // that sign-in itself treats as different people.
+ if !isCanonicalIdentity(grant.Address) {
+ log.Printf("console: step-up refused: Keymail returned a non-canonical address for session of %s", addr)
+ s.renderMessage(w, r, http.StatusForbidden, "Not confirmed",
+ "Keymail vouched for an address in a form this console can't use. Nothing has been changed.")
+ return
+ }
+ if grant.Address != addr {
log.Printf("console: step-up address mismatch for session of %s", addr)
s.renderMessage(w, r, http.StatusForbidden, "Not confirmed",
"That passkey belongs to a different Keymail address than the one you're signed in as. Nothing has been changed.")
diff --git a/internal/console/stepup_test.go b/internal/console/stepup_test.go
index bdf79bc63..7b91e3c91 100644
--- a/internal/console/stepup_test.go
+++ b/internal/console/stepup_test.go
@@ -458,3 +458,41 @@ func TestPendingActionStashCapFitsLetterhead(t *testing.T) {
t.Fatalf("parked letterhead is %d bytes, want well under %d", size, pendingFormMax)
}
}
+
+// TestStepUpRefusesANonCanonicalGrant: the identity contract (identity.go)
+// refuses a Keymail address that is not already canonical at step-up as well
+// as at sign-in, even when it is byte-equal to the session's. Such a session
+// can only be a legacy row (sign-in now refuses the address), and it must not
+// gain fresh presence from it.
+func TestStepUpRefusesANonCanonicalGrant(t *testing.T) {
+ fx := newConsoleFixture(t)
+ const legacy = "Sam@keymail.dev"
+ if err := fx.st.AddMember(OpsAccountID, legacy, RoleOwner, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ if err := fx.st.AddMember(OpsAccountID, "kim@keymail.dev", RoleMember, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ raw, err := fx.st.CreateSessionMethod(legacy, "", MethodKeymail, time.Now())
+ if err != nil {
+ t.Fatal(err)
+ }
+ c := newBrowser(t)
+ u, _ := url.Parse(fx.ts.URL)
+ c.Jar.SetCookies(u, []*http.Cookie{{Name: sessionCookie, Value: raw, Path: "/"}})
+ fx.setUser(legacy)
+ status, loc, _ := postForm(t, c, fx.u("/members/remove"),
+ url.Values{"csrf": {raw}, "address": {"kim@keymail.dev"}})
+ if status != http.StatusSeeOther || !strings.HasPrefix(loc, fx.fk.srv.URL) {
+ t.Fatalf("gated removal = %d -> %q, want a redirect into Keymail", status, loc)
+ }
+ if status, _, _ := completeStepUp(t, fx, c, loc); status != http.StatusForbidden {
+ t.Errorf("step-up with a non-canonical grant = %d, want 403", status)
+ }
+ if fx.st.FreshStepUp(raw, legacy, time.Now(), StepUpWindow) {
+ t.Error("a non-canonical grant recorded presence")
+ }
+ if role, _ := fx.st.Role(OpsAccountID, "kim@keymail.dev"); role != RoleMember {
+ t.Errorf("the held removal ran (kim's role now %q)", role)
+ }
+}
diff --git a/internal/console/storenotify.go b/internal/console/storenotify.go
index 0adde9024..a5b739d1b 100644
--- a/internal/console/storenotify.go
+++ b/internal/console/storenotify.go
@@ -51,22 +51,26 @@ func (s *Server) storeNotificationRecipients() (*alertRun, error) {
return nil, fmt.Errorf("operators: %w", err)
}
fleet := make(map[string]bool, len(operators))
+ // Stored rows exactly as they are (identity.go): a legacy non-canonical
+ // operator row is not re-canonicalised into its lower-case twin.
for _, address := range operators {
- fleet[strings.ToLower(strings.TrimSpace(address))] = true
+ if isCanonicalIdentity(address) {
+ fleet[address] = true
+ }
}
configured := make([]string, 0, len(s.cfg.StoreOperators))
for _, address := range s.cfg.StoreOperators {
- address = strings.ToLower(strings.TrimSpace(address))
- if fleet[address] {
- configured = append(configured, address)
+ if c, ok := canonicalIdentity(address); ok && fleet[c] {
+ configured = append(configured, c)
}
}
return s.grantRecipients(configured)
}
func (s *Server) notifyStoreDecided(account string, e *objstore.Entitlement) {
- address := strings.ToLower(strings.TrimSpace(e.Applied.By))
- run, err := s.grantRecipients([]string{address})
+ // The By of a stored record is a principal: used exactly (grantRecipients
+ // skips it when it is not canonical).
+ run, err := s.grantRecipients([]string{e.Applied.By})
if err != nil {
log.Printf("console: store decision %s: recipient: %v", account, err)
return
diff --git a/internal/console/storenotify_test.go b/internal/console/storenotify_test.go
index 39f1de46d..dcd1a7ca0 100644
--- a/internal/console/storenotify_test.go
+++ b/internal/console/storenotify_test.go
@@ -92,7 +92,7 @@ func TestStoreDecisionNoticeByEmail(t *testing.T) {
m := &fakeConsoleMail{ready: true}
fx.srv.consoleMail = m
e := &objstore.Entitlement{
- Applied: &objstore.Applied{By: "Owner@Example.test", Note: "secret applicant note"},
+ Applied: &objstore.Applied{By: "owner@example.test", Note: "secret applicant note"},
Decision: &objstore.Decision{Approved: true, By: "decider@example.test", Reason: "secret reason"},
}
@@ -131,6 +131,23 @@ func TestStoreDecisionNoticeByEmail(t *testing.T) {
}
}
+// H4-M11 round 2: the applicant on a stored record is a principal, used
+// exactly. A legacy non-canonical applicant (Owner@Example.test) is skipped,
+// never lower-cased into owner@example.test, who is somebody else.
+func TestStoreDecisionNoticeSkipsANonCanonicalApplicant(t *testing.T) {
+ fx := storeNotifyFixture(t)
+ m := &fakeConsoleMail{ready: true}
+ fx.srv.consoleMail = m
+ e := &objstore.Entitlement{
+ Applied: &objstore.Applied{By: "Owner@Example.test"},
+ Decision: &objstore.Decision{Approved: true, By: "decider@example.test"},
+ }
+ fx.srv.notifyStoreEntitlement("bab", e)
+ if len(fx.sent) != 0 || len(m.sentCopy()) != 0 {
+ t.Fatalf("a notice went out for a non-canonical applicant: keymail %+v, email %q", fx.sent, m.sentCopy())
+ }
+}
+
func TestStoreNotificationIsBestEffortAndNilSafe(t *testing.T) {
fx := storeNotifyFixture(t)
fx.srv.cfg.StoreOperators = []string{"ops@keymail.dev"}
diff --git a/internal/domains/mint.go b/internal/domains/mint.go
index f8cfe6b27..6927d3730 100644
--- a/internal/domains/mint.go
+++ b/internal/domains/mint.go
@@ -15,6 +15,7 @@ import (
"sync"
"time"
+ "github.com/carlosframework/platform/internal/identity"
"github.com/carlosframework/platform/internal/release"
)
@@ -48,9 +49,11 @@ type AccountManifest struct {
// CLI-created account and a console-created one end up in the same state
// instead of two.
//
- // Always NORMALIZED (NormalizeAddress) before it is written: the console's
+ // Always CANONICAL (identity.Canonical) before it is written: the console's
// memberships primary key is literal text, so an unnormalized address here
- // would materialize a membership the real session can never match.
+ // would materialize a membership the real session can never match, and an
+ // input that cannot be canonical is refused rather than lower-cased into
+ // somebody else's identity.
Owner string `json:"owner,omitempty"`
// Platform is the sqid of the platform account that created this customer
@@ -83,12 +86,6 @@ type AccountManifest struct {
// Deleted reports whether this manifest is a tombstone.
func (m AccountManifest) Deleted() bool { return !m.DeletedAt.IsZero() }
-// NormalizeAddress is the one normalization every keymail address gets before
-// it is stored or compared: trimmed and lowercased. Defined here, next to the
-// manifest field that carries one, so the CLI can apply the console's rule
-// without importing — or opening — console state.
-func NormalizeAddress(a string) string { return strings.ToLower(strings.TrimSpace(a)) }
-
// ValidAddress is the platform's one shape check on a keymail address:
// <local>@<host>, no whitespace. console.ValidAddress delegates to it, so the
// sign-in form, `console member -add` and `carlos accounts create -owner`
@@ -251,9 +248,16 @@ const nextIDReaders = 16
// reusable. The check happens before the first listing, so a refused mint
// writes nothing at all.
func MintAccount(ctx context.Context, s release.Store, name, owner string, created time.Time) (int64, string, error) {
- owner = NormalizeAddress(owner)
- if owner != "" && !ValidAddress(owner) {
- return 0, "", fmt.Errorf("domains: %q is not a keymail address — expected <user>@<host>, e.g. paul@keymail.dev", owner)
+ if strings.TrimSpace(owner) == "" {
+ owner = ""
+ } else {
+ // The identity contract (internal/identity): refused before anything is
+ // normalised or written, so a Kelvin-sign "K" can never become "k".
+ canonical, ok := identity.Canonical(owner)
+ if !ok {
+ return 0, "", fmt.Errorf("domains: %q is not a keymail address: expected <user>@<host> in plain ASCII, e.g. paul@keymail.dev", owner)
+ }
+ owner = canonical
}
id, sqid, _, err := mint(ctx, s, AccountManifest{Name: name, Owner: owner}, created, nil, nil)
return id, sqid, err
diff --git a/internal/domains/mint_test.go b/internal/domains/mint_test.go
index ec52bbfe0..427db3c3d 100644
--- a/internal/domains/mint_test.go
+++ b/internal/domains/mint_test.go
@@ -10,6 +10,7 @@ import (
"time"
"github.com/carlosframework/platform/internal/domains"
+ "github.com/carlosframework/platform/internal/identity"
"github.com/carlosframework/platform/internal/release"
)
@@ -191,7 +192,9 @@ func TestMintAccountLeavesTheOwnerOutWhenThereIsNone(t *testing.T) {
// address here is permanent, and the id it consumed is not reusable.
func TestMintAccountRefusesAnUnusableOwner(t *testing.T) {
ctx := t.Context()
- for _, bad := range []string{"paul", "@keymail.dev", "paul@", "paul @keymail.dev"} {
+ // The last two are fold twins of ASCII identities (H4-M11): refused, never
+ // lower-cased into kim@ or treated as sam@.
+ for _, bad := range []string{"paul", "@keymail.dev", "paul@", "paul @keymail.dev", "\u212aim@keymail.dev", "ſam@keymail.dev"} {
s := release.NewDirStore(t.TempDir())
if _, _, err := domains.MintAccount(ctx, s, "Kass", bad, time.Now()); err == nil {
t.Errorf("MintAccount with owner %q succeeded", bad)
@@ -209,8 +212,8 @@ func TestMintAccountRefusesAnUnusableOwner(t *testing.T) {
// an address one of them takes and another refuses is a membership somebody
// can create and nobody can use.
func TestAddressNormalizationAndValidity(t *testing.T) {
- if got := domains.NormalizeAddress(" Paul@Keymail.dev\n"); got != "paul@keymail.dev" {
- t.Errorf("NormalizeAddress = %q", got)
+ if got, ok := identity.Canonical(" Paul@Keymail.dev\n"); !ok || got != "paul@keymail.dev" {
+ t.Errorf("identity.Canonical = %q %v", got, ok)
}
for _, ok := range []string{"paul@keymail.dev", "a@b"} {
if !domains.ValidAddress(ok) {
diff --git a/internal/domains/reserved_test.go b/internal/domains/reserved_test.go
index b2b9049b5..fa2ca5427 100644
--- a/internal/domains/reserved_test.go
+++ b/internal/domains/reserved_test.go
@@ -286,15 +286,15 @@ func TestAccountCreationPathsCensus(t *testing.T) {
"domains.NextAccountID(": nil, // only MintAccount, inside this package
"NextAccountID(ctx": {"internal/domains/mint.go"},
"domains.MintAccount(": {
- "accounts.go", // carlos accounts create --owner
- "internal/console/server.go", // Server.mintAccount: landing, /accounts/new, /auth/cli/accounts
+ "accounts.go", // carlos accounts create --owner
+ "internal/console/accountmint.go", // Server.mintAccount: landing, /accounts/new, /auth/cli/accounts
},
"s.mintAccount(": {
"internal/console/authcli.go", // POST /auth/cli/accounts
"internal/console/demo_claim_target.go", // person-locked mint via Server.mintAccount and domains.MintAccount
"internal/console/server.go", // landing mint and POST /accounts/new
},
- ".CreateAccount(": {"internal/console/server.go"}, // inside Server.mintAccount only
+ ".CreateAccount(": {"internal/console/accountmint.go"}, // inside Server.mintAccount only
}
got := map[string][]string{}
err := filepath.WalkDir(root, func(path string, d os.DirEntry, err error) error {
diff --git a/internal/identity/identity.go b/internal/identity/identity.go
new file mode 100644
index 000000000..e9544a64e
--- /dev/null
+++ b/internal/identity/identity.go
@@ -0,0 +1,52 @@
+// Package identity is the platform's one identity contract (H4-M11).
+//
+// An identity is an address in canonical form: trimmed, printable ASCII
+// only, ASCII letters lower-cased, and <local>@<host>. Every place that
+// GRANTS authority to an address (the console's allowlists, invites and
+// member admin, `console grant`, and account minting's owner) takes typed
+// input through Canonical, which refuses anything that cannot be canonical
+// BEFORE it is normalised or written anywhere. Every place that accepts an
+// identity provider's PROOF uses IsCanonical and refuses rather than
+// rewrites. Stored principals are matched exactly and never re-canonicalised:
+// a legacy row is the principal it names, not its lower-case twin.
+//
+// Never Unicode folding or Unicode lower-casing: strings.EqualFold makes
+// U+017F (long s) equal "s", and strings.ToLower maps U+212A (Kelvin sign)
+// to an ASCII "k". Either turns a different identity into this one, so
+// non-ASCII is refused outright and only ASCII A-Z is ever lower-cased.
+//
+// Keymail issues mailbox names that are already lowercase ASCII. The host
+// half of its addresses is its KEYMAIL_HOST setting, so a deployment whose
+// KEYMAIL_HOST is not lowercase ASCII produces addresses this contract
+// refuses: that setting is a deployment prerequisite.
+package identity
+
+import "strings"
+
+// Canonical returns raw in canonical form, or false when raw cannot be one:
+// a non-ASCII or control byte, or not <local>@<host>.
+func Canonical(raw string) (string, bool) {
+ a := strings.TrimSpace(raw)
+ b := []byte(a)
+ for i, c := range b {
+ switch {
+ case c < 0x21 || c > 0x7e:
+ return "", false
+ case 'A' <= c && c <= 'Z':
+ b[i] = c + ('a' - 'A')
+ }
+ }
+ at := strings.LastIndexByte(a, '@')
+ if at <= 0 || at == len(a)-1 {
+ return "", false
+ }
+ return string(b), true
+}
+
+// IsCanonical reports whether a is ALREADY canonical: the test for an address
+// an identity provider vouched for, or a stored principal, which must be
+// refused or skipped rather than rewritten into somebody else.
+func IsCanonical(a string) bool {
+ c, ok := Canonical(a)
+ return ok && c == a
+}
diff --git a/internal/identity/identity_test.go b/internal/identity/identity_test.go
new file mode 100644
index 000000000..424800723
--- /dev/null
+++ b/internal/identity/identity_test.go
@@ -0,0 +1,30 @@
+package identity
+
+import "testing"
+
+func TestCanonical(t *testing.T) {
+ for _, tc := range []struct {
+ in, want string
+ ok bool
+ }{
+ {"sam@keymail.dev", "sam@keymail.dev", true},
+ {" Sam@Keymail.DEV ", "sam@keymail.dev", true},
+ {"paul@localhost:6245", "paul@localhost:6245", true},
+ {"ſam@keymail.dev", "", false}, // U+017F: EqualFold makes it "s"
+ {"Kim@keymail.dev", "", false}, // Kelvin sign: ToLower makes it "k"
+ {"sİm@keymail.dev", "", false}, // dotted capital I
+ {"sam@keymail.dev\x00", "", false},
+ {"sam keymail.dev", "", false},
+ {"sam@", "", false},
+ {"@keymail.dev", "", false},
+ {"", "", false},
+ } {
+ got, ok := Canonical(tc.in)
+ if got != tc.want || ok != tc.ok {
+ t.Errorf("Canonical(%q) = %q %v, want %q %v", tc.in, got, ok, tc.want, tc.ok)
+ }
+ }
+ if IsCanonical("Sam@keymail.dev") || IsCanonical("ſam@keymail.dev") || !IsCanonical("sam@keymail.dev") {
+ t.Error("IsCanonical must accept only an already-canonical address")
+ }
+}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 98bf34d05..2de54575e 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -319,3 +319,4 @@ plan14-root-reads-sec-h5-m8-fleet-hostnames.tsv a6a19c800d55f99ed1c70068e38ffa66
plan14-root-reads-infra-floor-keys-deny.tsv 3d13ade9d1fce3bc1a7d7250d75f2cc5ea3563ca6426401f428ca3a86af19619
plan14-root-reads-sec-h3-m3-envelope.tsv 76f69ece310924c374511605d0f6c718464d6374292961ca6a53955ec36f6e21
plan14-root-reads-sec-h3-m2-scoped-key.tsv 4f307fb962a2aac71640ebc18058c02a29d6c7175b93ff1461317e37b94fca4b
+plan14-root-reads-sec-h4-m11-stepup-fold.tsv 13d05e2a4038ca4978d27a38be07e96025ee6f00f39519c41a3000e2dda3b387
diff --git a/internal/provision/testdata/plan14-root-reads-sec-h4-m11-stepup-fold.tsv b/internal/provision/testdata/plan14-root-reads-sec-h4-m11-stepup-fold.tsv
new file mode 100644
index 000000000..261a565ff
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-sec-h4-m11-stepup-fold.tsv
@@ -0,0 +1,7 @@
+# Census overlay sec-h4-m11-stepup-fold, written by census-propose (#369). census-ruling-sec-h4-m11-stepup-fold, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-sec-h4-m11-stepup-fold.md.
+# 1 body, 0 sites, 3 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+@legacy 96e30c6a527257d5c367950e6981df9c9b8205b08c85a917ab6be4321f979247 accounts.go createAccountInBucket legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-sec-h4-m11-stepup-fold;basis=The --owner input goes through identity.Canonical (internal/identity) instead of domains.NormalizeAddress: same trim and ASCII lower-casing, but a non-ASCII, control-character or malformed owner is refused before the mint, so the Unicode lower-casing that turned a Kelvin-sign K into "k" is gone. The refusal is returned to the command boundary (rawErr; accountsCommand OnError prints and exits 1) instead of a new log.Fatalf. No read added; the bucket read/write sites are unchanged. file:Open@1009 a8e1fd86d3fc1afafb4626f8a84dde3c77508e54b2786f758e94ae983ee2b8fb
+accounts.go createAccountInBucket legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-sec-h4-m11-stepup-fold;basis=The --owner input goes through identity.Canonical (internal/identity) instead of domains.NormalizeAddress: same trim and ASCII lower-casing, but a non-ASCII, control-character or malformed owner is refused before the mint, so the Unicode lower-casing that turned a Kelvin-sign K into "k" is gone. The refusal is returned to the command boundary (rawErr; accountsCommand OnError prints and exits 1) instead of a new log.Fatalf. No read added; the bucket read/write sites are unchanged. file:Open@1009 a8e1fd86d3fc1afafb4626f8a84dde3c77508e54b2786f758e94ae983ee2b8fb
+@coverage . 1c77bf21405e7b99e693472efeadfa2ae2992240f16aa9a09a5b1e0d2503fabf
+@coverage internal/domains 41ec065122c75d46f51307455059ebf07610832478efa9efc9f49a608208f955
+@coverage internal/identity 8f992e48c84fa8144620e4cf6a0f3230f76eae30aa4ee48a5db82bc46b572a74