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:
co-authored by
Claude Opus 5
parent
7eaf0c4190
commit
7a5004f293
@@ -67,7 +67,7 @@ const baseHTML = `<!doctype html>
|
||||
<header>
|
||||
<h1>Echolot</h1>
|
||||
<nav><a href="/">Overview</a><a href="/devices">Devices</a><a href="/runs">Runs</a></nav>
|
||||
<span class="who">{{.Session.Display}}
|
||||
<span class="who">{{.Session.Display}}{{if not .Session.Admin}} <span class="muted">(your account)</span>{{end}}
|
||||
<form method="post" action="/logout" class="inline"><button class="plain">Sign out</button></form>
|
||||
</span>
|
||||
</header>
|
||||
@@ -94,18 +94,28 @@ const baseHTML = `<!doctype html>
|
||||
|
||||
{{else if eq .Page "dashboard"}}
|
||||
<div class="grid">
|
||||
<div class="stat"><b>{{.Devices}}</b><span>devices</span></div>
|
||||
<div class="stat"><b>{{.Linked}}</b><span>signed in</span></div>
|
||||
<div class="stat"><b>{{.Runs}}</b><span>stored runs</span></div>
|
||||
<div class="stat"><b>{{.Devices}}</b><span>{{if .Admin}}devices{{else}}your devices{{end}}</span></div>
|
||||
{{if .Admin}}<div class="stat"><b>{{.Linked}}</b><span>signed in</span></div>{{end}}
|
||||
<div class="stat"><b>{{.Runs}}</b><span>{{if .Admin}}stored runs{{else}}your runs{{end}}</span></div>
|
||||
</div>
|
||||
{{if not .Admin}}
|
||||
<div class="card">
|
||||
<p>This is your account. You can see the devices you have signed in on, review everything
|
||||
they have uploaded, and delete any of it.</p>
|
||||
<p class="muted">Administering the server — enrolling devices, revoking them, and
|
||||
seeing other people's uploads — needs an administrator account.</p>
|
||||
</div>
|
||||
{{end}}
|
||||
{{if .Admin}}
|
||||
<div class="card">
|
||||
<h3>Server</h3>
|
||||
<p class="muted">version {{.Version}}</p>
|
||||
{{with .SelfTest}}<pre>{{printf "%+v" .}}</pre>{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{else if eq .Page "devices"}}
|
||||
<h2>Devices</h2>
|
||||
<h2>{{if .Admin}}Devices{{else}}Your devices{{end}}</h2>
|
||||
{{with .Link}}
|
||||
<div class="card">
|
||||
<p><b>Enrolment link</b> — single use, valid 24 hours. Treat it like a password until spent.</p>
|
||||
@@ -114,10 +124,12 @@ const baseHTML = `<!doctype html>
|
||||
<code>adb shell am start -a android.intent.action.VIEW -d "{{.}}"</code></p>
|
||||
</div>
|
||||
{{end}}
|
||||
{{if .Admin}}
|
||||
<form method="post" action="/enroll-tokens">
|
||||
<input type="hidden" name="csrf" value="{{.CSRF}}">
|
||||
<button>Create enrolment link</button>
|
||||
</form>
|
||||
{{end}}
|
||||
<table>
|
||||
<tr><th>Device</th><th>Name</th><th>Account</th><th>Enrolled</th><th>Runs</th><th></th></tr>
|
||||
{{range .Rows}}
|
||||
@@ -127,17 +139,17 @@ const baseHTML = `<!doctype html>
|
||||
<td>{{if .LinkedToAccount}}{{.AccountName}}{{else}}<span class="muted">not signed in</span>{{end}}</td>
|
||||
<td>{{.Enrolled.Format "2006-01-02 15:04"}}</td>
|
||||
<td>{{.Runs}}</td>
|
||||
<td><form method="post" action="/devices/{{.ID}}/revoke" class="inline">
|
||||
<td>{{if $.Admin}}<form method="post" action="/devices/{{.ID}}/revoke" class="inline">
|
||||
<input type="hidden" name="csrf" value="{{$.CSRF}}">
|
||||
<button class="danger">Revoke</button></form></td>
|
||||
<button class="danger">Revoke</button></form>{{end}}</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
<tr><td colspan="6" class="muted">No devices enrolled.</td></tr>
|
||||
<tr><td colspan="6" class="muted">{{if $.Admin}}No devices enrolled.{{else}}You have not signed in on any device yet. Sign in from the Echolot app to link one.{{end}}</td></tr>
|
||||
{{end}}
|
||||
</table>
|
||||
|
||||
{{else if eq .Page "runs"}}
|
||||
<h2>Uploaded runs</h2>
|
||||
<h2>{{if .Admin}}Uploaded runs{{else}}Your uploaded runs{{end}}</h2>
|
||||
<p class="muted">Shown exactly as uploaded, at the privacy level the uploader chose. Nothing
|
||||
here can un-redact a run.</p>
|
||||
<table>
|
||||
|
||||
Reference in New Issue
Block a user