Repository navigation
Expand file tree
/
Copy pathauthentication.html
More file actions
230 lines (217 loc) · 11.1 KB
/
Copy pathauthentication.html
File metadata and controls
230 lines (217 loc) · 11.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<!--
SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: Apache-2.0
-->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Nomos Authentication Explorer</title>
<link rel="stylesheet" href="assets/interactive-docs.css">
</head>
<body>
<main class="shell">
<header class="hero">
<div>
<p class="eyebrow">Auth and permissions</p>
<h1>Explore token auth, membership, and command scopes</h1>
<p class="lead">
Choose an account shape and command. The explorer shows the authentication path,
required permission scopes, council membership check, and final pre-council outcome.
</p>
</div>
<aside class="hero-card">
<h2>Identity rule</h2>
<p>The authenticated token resolves the agent identity. Caller-supplied <code>agent_id</code> is not trusted when it conflicts with the token.</p>
</aside>
</header>
<nav class="nav">
<a href="../index.md">Docs index</a>
<a href="../architecture.md#authentication">Authentication reference</a>
<a href="multi-council.html">Multi-council routing</a>
<a href="../../agent_signup/README.md">Agent signup</a>
</nav>
<section>
<div class="section-head">
<h2>Authorization Precheck Explorer</h2>
<p>This models the deterministic layers before LLM council voting.</p>
</div>
<div class="control-panel">
<div class="controls">
<div class="field">
<label for="role">Account role</label>
<select id="role">
<option value="developer">developer</option>
<option value="readonly">readonly</option>
<option value="operator">operator</option>
<option value="admin">admin</option>
<option value="demo">demo</option>
</select>
</div>
<div class="field">
<label for="status">Account status</label>
<select id="status">
<option value="enabled">enabled</option>
<option value="disabled">disabled</option>
<option value="bad-token">bad token</option>
<option value="rate-limited">rate limited</option>
</select>
</div>
<div class="field">
<label for="council">Council petitioned</label>
<select id="council">
<option value="council-prod">council-prod</option>
<option value="council-git-workflow">council-git-workflow</option>
<option value="council-infra-prod">council-infra-prod</option>
</select>
</div>
<div class="field">
<label for="membership">Account councils (granted per account)</label>
<select id="membership">
<option value="council-prod">["council-prod"]</option>
<option value="council-prod,council-git-workflow">["council-prod", "council-git-workflow"]</option>
<option value="*">["*"] — wildcard</option>
<option value="">[] — none</option>
</select>
</div>
<div class="field grow">
<label for="command">Command</label>
<input id="command" value="/usr/bin/git status --short">
</div>
</div>
</div>
<div class="result-grid" style="margin-top:14px">
<div class="stage">
<h3 class="stage-title" id="title">Precheck result</h3>
<p class="stage-copy" id="copy"></p>
<div class="node-row" aria-hidden="true">
<div class="node active" id="auth-node">Token</div>
<div class="connector active"></div>
<div class="node" id="member-node">Membership</div>
<div class="connector" id="perm-line"></div>
<div class="node" id="perm-node">Permissions</div>
</div>
<div class="callout" id="note"></div>
</div>
<aside class="result-card">
<h3>Computed scopes</h3>
<div class="pill-row" id="scope-pills"></div>
<pre class="codebox light" id="summary" style="margin-top:12px"></pre>
</aside>
</div>
</section>
<section>
<div class="section-head">
<h2>Role Presets</h2>
<p>Account CLI roles expand to permission scope sets (<code>nomos/auth/permissions.py</code>). A role says nothing about which councils the account may petition — that is the account's own <code>councils</code> set, written with <code>--council</code> (repeatable; omitting it grants <code>--default-council</code> only). A stored value of <code>"*"</code> in that set matches every council — it is a membership value an operator grants, not a property of the <code>admin</code> role.</p>
</div>
<table class="matrix">
<thead><tr><th>Role</th><th>Permissions</th></tr></thead>
<tbody>
<tr><td><code>readonly</code></td><td><code>shell:read</code>, <code>file:read</code></td></tr>
<tr><td><code>developer</code></td><td>read/write shell and file scopes</td></tr>
<tr><td><code>operator</code></td><td>developer scopes plus <code>infra:deploy</code></td></tr>
<tr><td><code>admin</code></td><td>every scope — the only role granting <code>infra:destroy</code></td></tr>
<tr><td><code>demo</code></td><td>mirrors <code>developer</code>; kept distinct so the demo persona can be re-scoped separately</td></tr>
</tbody>
</table>
</section>
<footer>Reference: <a href="../architecture.md#authentication">Authentication reference</a>.</footer>
</main>
<script>
// ROLE_PERMISSIONS in nomos/auth/permissions.py. Council membership is NOT a
// property of the role: it is the account's own `councils` set, written by
// `--council` on the account CLI, and "*" in that set matches any council.
const rolePerms = {
readonly: ["shell:read", "file:read"],
developer: ["shell:read", "shell:write", "file:read", "file:write"],
operator: ["shell:read", "shell:write", "file:read", "file:write", "infra:deploy"],
admin: ["shell:read", "shell:write", "file:read", "file:write", "file:delete", "infra:deploy", "infra:destroy", "tool:write"],
demo: ["shell:read", "shell:write", "file:read", "file:write"]
};
const readOnly = new Set(["ls", "cat", "grep", "rg", "find", "ps", "git", "pwd", "head", "tail", "whoami", "date"]);
const shellWrite = new Set(["mkdir", "cp", "mv", "chmod", "chown", "tar", "git"]);
const fileWrite = new Set(["touch", "tee", "dd", "sed"]);
const fileDelete = new Set(["rm", "rmdir", "unlink", "shred"]);
const els = {
role: document.querySelector("#role"),
status: document.querySelector("#status"),
council: document.querySelector("#council"),
membership: document.querySelector("#membership"),
command: document.querySelector("#command"),
title: document.querySelector("#title"),
copy: document.querySelector("#copy"),
note: document.querySelector("#note"),
scopes: document.querySelector("#scope-pills"),
summary: document.querySelector("#summary"),
authNode: document.querySelector("#auth-node"),
memberNode: document.querySelector("#member-node"),
permNode: document.querySelector("#perm-node"),
permLine: document.querySelector("#perm-line")
};
function baseCommand(command) {
const first = command.trim().split(/\s+/)[0] || "";
return first.split("/").pop();
}
function categorize(command) {
const cmd = baseCommand(command);
const scopes = new Set();
if (!cmd) scopes.add("shell:read");
if (command.includes(">")) scopes.add("file:write");
if (command.includes("kubectl delete") || command.includes("terraform destroy") || command.includes("helm uninstall")) scopes.add("infra:destroy");
else if (command.includes("kubectl apply") || command.includes("terraform apply") || command.includes("helm install")) scopes.add("infra:deploy");
else if (fileDelete.has(cmd)) scopes.add("file:delete");
else if (fileWrite.has(cmd)) scopes.add("file:write");
else if (shellWrite.has(cmd) && !command.includes("git status") && !command.includes("git diff") && !command.includes("git log")) scopes.add("shell:write");
else if (readOnly.has(cmd)) scopes.add("shell:read");
else {
scopes.add("shell:read");
scopes.add("shell:write");
}
return Array.from(scopes);
}
function render() {
const role = els.role.value;
const status = els.status.value;
const council = els.council.value;
const required = categorize(els.command.value);
const perms = rolePerms[role];
const councils = els.membership.value ? els.membership.value.split(",") : [];
const member = councils.includes("*") || councils.includes(council);
const missing = required.filter((scope) => !perms.includes(scope));
let outcome = "allowed";
let reason = "Authentication, membership, and permission checks pass. The request can continue to OPA and council review.";
if (status === "bad-token") { outcome = "denied"; reason = "Token hash was not found in the reverse index."; }
else if (status === "rate-limited") { outcome = "denied"; reason = "Too many failed auth attempts for this token hash."; }
else if (status === "disabled") { outcome = "denied"; reason = "The account exists but is disabled."; }
else if (!member) { outcome = "denied"; reason = `The account's councils ${JSON.stringify(councils)} do not include ${council}.`; }
else if (missing.length) { outcome = "denied"; reason = `The account lacks required scope(s): ${missing.join(", ")}.`; }
els.title.textContent = outcome === "allowed" ? "Precheck passes" : "Precheck denies";
els.copy.textContent = reason;
els.authNode.textContent = status === "enabled" ? "Auth OK" : "Auth denied";
els.memberNode.textContent = member ? "Member" : "Not member";
els.permNode.textContent = missing.length ? "Missing scopes" : "Scopes OK";
els.permLine.classList.toggle("active", outcome === "allowed");
els.note.innerHTML = outcome === "allowed"
? "OPA still runs next. The deterministic checks here do not replace policy or LLM review."
: "The council does not spend LLM work on requests that fail authentication, membership, or required permission checks.";
els.scopes.innerHTML = required.map((scope) => `<span class="pill ${missing.includes(scope) ? "bad" : "good"}">${scope}</span>`).join("");
els.summary.textContent = JSON.stringify({
role,
status,
council_id: council,
account_councils: councils,
command: els.command.value,
required_scopes: required,
account_permissions: perms,
member_of_council: member,
missing_permissions: missing,
outcome
}, null, 2);
}
[els.role, els.status, els.council, els.membership, els.command].forEach((el) => el.addEventListener("input", render));
render();
</script>
</body>
</html>