server: a non-admin account can manage its own uploads

Signing in and being allowed to administer the server were the same
question: the OIDC callback refused a session outright to anyone outside
the admin group. A legitimate user could authenticate, be told what they
could not do, and be left with no way to see or delete the data their own
devices had uploaded.

They are separate questions now. Everyone who authenticates gets a
session; the admin flag rides inside the MAC'd payload, so promoting
yourself means forging a signature rather than editing a cookie, and a
role that does not parse fails closed to "user".

Pages scope themselves through visibleDevices/mayTouchRun rather than
filtering individually — per-page scoping is what the next page added
will be missing, and that failure is silent, since a listing that leaks
other people's uploads looks exactly like one that does not. Someone
else's run answers 404, not 403: a distinguishable refusal would confirm
the run exists. Revoking devices and minting enrolment tokens affect the
whole server and stay behind adminOnly at the route table, where someone
looking for who-may-do-what will actually find it.

Ownership is re-read per request instead of captured at sign-in, so
unlinking an account takes effect immediately rather than at session
expiry. Tests cover that, plus the degenerate case of an empty subject,
which must own nothing rather than everything with an empty account id.

Also: attribute the ICMPv6 finding per network. It compared "is IPv6
configured anywhere on this device" against "did any network answer",
which on a phone reports IPv6-is-broken about a network where IPv6 was
never configured. network_ref is null on every test, so the probe now
records per-network outcomes structurally rather than as prose a finding
would have to parse.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
mrambossek
2026-08-01 21:10:38 +02:00
co-authored by Claude Opus 5
parent 7eaf0c4190
commit 7a5004f293
8 changed files with 404 additions and 64 deletions
@@ -40,24 +40,35 @@ class IcmpProbe(
override suspend fun run(ctx: Context, ids: ProbeIds): Test = withContext(Dispatchers.IO) {
val b = TestBuilder(type, tier, ids)
val perNetwork = LinkedHashMap<String, String>()
val perNetwork = LinkedHashMap<String, Triple<String?, Boolean, String>>()
var anyOk = false
val rtts = ArrayList<Double>()
// Default network first, then each active network explicitly.
attempt(null).let { (ok, detail, rtt) ->
perNetwork["default"] = detail; if (ok) { anyOk = true; rtt?.let(rtts::add) }
perNetwork["default"] = Triple(null, ok, detail); if (ok) { anyOk = true; rtt?.let(rtts::add) }
}
for (e in entries) {
val label = "${e.model.transport.name.lowercase()}:${e.model.id}"
val (ok, detail, rtt) = attempt(e.handle)
perNetwork[label] = detail
perNetwork[label] = Triple(e.model.id, ok, detail)
if (ok) { anyOk = true; rtt?.let(rtts::add) }
}
// Per-network results are recorded structurally, not just as prose. The aggregate status
// can only say "some network answered"; a finding needs to know *which* network failed,
// and recovering that by parsing a human-readable detail string would be a trap waiting to
// spring the first time the wording changes.
val evidence: JsonObject = buildJsonObject {
put("target", target)
for ((k, v) in perNetwork) put(k, v)
for ((label, r) in perNetwork) {
val (netId, ok, detail) = r
put(label, buildJsonObject {
netId?.let { put("network_ref", it) }
put("ok", ok)
put("detail", detail)
})
}
}
val metrics: JsonObject = buildJsonObject {
put("networks_ok", rtts.size)