aac-cli 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aac_cli/__init__.py +8 -0
- aac_cli/__main__.py +6 -0
- aac_cli/cli.py +575 -0
- aac_cli/config.py +327 -0
- aac_cli-0.1.0.dist-info/METADATA +157 -0
- aac_cli-0.1.0.dist-info/RECORD +10 -0
- aac_cli-0.1.0.dist-info/WHEEL +5 -0
- aac_cli-0.1.0.dist-info/entry_points.txt +2 -0
- aac_cli-0.1.0.dist-info/licenses/LICENSE +177 -0
- aac_cli-0.1.0.dist-info/top_level.txt +1 -0
aac_cli/__init__.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""aac-cli — the `aac` platform CLI (Eng Spec §XII, Stage 2 subset).
|
|
2
|
+
|
|
3
|
+
Import package is `aac_cli`, NOT `aac`: the SDK owns the `aac` import
|
|
4
|
+
package, and the console script named `aac` is this package's
|
|
5
|
+
entrypoint (`aac_cli.cli:entrypoint`).
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
__version__ = "0.1.0"
|
aac_cli/__main__.py
ADDED
aac_cli/cli.py
ADDED
|
@@ -0,0 +1,575 @@
|
|
|
1
|
+
"""The `aac` command surface — Stage 2 Python subset of Eng Spec §XII.
|
|
2
|
+
|
|
3
|
+
Three commands ship in Stage 2:
|
|
4
|
+
|
|
5
|
+
* ``aac configure`` (B117) — interactive writer for ``~/.aac/config``
|
|
6
|
+
with aws-configure semantics: prompts show ``[current-or-default]``,
|
|
7
|
+
Enter keeps the bracket value, all-flags = non-interactive.
|
|
8
|
+
``aac configure list`` shows the effective settings + the source of
|
|
9
|
+
each. NEVER prompts for credentials (deliberate aws deviation —
|
|
10
|
+
api_keys are minted server-side at registration).
|
|
11
|
+
* ``aac tenant register`` — POST /v1/tenants on the ADMIN surface;
|
|
12
|
+
stores the one-time api_key at ``~/.aac/credentials/{tenant_id}``
|
|
13
|
+
(0600) and prints it EXACTLY ONCE.
|
|
14
|
+
* ``aac chain show`` — GET /v1/trace/{token_id}/cross-org-events on
|
|
15
|
+
the data-plane surface (participant-tenant Bearer auth, Week 12);
|
|
16
|
+
``--render`` additionally fetches the interactive HTML AEG to a file
|
|
17
|
+
(headless-first per the Equifax requirement: writing a file is the
|
|
18
|
+
default deliverable; ``--open`` launches a browser for operators who
|
|
19
|
+
have one).
|
|
20
|
+
|
|
21
|
+
Conventions (§XII, AWS-CLI-styled): JSON output by default,
|
|
22
|
+
``--output table`` alternative, ``--profile`` for multi-tenant
|
|
23
|
+
operators, and the originator-cli exit-code contract:
|
|
24
|
+
|
|
25
|
+
0 — success
|
|
26
|
+
1 — server rejected the request (4xx/5xx envelope printed)
|
|
27
|
+
2 — control plane unreachable
|
|
28
|
+
3 — CLI/user input error (bad flags, missing credential/profile)
|
|
29
|
+
|
|
30
|
+
Timelines served here are §V.2.1 METADATA-TIER — summaries synthesized
|
|
31
|
+
from redacted fields; the tenant's own SIEM stream carries the full
|
|
32
|
+
narrative (§6.1 federated join). The table renderer says so in its
|
|
33
|
+
footer rather than implying completeness.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
from __future__ import annotations
|
|
37
|
+
|
|
38
|
+
import argparse
|
|
39
|
+
import json
|
|
40
|
+
import sys
|
|
41
|
+
import webbrowser
|
|
42
|
+
from pathlib import Path
|
|
43
|
+
|
|
44
|
+
import httpx
|
|
45
|
+
|
|
46
|
+
from aac_cli import __version__
|
|
47
|
+
from aac_cli.config import (
|
|
48
|
+
DEFAULT_SETTINGS,
|
|
49
|
+
CliConfigError,
|
|
50
|
+
ResolvedConfig,
|
|
51
|
+
read_api_key,
|
|
52
|
+
read_profile_settings,
|
|
53
|
+
resolve_config,
|
|
54
|
+
resolve_settings,
|
|
55
|
+
write_api_key,
|
|
56
|
+
write_profile,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
__all__ = ["build_parser", "entrypoint", "main"]
|
|
60
|
+
|
|
61
|
+
_REQUEST_TIMEOUT_SECONDS = 10.0
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# ---------------------------------------------------------------------------
|
|
65
|
+
# Shared helpers
|
|
66
|
+
# ---------------------------------------------------------------------------
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _print_error_envelope(response: httpx.Response) -> None:
|
|
70
|
+
"""Render a non-2xx control-plane response (envelope-aware).
|
|
71
|
+
|
|
72
|
+
Robust to anything a proxy/LB might return (review M2): JSON
|
|
73
|
+
non-dicts, envelope-less dicts, and non-JSON all degrade to the
|
|
74
|
+
raw-body line — never a traceback.
|
|
75
|
+
"""
|
|
76
|
+
try:
|
|
77
|
+
body = response.json()
|
|
78
|
+
except ValueError:
|
|
79
|
+
body = None
|
|
80
|
+
error = body.get("error") if isinstance(body, dict) else None
|
|
81
|
+
if isinstance(error, dict):
|
|
82
|
+
code = error.get("code", "?")
|
|
83
|
+
message = error.get("message", response.text[:200])
|
|
84
|
+
print(f"error {response.status_code} {code}: {message}", file=sys.stderr)
|
|
85
|
+
else:
|
|
86
|
+
print(
|
|
87
|
+
f"error {response.status_code}: {response.text[:200]}", file=sys.stderr
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _add_common_flags(parser: argparse.ArgumentParser) -> None:
|
|
92
|
+
parser.add_argument(
|
|
93
|
+
"--profile",
|
|
94
|
+
default="default",
|
|
95
|
+
help="Config profile in ~/.aac/config (AWS-CLI semantics).",
|
|
96
|
+
)
|
|
97
|
+
parser.add_argument(
|
|
98
|
+
"--admin-url", default=None, help="Admin-surface base URL (overrides profile)."
|
|
99
|
+
)
|
|
100
|
+
parser.add_argument(
|
|
101
|
+
"--data-plane-url",
|
|
102
|
+
default=None,
|
|
103
|
+
help="Data-plane-surface base URL (overrides profile).",
|
|
104
|
+
)
|
|
105
|
+
parser.add_argument(
|
|
106
|
+
"--output",
|
|
107
|
+
choices=("json", "table"),
|
|
108
|
+
default="json",
|
|
109
|
+
help="Output mode (§XII: JSON by default).",
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def _resolve(args: argparse.Namespace) -> ResolvedConfig:
|
|
114
|
+
return resolve_config(
|
|
115
|
+
profile=args.profile,
|
|
116
|
+
admin_url_flag=args.admin_url,
|
|
117
|
+
data_plane_url_flag=args.data_plane_url,
|
|
118
|
+
tenant_id_flag=getattr(args, "tenant_id", None),
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
# ---------------------------------------------------------------------------
|
|
123
|
+
# aac configure (B117 — aws-configure semantics)
|
|
124
|
+
# ---------------------------------------------------------------------------
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def _cmd_configure(args: argparse.Namespace) -> int:
|
|
128
|
+
"""Write the three settings to the target profile, aws-style.
|
|
129
|
+
|
|
130
|
+
Prompt semantics (D3, user-ratified 2026-07-16): the bracket shows
|
|
131
|
+
the profile's CURRENT file value, falling back to the built-in
|
|
132
|
+
default (localhost urls — real working dev-compose values, a
|
|
133
|
+
deliberate deviation from aws's ``[None]``), falling back to
|
|
134
|
+
``None``. Empty input keeps the bracket value; keeping ``None``
|
|
135
|
+
writes nothing for that key. A setting supplied via flag is
|
|
136
|
+
written without prompting — all three flags = fully
|
|
137
|
+
non-interactive (scriptable).
|
|
138
|
+
|
|
139
|
+
Deliberately NOT here: credentials (D1 — minted server-side at
|
|
140
|
+
``aac tenant register``, never typed) and any connectivity check
|
|
141
|
+
(aws configure doesn't dial; neither do we).
|
|
142
|
+
"""
|
|
143
|
+
current = read_profile_settings(args.profile)
|
|
144
|
+
flag_values = {
|
|
145
|
+
"admin_url": args.admin_url,
|
|
146
|
+
"data_plane_url": args.data_plane_url,
|
|
147
|
+
"tenant_id": args.tenant_id,
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
to_write: dict[str, str] = {}
|
|
151
|
+
for name, built_in_default in DEFAULT_SETTINGS.items():
|
|
152
|
+
if flag_values[name]:
|
|
153
|
+
to_write[name] = flag_values[name]
|
|
154
|
+
continue
|
|
155
|
+
bracket_value = current.get(name) or built_in_default
|
|
156
|
+
try:
|
|
157
|
+
typed = input(f"{name} [{bracket_value or 'None'}]: ").strip()
|
|
158
|
+
except (EOFError, KeyboardInterrupt):
|
|
159
|
+
# Piped-stdin underrun, Ctrl-D, or Ctrl-C mid-prompt: abort
|
|
160
|
+
# without writing — a half-answered configure must not
|
|
161
|
+
# half-write. KeyboardInterrupt handled HERE (review M2):
|
|
162
|
+
# it is a BaseException, so main()'s contract-preserving
|
|
163
|
+
# `except Exception` cannot keep it inside 0/1/2/3, and
|
|
164
|
+
# Ctrl-C is the natural abort gesture at a prompt.
|
|
165
|
+
print("\naac configure aborted; nothing written", file=sys.stderr)
|
|
166
|
+
return 3
|
|
167
|
+
if typed:
|
|
168
|
+
to_write[name] = typed
|
|
169
|
+
elif bracket_value is not None:
|
|
170
|
+
# Enter = accept the bracket value. For a brand-new profile
|
|
171
|
+
# this MATERIALIZES the built-in default into the file
|
|
172
|
+
# (ratified D3) — harmless, identical to the fallback.
|
|
173
|
+
to_write[name] = bracket_value
|
|
174
|
+
# Enter on [None] (tenant_id, fresh profile): stays unset.
|
|
175
|
+
|
|
176
|
+
config_path = write_profile(args.profile, to_write)
|
|
177
|
+
print(f"profile [{args.profile}] written to {config_path}", file=sys.stderr)
|
|
178
|
+
return 0
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def _cmd_configure_list(args: argparse.Namespace) -> int:
|
|
182
|
+
"""Effective settings + the source of each (aws `configure list`).
|
|
183
|
+
|
|
184
|
+
Reuses `resolve_settings` — the SAME precedence walk every network
|
|
185
|
+
command uses — so what this prints is what `chain show` would do.
|
|
186
|
+
"""
|
|
187
|
+
settings = resolve_settings(
|
|
188
|
+
profile=args.profile,
|
|
189
|
+
admin_url_flag=args.admin_url,
|
|
190
|
+
data_plane_url_flag=args.data_plane_url,
|
|
191
|
+
tenant_id_flag=args.tenant_id,
|
|
192
|
+
)
|
|
193
|
+
if args.output == "table":
|
|
194
|
+
print(f"{'setting':<16} {'value':<40} source")
|
|
195
|
+
for name, resolved in settings.items():
|
|
196
|
+
# `is None`, not falsy (review N2): an empty-string value
|
|
197
|
+
# should render as itself, matching the JSON branch.
|
|
198
|
+
shown = "<not set>" if resolved.value is None else resolved.value
|
|
199
|
+
print(f"{name:<16} {shown:<40} {resolved.source}")
|
|
200
|
+
else:
|
|
201
|
+
print(
|
|
202
|
+
json.dumps(
|
|
203
|
+
{
|
|
204
|
+
"profile": args.profile,
|
|
205
|
+
"settings": {
|
|
206
|
+
name: {"value": resolved.value, "source": resolved.source}
|
|
207
|
+
for name, resolved in settings.items()
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
indent=2,
|
|
211
|
+
)
|
|
212
|
+
)
|
|
213
|
+
return 0
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
# ---------------------------------------------------------------------------
|
|
217
|
+
# aac tenant register
|
|
218
|
+
# ---------------------------------------------------------------------------
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def _cmd_tenant_register(args: argparse.Namespace) -> int:
|
|
222
|
+
config = _resolve(args)
|
|
223
|
+
body: dict = {
|
|
224
|
+
"tenant_id": args.tenant_id,
|
|
225
|
+
"display_name": args.display_name,
|
|
226
|
+
"contact": args.contact,
|
|
227
|
+
"workloads": [
|
|
228
|
+
{"spiffe_id": spiffe_id} for spiffe_id in (args.workload_spiffe_id or [])
|
|
229
|
+
],
|
|
230
|
+
"agents": [],
|
|
231
|
+
}
|
|
232
|
+
if args.parent_tenant_id:
|
|
233
|
+
body["parent_tenant_id"] = args.parent_tenant_id
|
|
234
|
+
if args.tenant_admin_pubkey_file:
|
|
235
|
+
try:
|
|
236
|
+
body["tenant_admin_pubkey_pem"] = Path(
|
|
237
|
+
args.tenant_admin_pubkey_file
|
|
238
|
+
).read_text(encoding="utf-8")
|
|
239
|
+
except OSError as exc:
|
|
240
|
+
print(f"cannot read tenant-admin pubkey: {exc}", file=sys.stderr)
|
|
241
|
+
return 3
|
|
242
|
+
|
|
243
|
+
try:
|
|
244
|
+
response = httpx.post(
|
|
245
|
+
f"{config.admin_url}/v1/tenants",
|
|
246
|
+
json=body,
|
|
247
|
+
timeout=_REQUEST_TIMEOUT_SECONDS,
|
|
248
|
+
)
|
|
249
|
+
except httpx.HTTPError as exc:
|
|
250
|
+
print(
|
|
251
|
+
f"failed to reach the control plane admin surface at "
|
|
252
|
+
f"{config.admin_url}: {type(exc).__name__}: {exc}",
|
|
253
|
+
file=sys.stderr,
|
|
254
|
+
)
|
|
255
|
+
return 2
|
|
256
|
+
if response.status_code != 201:
|
|
257
|
+
_print_error_envelope(response)
|
|
258
|
+
return 1
|
|
259
|
+
|
|
260
|
+
payload = response.json()
|
|
261
|
+
api_key, key_id = payload["api_key"], payload["key_id"]
|
|
262
|
+
# Review H2: the key is shown EXACTLY ONCE and is unretrievable
|
|
263
|
+
# after this response — a failed credential WRITE must never
|
|
264
|
+
# swallow it. Print-despite-failure, warn loudly, exit 3.
|
|
265
|
+
try:
|
|
266
|
+
stored_at: Path | None = write_api_key(args.tenant_id, api_key)
|
|
267
|
+
except OSError as exc:
|
|
268
|
+
stored_at = None
|
|
269
|
+
print(
|
|
270
|
+
f"WARNING: could not store the credential ({exc}) — the "
|
|
271
|
+
f"api_key below is shown ONCE and is NOT retrievable again; "
|
|
272
|
+
f"store it by hand at ~/.aac/credentials/{args.tenant_id} "
|
|
273
|
+
f"(mode 0600).",
|
|
274
|
+
file=sys.stderr,
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
if args.output == "table":
|
|
278
|
+
print(f"tenant_id : {args.tenant_id}")
|
|
279
|
+
print(f"key_id : {key_id}")
|
|
280
|
+
print(f"api_key : {api_key}")
|
|
281
|
+
print(f"stored_at : {stored_at or 'NOT STORED — see warning'}")
|
|
282
|
+
print(
|
|
283
|
+
"\nNOTE: this api_key is shown EXACTLY ONCE and cannot be "
|
|
284
|
+
"retrieved again — only its peppered hash is stored server-side."
|
|
285
|
+
)
|
|
286
|
+
else:
|
|
287
|
+
print(
|
|
288
|
+
json.dumps(
|
|
289
|
+
{
|
|
290
|
+
"tenant_id": args.tenant_id,
|
|
291
|
+
"key_id": key_id,
|
|
292
|
+
"api_key": api_key,
|
|
293
|
+
"stored_at": str(stored_at) if stored_at else None,
|
|
294
|
+
"note": "api_key shown exactly once; not retrievable again",
|
|
295
|
+
},
|
|
296
|
+
indent=2,
|
|
297
|
+
)
|
|
298
|
+
)
|
|
299
|
+
return 0 if stored_at else 3
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
# ---------------------------------------------------------------------------
|
|
303
|
+
# aac chain show
|
|
304
|
+
# ---------------------------------------------------------------------------
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
def _render_timeline_table(body: dict) -> str:
|
|
308
|
+
lines = [
|
|
309
|
+
f"root_token_id: {body['root_token_id']}",
|
|
310
|
+
f"events: {body['event_count']}",
|
|
311
|
+
"",
|
|
312
|
+
f"{'timestamp':<27} {'event_type':<16} {'tenant':<18} {'token':<10} summary",
|
|
313
|
+
]
|
|
314
|
+
for event in body["events"]:
|
|
315
|
+
raw = event.get("raw_event") or {}
|
|
316
|
+
lines.append(
|
|
317
|
+
f"{event['timestamp_iso']:<27} "
|
|
318
|
+
f"{event['event_type']:<16} "
|
|
319
|
+
f"{(raw.get('tenant_id') or '-'):<18} "
|
|
320
|
+
f"{event['token_id'][:8]:<10} "
|
|
321
|
+
f"{event['summary']}"
|
|
322
|
+
)
|
|
323
|
+
lines.append("")
|
|
324
|
+
lines.append(
|
|
325
|
+
"(metadata-tier view — §V.2.1: predicates/business narratives stay "
|
|
326
|
+
"in your tenant SIEM stream; §6.1 federated join is the full story)"
|
|
327
|
+
)
|
|
328
|
+
return "\n".join(lines)
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
def _cmd_chain_show(args: argparse.Namespace) -> int:
|
|
332
|
+
# Review S2: render-only flags without --render would silently
|
|
333
|
+
# no-op — an operator who typed --open expected a browser.
|
|
334
|
+
if (args.open or args.render_out) and not args.render:
|
|
335
|
+
print("--open/--render-out require --render", file=sys.stderr)
|
|
336
|
+
return 3
|
|
337
|
+
config = _resolve(args)
|
|
338
|
+
tenant_id = config.tenant_id
|
|
339
|
+
if not tenant_id:
|
|
340
|
+
print(
|
|
341
|
+
"no tenant identity: pass --tenant-id, set AAC_TENANT_ID, or add "
|
|
342
|
+
"tenant_id to the profile in ~/.aac/config",
|
|
343
|
+
file=sys.stderr,
|
|
344
|
+
)
|
|
345
|
+
return 3
|
|
346
|
+
try:
|
|
347
|
+
api_key = read_api_key(tenant_id)
|
|
348
|
+
except CliConfigError as exc:
|
|
349
|
+
print(str(exc), file=sys.stderr)
|
|
350
|
+
return 3
|
|
351
|
+
|
|
352
|
+
headers = {"Authorization": f"Bearer {api_key}"}
|
|
353
|
+
events_url = (
|
|
354
|
+
f"{config.data_plane_url}/v1/trace/{args.token_id}/cross-org-events"
|
|
355
|
+
)
|
|
356
|
+
try:
|
|
357
|
+
response = httpx.get(
|
|
358
|
+
events_url, headers=headers, timeout=_REQUEST_TIMEOUT_SECONDS
|
|
359
|
+
)
|
|
360
|
+
except httpx.HTTPError as exc:
|
|
361
|
+
print(
|
|
362
|
+
f"failed to reach the control plane data-plane surface at "
|
|
363
|
+
f"{config.data_plane_url}: {type(exc).__name__}: {exc}",
|
|
364
|
+
file=sys.stderr,
|
|
365
|
+
)
|
|
366
|
+
return 2
|
|
367
|
+
if response.status_code != 200:
|
|
368
|
+
_print_error_envelope(response)
|
|
369
|
+
return 1
|
|
370
|
+
body = response.json()
|
|
371
|
+
|
|
372
|
+
if args.output == "table":
|
|
373
|
+
print(_render_timeline_table(body))
|
|
374
|
+
else:
|
|
375
|
+
print(json.dumps(body, indent=2))
|
|
376
|
+
|
|
377
|
+
if args.render:
|
|
378
|
+
render_url = f"{config.data_plane_url}/v1/trace/{args.token_id}/render"
|
|
379
|
+
try:
|
|
380
|
+
render_response = httpx.get(
|
|
381
|
+
render_url, headers=headers, timeout=_REQUEST_TIMEOUT_SECONDS * 3
|
|
382
|
+
)
|
|
383
|
+
except httpx.HTTPError as exc:
|
|
384
|
+
print(f"render fetch failed: {type(exc).__name__}: {exc}", file=sys.stderr)
|
|
385
|
+
return 2
|
|
386
|
+
if render_response.status_code != 200:
|
|
387
|
+
_print_error_envelope(render_response)
|
|
388
|
+
return 1
|
|
389
|
+
out_path = Path(
|
|
390
|
+
args.render_out or f"aeg_{body['root_token_id'][:16]}.html"
|
|
391
|
+
)
|
|
392
|
+
try:
|
|
393
|
+
out_path.write_text(render_response.text, encoding="utf-8")
|
|
394
|
+
except OSError as exc: # review M3: unwritable path = CLI error
|
|
395
|
+
print(f"cannot write AEG to {out_path}: {exc}", file=sys.stderr)
|
|
396
|
+
return 3
|
|
397
|
+
# Headless-first (Equifax/KPI 6): the FILE is the deliverable;
|
|
398
|
+
# --open is the optional convenience for browser-ful operators.
|
|
399
|
+
print(f"AEG written to {out_path}", file=sys.stderr)
|
|
400
|
+
if args.open and not webbrowser.open(out_path.resolve().as_uri()):
|
|
401
|
+
print(
|
|
402
|
+
"(no browser available — the file above is the deliverable)",
|
|
403
|
+
file=sys.stderr,
|
|
404
|
+
)
|
|
405
|
+
return 0
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
# ---------------------------------------------------------------------------
|
|
409
|
+
# Parser + entrypoints
|
|
410
|
+
# ---------------------------------------------------------------------------
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
414
|
+
parser = argparse.ArgumentParser(
|
|
415
|
+
prog="aac",
|
|
416
|
+
description=(
|
|
417
|
+
"AAC platform CLI (Stage 2 subset of Eng Spec §XII): tenant "
|
|
418
|
+
"registration + chain audit, headless-first."
|
|
419
|
+
),
|
|
420
|
+
)
|
|
421
|
+
parser.add_argument("--version", action="version", version=f"aac {__version__}")
|
|
422
|
+
nouns = parser.add_subparsers(dest="noun", required=True)
|
|
423
|
+
|
|
424
|
+
configure = nouns.add_parser(
|
|
425
|
+
"configure",
|
|
426
|
+
help="Write ~/.aac/config interactively (aws-configure semantics).",
|
|
427
|
+
)
|
|
428
|
+
# These are VALUES TO WRITE (skipping that setting's prompt), not
|
|
429
|
+
# the runtime overrides the other commands' identically-named
|
|
430
|
+
# flags are — help text carries the distinction.
|
|
431
|
+
configure.add_argument(
|
|
432
|
+
"--profile",
|
|
433
|
+
default="default",
|
|
434
|
+
help="Config profile section to create/update.",
|
|
435
|
+
)
|
|
436
|
+
configure.add_argument(
|
|
437
|
+
"--admin-url", default=None, help="Write this admin_url (skips its prompt)."
|
|
438
|
+
)
|
|
439
|
+
configure.add_argument(
|
|
440
|
+
"--data-plane-url",
|
|
441
|
+
default=None,
|
|
442
|
+
help="Write this data_plane_url (skips its prompt).",
|
|
443
|
+
)
|
|
444
|
+
configure.add_argument(
|
|
445
|
+
"--tenant-id", default=None, help="Write this tenant_id (skips its prompt)."
|
|
446
|
+
)
|
|
447
|
+
configure.set_defaults(handler=_cmd_configure)
|
|
448
|
+
configure_verbs = configure.add_subparsers(dest="verb", required=False)
|
|
449
|
+
configure_list = configure_verbs.add_parser(
|
|
450
|
+
"list", help="Show effective settings and where each came from."
|
|
451
|
+
)
|
|
452
|
+
# default=SUPPRESS on every flag that ALSO exists on the parent
|
|
453
|
+
# `configure` parser (review M1): argparse parses a subcommand into
|
|
454
|
+
# a FRESH namespace and copies every set attribute back, so a
|
|
455
|
+
# plain default here would clobber a parent-parsed value —
|
|
456
|
+
# `aac configure --profile staging list` would silently list
|
|
457
|
+
# [default]. SUPPRESS keeps untyped child flags out of the copy;
|
|
458
|
+
# the parent's parse (which always runs first) supplies the values.
|
|
459
|
+
for flag, help_text in (
|
|
460
|
+
("--profile", "Config profile in ~/.aac/config (AWS-CLI semantics)."),
|
|
461
|
+
("--admin-url", "Admin-surface base URL (overrides profile)."),
|
|
462
|
+
("--data-plane-url", "Data-plane-surface base URL (overrides profile)."),
|
|
463
|
+
("--tenant-id", "Runtime override (shown as source=flag)."),
|
|
464
|
+
):
|
|
465
|
+
configure_list.add_argument(flag, default=argparse.SUPPRESS, help=help_text)
|
|
466
|
+
configure_list.add_argument(
|
|
467
|
+
"--output",
|
|
468
|
+
choices=("json", "table"),
|
|
469
|
+
default="json",
|
|
470
|
+
help="Output mode (§XII: JSON by default).",
|
|
471
|
+
)
|
|
472
|
+
configure_list.set_defaults(handler=_cmd_configure_list)
|
|
473
|
+
|
|
474
|
+
tenant = nouns.add_parser("tenant", help="Tenant administration.")
|
|
475
|
+
tenant_verbs = tenant.add_subparsers(dest="verb", required=True)
|
|
476
|
+
register = tenant_verbs.add_parser(
|
|
477
|
+
"register",
|
|
478
|
+
help="Register a tenant; store + print its one-time api_key.",
|
|
479
|
+
epilog=(
|
|
480
|
+
"tenant_id is the org's FEDERATION IDENTIFIER — the stable "
|
|
481
|
+
"handle other tenants verify your signatures under (X-AAC "
|
|
482
|
+
"headers, .well-known paths, SIEM streams). Grammar: 1-64 "
|
|
483
|
+
"chars of [a-z0-9._-], starting and ending alphanumeric; "
|
|
484
|
+
"an org domain like acme.com is the convention. It cannot "
|
|
485
|
+
"be renamed later (B118 D3)."
|
|
486
|
+
),
|
|
487
|
+
)
|
|
488
|
+
_add_common_flags(register)
|
|
489
|
+
register.add_argument(
|
|
490
|
+
"--tenant-id",
|
|
491
|
+
required=True,
|
|
492
|
+
help=(
|
|
493
|
+
"Federation identifier: 1-64 chars of [a-z0-9._-], starting "
|
|
494
|
+
"and ending alphanumeric (e.g. acme.com). See below."
|
|
495
|
+
),
|
|
496
|
+
)
|
|
497
|
+
register.add_argument("--display-name", required=True)
|
|
498
|
+
# Required (review N1): a fabricated ops@<tenant> default would be
|
|
499
|
+
# invented data stored server-side as a real operator contact.
|
|
500
|
+
register.add_argument("--contact", required=True)
|
|
501
|
+
register.add_argument(
|
|
502
|
+
"--workload-spiffe-id",
|
|
503
|
+
action="append",
|
|
504
|
+
help="Concrete workload SPIFFE ID (repeatable).",
|
|
505
|
+
)
|
|
506
|
+
register.add_argument(
|
|
507
|
+
"--parent-tenant-id",
|
|
508
|
+
default=None,
|
|
509
|
+
help=(
|
|
510
|
+
"Parent org's tenant_id (same grammar). The server resolves "
|
|
511
|
+
"the handle to its row internally — you always type the "
|
|
512
|
+
"identifier, never a database id."
|
|
513
|
+
),
|
|
514
|
+
)
|
|
515
|
+
register.add_argument(
|
|
516
|
+
"--tenant-admin-pubkey-file",
|
|
517
|
+
default=None,
|
|
518
|
+
help="PEM path — registers the tenant-admin key for publisher ingest.",
|
|
519
|
+
)
|
|
520
|
+
register.set_defaults(handler=_cmd_tenant_register)
|
|
521
|
+
|
|
522
|
+
chain = nouns.add_parser("chain", help="Per-chain audit operations.")
|
|
523
|
+
chain_verbs = chain.add_subparsers(dest="verb", required=True)
|
|
524
|
+
show = chain_verbs.add_parser(
|
|
525
|
+
"show", help="Chronological cross-org timeline (participant tenants only)."
|
|
526
|
+
)
|
|
527
|
+
_add_common_flags(show)
|
|
528
|
+
show.add_argument(
|
|
529
|
+
"--token-id",
|
|
530
|
+
"--root-token-id", # the plan's original flag name — same endpoint
|
|
531
|
+
dest="token_id",
|
|
532
|
+
required=True,
|
|
533
|
+
help="Any hop's token id OR a chain root id (64-char hex).",
|
|
534
|
+
)
|
|
535
|
+
show.add_argument("--tenant-id", default=None, help="Credential to present.")
|
|
536
|
+
show.add_argument(
|
|
537
|
+
"--render",
|
|
538
|
+
action="store_true",
|
|
539
|
+
help="Also fetch the interactive HTML AEG to a file (headless-first).",
|
|
540
|
+
)
|
|
541
|
+
show.add_argument(
|
|
542
|
+
"--render-out", default=None, help="HTML output path (default aeg_<root>.html)."
|
|
543
|
+
)
|
|
544
|
+
show.add_argument(
|
|
545
|
+
"--open", action="store_true", help="Open the rendered AEG in a browser."
|
|
546
|
+
)
|
|
547
|
+
show.set_defaults(handler=_cmd_chain_show)
|
|
548
|
+
|
|
549
|
+
return parser
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
def main(argv: list[str] | None = None) -> int:
|
|
553
|
+
parser = build_parser()
|
|
554
|
+
args = parser.parse_args(argv)
|
|
555
|
+
try:
|
|
556
|
+
return args.handler(args)
|
|
557
|
+
except CliConfigError as exc:
|
|
558
|
+
print(str(exc), file=sys.stderr)
|
|
559
|
+
return 3
|
|
560
|
+
except httpx.InvalidURL as exc:
|
|
561
|
+
# Review M3: NOT an httpx.HTTPError subclass — a malformed
|
|
562
|
+
# --admin-url/profile URL is a CLI-input error, not exit 1.
|
|
563
|
+
print(f"invalid URL: {exc}", file=sys.stderr)
|
|
564
|
+
return 3
|
|
565
|
+
except Exception as exc: # noqa: BLE001 — review M3: the 0/1/2/3
|
|
566
|
+
# contract is what automation scripts branch on; an unexpected
|
|
567
|
+
# bug must exit INSIDE the contract with one stderr line, not
|
|
568
|
+
# traceback out with the interpreter's exit 1 (= "server
|
|
569
|
+
# rejected" to a script).
|
|
570
|
+
print(f"aac: unexpected error: {type(exc).__name__}: {exc}", file=sys.stderr)
|
|
571
|
+
return 3
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
def entrypoint() -> None: # console-script shim
|
|
575
|
+
sys.exit(main())
|
aac_cli/config.py
ADDED
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
"""CLI configuration + credentials store (Eng Spec §XII conventions).
|
|
2
|
+
|
|
3
|
+
Two on-disk artifacts under ``~/.aac/`` (override the directory with
|
|
4
|
+
``AAC_CLI_HOME`` — tests and multi-account operators):
|
|
5
|
+
|
|
6
|
+
* ``~/.aac/config`` — INI, profile-sectioned (the AWS-CLI idiom;
|
|
7
|
+
user-ratified Week 13 over TOML/YAML — stdlib configparser, zero
|
|
8
|
+
deps). ``--profile`` selects a section; ``[default]`` otherwise::
|
|
9
|
+
|
|
10
|
+
[default]
|
|
11
|
+
admin_url = http://127.0.0.1:8000
|
|
12
|
+
data_plane_url = http://127.0.0.1:9000
|
|
13
|
+
tenant_id = acme.com
|
|
14
|
+
|
|
15
|
+
TWO urls, not one base: the admin and data-plane surfaces genuinely
|
|
16
|
+
live on different ports (Eng Spec §XVI) and 1C may split them into
|
|
17
|
+
separate deployments.
|
|
18
|
+
|
|
19
|
+
* ``~/.aac/credentials/{tenant_id}`` — one file per tenant holding the
|
|
20
|
+
bare ``aac_ak_...`` string, mode 0600 (§XII Mode-B posture).
|
|
21
|
+
DELIBERATELY the same bare-string format the joined compose smoke
|
|
22
|
+
writes into the sidecar keys dir — one credential format everywhere.
|
|
23
|
+
|
|
24
|
+
Precedence for every setting: explicit flag > environment
|
|
25
|
+
(``AAC_ADMIN_URL`` / ``AAC_DATA_PLANE_URL`` / ``AAC_TENANT_ID``) >
|
|
26
|
+
config-file profile > built-in localhost defaults.
|
|
27
|
+
|
|
28
|
+
``aac configure`` (B117, aws-configure semantics) is the primary
|
|
29
|
+
WRITER of the config file: it prompts for the three settings (never
|
|
30
|
+
credentials — those are minted server-side at ``aac tenant register``,
|
|
31
|
+
a deliberate aws deviation) and rewrites only the target profile
|
|
32
|
+
section. The file stays plain INI and hand-editing stays legal;
|
|
33
|
+
``configparser`` does NOT round-trip comments, so a rewrite drops
|
|
34
|
+
them (disclosed trade-off, aws-cli behaves the same). B98's
|
|
35
|
+
``aac sso login`` later writes the SAME file on first login — any
|
|
36
|
+
future writer must stay section-preserving like this one.
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
from __future__ import annotations
|
|
40
|
+
|
|
41
|
+
import configparser
|
|
42
|
+
import os
|
|
43
|
+
from dataclasses import dataclass
|
|
44
|
+
from pathlib import Path
|
|
45
|
+
|
|
46
|
+
__all__ = [
|
|
47
|
+
"CliConfigError",
|
|
48
|
+
"DEFAULT_SETTINGS",
|
|
49
|
+
"ResolvedConfig",
|
|
50
|
+
"ResolvedSetting",
|
|
51
|
+
"cli_home",
|
|
52
|
+
"credentials_path",
|
|
53
|
+
"read_api_key",
|
|
54
|
+
"read_profile_settings",
|
|
55
|
+
"resolve_config",
|
|
56
|
+
"resolve_settings",
|
|
57
|
+
"write_api_key",
|
|
58
|
+
"write_profile",
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
_DEFAULT_ADMIN_URL = "http://127.0.0.1:8000"
|
|
62
|
+
_DEFAULT_DATA_PLANE_URL = "http://127.0.0.1:9000"
|
|
63
|
+
|
|
64
|
+
# The three settings `aac configure` manages, with their built-in
|
|
65
|
+
# defaults (None = no default; tenant_id has no sensible one).
|
|
66
|
+
# Ordering is the PROMPT ordering — keep admin_url first (it is the
|
|
67
|
+
# first thing a fresh operator needs for `tenant register`).
|
|
68
|
+
DEFAULT_SETTINGS: dict[str, str | None] = {
|
|
69
|
+
"admin_url": _DEFAULT_ADMIN_URL,
|
|
70
|
+
"data_plane_url": _DEFAULT_DATA_PLANE_URL,
|
|
71
|
+
"tenant_id": None,
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
_ENV_VAR_BY_SETTING = {
|
|
75
|
+
"admin_url": "AAC_ADMIN_URL",
|
|
76
|
+
"data_plane_url": "AAC_DATA_PLANE_URL",
|
|
77
|
+
"tenant_id": "AAC_TENANT_ID",
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class CliConfigError(Exception):
|
|
82
|
+
"""Configuration the CLI cannot proceed with (exit 3 at the top level)."""
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@dataclass(frozen=True)
|
|
86
|
+
class ResolvedConfig:
|
|
87
|
+
"""The effective settings after flag/env/file/default precedence."""
|
|
88
|
+
|
|
89
|
+
admin_url: str
|
|
90
|
+
data_plane_url: str
|
|
91
|
+
tenant_id: str | None
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@dataclass(frozen=True)
|
|
95
|
+
class ResolvedSetting:
|
|
96
|
+
"""One effective setting plus WHERE it came from.
|
|
97
|
+
|
|
98
|
+
`source` is a human-readable provenance label for `aac configure
|
|
99
|
+
list` (aws-parity: value + Type/Location columns): ``"flag"``,
|
|
100
|
+
``"env:AAC_ADMIN_URL"``, ``"profile:default"``, ``"default"``, or
|
|
101
|
+
``"unset"`` (tenant_id only — it has no built-in default).
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
value: str | None
|
|
105
|
+
source: str
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def cli_home() -> Path:
|
|
109
|
+
"""``~/.aac`` (or ``AAC_CLI_HOME`` — tests, multi-account operators)."""
|
|
110
|
+
override = os.environ.get("AAC_CLI_HOME")
|
|
111
|
+
return Path(override) if override else Path.home() / ".aac"
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _load_config_parser(config_path: Path) -> configparser.ConfigParser:
|
|
115
|
+
"""Parse ``~/.aac/config``; an absent file parses as empty.
|
|
116
|
+
|
|
117
|
+
read_text + read_string (review M1): ConfigParser.read() silently
|
|
118
|
+
SKIPS an unreadable file and raises raw configparser errors on
|
|
119
|
+
malformed INI — both must surface as CliConfigError (exit 3),
|
|
120
|
+
never a traceback or a silent fallback to localhost defaults.
|
|
121
|
+
|
|
122
|
+
interpolation=None (review H1): configparser's default
|
|
123
|
+
BasicInterpolation treats ``%`` as syntax, making percent-encoded
|
|
124
|
+
URLs unstorable AND unreadable. No AAC setting wants
|
|
125
|
+
interpolation; aws-cli's INI handling does none either.
|
|
126
|
+
"""
|
|
127
|
+
parser = configparser.ConfigParser(interpolation=None)
|
|
128
|
+
if config_path.is_file():
|
|
129
|
+
try:
|
|
130
|
+
parser.read_string(config_path.read_text(encoding="utf-8"))
|
|
131
|
+
except OSError as exc:
|
|
132
|
+
raise CliConfigError(f"cannot read {config_path}: {exc}") from exc
|
|
133
|
+
except configparser.Error as exc:
|
|
134
|
+
raise CliConfigError(f"malformed config {config_path}: {exc}") from exc
|
|
135
|
+
return parser
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def resolve_settings(
|
|
139
|
+
*,
|
|
140
|
+
profile: str = "default",
|
|
141
|
+
admin_url_flag: str | None = None,
|
|
142
|
+
data_plane_url_flag: str | None = None,
|
|
143
|
+
tenant_id_flag: str | None = None,
|
|
144
|
+
) -> dict[str, ResolvedSetting]:
|
|
145
|
+
"""Apply the documented precedence, tracking each value's source.
|
|
146
|
+
|
|
147
|
+
THE single precedence implementation — `resolve_config` (every
|
|
148
|
+
network command) and `aac configure list` both call this, so the
|
|
149
|
+
displayed provenance can never drift from the lived behavior.
|
|
150
|
+
|
|
151
|
+
A missing config file is fine (localhost defaults — the dev-compose
|
|
152
|
+
posture); a NAMED profile missing from an existing file is an error
|
|
153
|
+
(the operator asked for something that isn't there).
|
|
154
|
+
"""
|
|
155
|
+
config_path = cli_home() / "config"
|
|
156
|
+
parser = _load_config_parser(config_path)
|
|
157
|
+
file_section: configparser.SectionProxy | None = None
|
|
158
|
+
if parser.has_section(profile):
|
|
159
|
+
file_section = parser[profile]
|
|
160
|
+
elif profile != "default" and config_path.is_file():
|
|
161
|
+
raise CliConfigError(
|
|
162
|
+
f"profile {profile!r} not found in {config_path} "
|
|
163
|
+
f"(sections: {parser.sections() or 'none'})"
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
flags = {
|
|
167
|
+
"admin_url": admin_url_flag,
|
|
168
|
+
"data_plane_url": data_plane_url_flag,
|
|
169
|
+
"tenant_id": tenant_id_flag,
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
def _setting(name: str) -> ResolvedSetting:
|
|
173
|
+
if flags[name]:
|
|
174
|
+
value = flags[name]
|
|
175
|
+
source = "flag"
|
|
176
|
+
elif os.environ.get(_ENV_VAR_BY_SETTING[name]):
|
|
177
|
+
value = os.environ[_ENV_VAR_BY_SETTING[name]]
|
|
178
|
+
source = f"env:{_ENV_VAR_BY_SETTING[name]}"
|
|
179
|
+
elif file_section is not None and name in file_section:
|
|
180
|
+
value = file_section[name]
|
|
181
|
+
source = f"profile:{profile}"
|
|
182
|
+
elif DEFAULT_SETTINGS[name] is not None:
|
|
183
|
+
value = DEFAULT_SETTINGS[name]
|
|
184
|
+
source = "default"
|
|
185
|
+
else:
|
|
186
|
+
return ResolvedSetting(value=None, source="unset")
|
|
187
|
+
# Urls tolerate a trailing slash from any source (hand-edited
|
|
188
|
+
# files, env); normalize once here so every consumer sees the
|
|
189
|
+
# same effective value.
|
|
190
|
+
assert value is not None
|
|
191
|
+
if name.endswith("_url"):
|
|
192
|
+
value = value.rstrip("/")
|
|
193
|
+
return ResolvedSetting(value=value, source=source)
|
|
194
|
+
|
|
195
|
+
return {name: _setting(name) for name in DEFAULT_SETTINGS}
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
def resolve_config(
|
|
199
|
+
*,
|
|
200
|
+
profile: str = "default",
|
|
201
|
+
admin_url_flag: str | None = None,
|
|
202
|
+
data_plane_url_flag: str | None = None,
|
|
203
|
+
tenant_id_flag: str | None = None,
|
|
204
|
+
) -> ResolvedConfig:
|
|
205
|
+
"""The effective config (see `resolve_settings` for the mechanics)."""
|
|
206
|
+
settings = resolve_settings(
|
|
207
|
+
profile=profile,
|
|
208
|
+
admin_url_flag=admin_url_flag,
|
|
209
|
+
data_plane_url_flag=data_plane_url_flag,
|
|
210
|
+
tenant_id_flag=tenant_id_flag,
|
|
211
|
+
)
|
|
212
|
+
admin_url = settings["admin_url"].value
|
|
213
|
+
data_plane_url = settings["data_plane_url"].value
|
|
214
|
+
assert admin_url is not None and data_plane_url is not None # defaults exist
|
|
215
|
+
return ResolvedConfig(
|
|
216
|
+
admin_url=admin_url,
|
|
217
|
+
data_plane_url=data_plane_url,
|
|
218
|
+
tenant_id=settings["tenant_id"].value,
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def read_profile_settings(profile: str) -> dict[str, str]:
|
|
223
|
+
"""The file-stored values for `profile` — the configure prompt's
|
|
224
|
+
"current" bracket values.
|
|
225
|
+
|
|
226
|
+
Tolerant where `resolve_settings` is strict: an absent file OR an
|
|
227
|
+
absent section returns ``{}``, because `aac configure --profile x`
|
|
228
|
+
on a new profile is CREATION, not an error. Malformed INI still
|
|
229
|
+
raises (the writer must not destroy a file it cannot parse).
|
|
230
|
+
"""
|
|
231
|
+
parser = _load_config_parser(cli_home() / "config")
|
|
232
|
+
if not parser.has_section(profile):
|
|
233
|
+
return {}
|
|
234
|
+
return {key: parser[profile][key] for key in DEFAULT_SETTINGS if key in parser[profile]}
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def write_profile(profile: str, settings: dict[str, str]) -> Path:
|
|
238
|
+
"""Create/update the `profile` section; every OTHER section survives.
|
|
239
|
+
|
|
240
|
+
Section-preserving by contract: B98's `aac sso login` becomes the
|
|
241
|
+
second writer of this file, and multi-profile operators hand-edit
|
|
242
|
+
it — rewriting only the target section's keys (plus configparser's
|
|
243
|
+
reformatting) is the strongest guarantee configparser affords.
|
|
244
|
+
Comments are NOT round-tripped (disclosed B117 trade-off).
|
|
245
|
+
|
|
246
|
+
Atomic replace (review M3): the file may hold OTHER profiles'
|
|
247
|
+
sections, so a torn in-place write (disk full, SIGKILL mid-write)
|
|
248
|
+
could lose data this call never touched. Write to a same-directory
|
|
249
|
+
temp file, then os.replace() — readers see the old file or the new
|
|
250
|
+
one, never a truncation. Recorded trade-off: os.replace converts a
|
|
251
|
+
symlinked ``~/.aac/config`` into a regular file; operators who
|
|
252
|
+
symlink dotfiles should symlink the DIRECTORY (or use
|
|
253
|
+
AAC_CLI_HOME). Losing sibling profiles is the worse failure.
|
|
254
|
+
|
|
255
|
+
File mode 0600 (aws-cli parity for its config file): nothing here
|
|
256
|
+
is secret TODAY, but tightening costs nothing and the B98 writer
|
|
257
|
+
inherits the posture. The replace also HEALS a looser pre-existing
|
|
258
|
+
mode (review S2) — the new inode is always 0600.
|
|
259
|
+
"""
|
|
260
|
+
config_path = cli_home() / "config"
|
|
261
|
+
parser = _load_config_parser(config_path)
|
|
262
|
+
if not parser.has_section(profile):
|
|
263
|
+
parser.add_section(profile)
|
|
264
|
+
for key, value in settings.items():
|
|
265
|
+
parser[profile][key] = value
|
|
266
|
+
config_path.parent.mkdir(parents=True, exist_ok=True)
|
|
267
|
+
temp_path = config_path.with_name(config_path.name + ".tmp")
|
|
268
|
+
temp_path.unlink(missing_ok=True)
|
|
269
|
+
fd = os.open(temp_path, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
|
|
270
|
+
try:
|
|
271
|
+
with os.fdopen(fd, "w", encoding="utf-8") as handle:
|
|
272
|
+
parser.write(handle)
|
|
273
|
+
except BaseException:
|
|
274
|
+
temp_path.unlink(missing_ok=True)
|
|
275
|
+
raise
|
|
276
|
+
os.replace(temp_path, config_path)
|
|
277
|
+
return config_path
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def credentials_path(tenant_id: str) -> Path:
|
|
281
|
+
# Server-side TENANT_ID_PATTERN admits no separators, but the store
|
|
282
|
+
# is safe on its own terms (review N2): reject anything path-like.
|
|
283
|
+
if "/" in tenant_id or "\\" in tenant_id or tenant_id in (".", ".."):
|
|
284
|
+
raise CliConfigError(f"tenant_id {tenant_id!r} is not a valid filename")
|
|
285
|
+
return cli_home() / "credentials" / tenant_id
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
def write_api_key(tenant_id: str, api_key: str) -> Path:
|
|
289
|
+
"""Store a tenant's api_key at mode 0600 (§XII Mode-B posture).
|
|
290
|
+
|
|
291
|
+
Atomic-mode create (review S1): O_NOFOLLOW + mode=0o600 at open
|
|
292
|
+
time — no umask window between create and chmod, no symlink
|
|
293
|
+
following. O_TRUNC overwrites an existing file (re-registration
|
|
294
|
+
under the same tenant_id only happens against a fresh control
|
|
295
|
+
plane; the old key is dead there anyway). The credentials
|
|
296
|
+
DIRECTORY is 0700 — defense in depth for umask-permissive machines.
|
|
297
|
+
"""
|
|
298
|
+
path = credentials_path(tenant_id)
|
|
299
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
300
|
+
path.parent.chmod(0o700)
|
|
301
|
+
fd = os.open(
|
|
302
|
+
path,
|
|
303
|
+
os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW,
|
|
304
|
+
0o600,
|
|
305
|
+
)
|
|
306
|
+
try:
|
|
307
|
+
os.write(fd, api_key.encode("utf-8"))
|
|
308
|
+
finally:
|
|
309
|
+
os.close(fd)
|
|
310
|
+
path.chmod(0o600) # heal pre-existing files created before S1
|
|
311
|
+
return path
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
def read_api_key(tenant_id: str) -> str:
|
|
315
|
+
"""The stored api_key for `tenant_id`, or CliConfigError with the fix."""
|
|
316
|
+
path = credentials_path(tenant_id)
|
|
317
|
+
try:
|
|
318
|
+
api_key = path.read_text(encoding="utf-8").strip()
|
|
319
|
+
except OSError as exc:
|
|
320
|
+
raise CliConfigError(
|
|
321
|
+
f"no stored credential for tenant {tenant_id!r} ({exc}). "
|
|
322
|
+
f"Run `aac tenant register` first, or place the api_key at {path} "
|
|
323
|
+
f"(mode 0600)."
|
|
324
|
+
) from exc
|
|
325
|
+
if not api_key:
|
|
326
|
+
raise CliConfigError(f"credential file {path} is empty")
|
|
327
|
+
return api_key
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aac-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The aac platform CLI — headless operator interface to the AAC control plane (tenant registration, chain audit).
|
|
5
|
+
Author: Agent Authority Cloud Project
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: httpx>=0.28
|
|
11
|
+
Provides-Extra: test
|
|
12
|
+
Requires-Dist: pytest>=8.0; extra == "test"
|
|
13
|
+
Requires-Dist: pytest-httpx>=0.30; extra == "test"
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# aac-cli — the `aac` platform CLI
|
|
17
|
+
|
|
18
|
+
The headless operator interface to the AAC control plane (Eng Spec
|
|
19
|
+
§XII; Equifax/KPI-6 requirement: every operational task doable without
|
|
20
|
+
a web console).
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install aac-cli
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
> **Careful with the name:** `pip install aac` installs an UNRELATED
|
|
29
|
+
> project (an MBSE modeling tool that happens to share the acronym).
|
|
30
|
+
> The AAC platform CLI's PyPI distribution is **`aac-cli`**; the
|
|
31
|
+
> command it installs is `aac` — the awscli precedent (dist name ≠
|
|
32
|
+
> command name).
|
|
33
|
+
|
|
34
|
+
Two personas, two invocation styles:
|
|
35
|
+
|
|
36
|
+
* **Installed operators** (`pip install aac-cli`) run the bare
|
|
37
|
+
command: `aac tenant register ...`
|
|
38
|
+
* **Repo developers** run it through the workspace without installing:
|
|
39
|
+
`uv run aac ...`
|
|
40
|
+
|
|
41
|
+
The examples below use the bare form; prefix `uv run` if you're in the
|
|
42
|
+
repo.
|
|
43
|
+
|
|
44
|
+
Week 13 ships the Python argparse SUBSET of §XII's full command
|
|
45
|
+
surface — the production Go CLI is V5+ scope:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
aac configure # interactive; aws-configure semantics
|
|
49
|
+
aac configure --profile staging # create/update the [staging] profile
|
|
50
|
+
aac configure list # effective settings + source of each
|
|
51
|
+
|
|
52
|
+
aac tenant register --tenant-id acme.com --display-name "ACME Corporation" \
|
|
53
|
+
--workload-spiffe-id spiffe://acme.com/treasury-agent/v1 \
|
|
54
|
+
--tenant-admin-pubkey-file ./tenant-admin.public.pem
|
|
55
|
+
|
|
56
|
+
aac chain show --token-id <64-hex token or chain root> --tenant-id acme.com
|
|
57
|
+
aac chain show --token-id <id> --output table
|
|
58
|
+
aac chain show --token-id <id> --render --render-out ./aeg.html # headless
|
|
59
|
+
aac chain show --token-id <id> --render --open # + browser
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Naming: console script = `aac` (the §XVI-reserved name); import
|
|
63
|
+
package = `aac_cli` (the SDK owns the `aac` import package);
|
|
64
|
+
distribution = `aac-cli` (decided at first release, B119: bare `aac`
|
|
65
|
+
on PyPI belongs to an unrelated active project and is not claimable).
|
|
66
|
+
|
|
67
|
+
## Configuration
|
|
68
|
+
|
|
69
|
+
`aac configure` writes `~/.aac/config` (INI, profile-sectioned —
|
|
70
|
+
AWS-CLI idiom; override the directory with `AAC_CLI_HOME`). Prompts
|
|
71
|
+
show `[current-or-default]`; Enter keeps the bracket value:
|
|
72
|
+
|
|
73
|
+
```console
|
|
74
|
+
$ aac configure
|
|
75
|
+
admin_url [http://127.0.0.1:8000]:
|
|
76
|
+
data_plane_url [http://127.0.0.1:9000]:
|
|
77
|
+
tenant_id [None]: acme.com
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```ini
|
|
81
|
+
[default]
|
|
82
|
+
admin_url = http://127.0.0.1:8000
|
|
83
|
+
data_plane_url = http://127.0.0.1:9000
|
|
84
|
+
tenant_id = acme.com
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Supplying all three flags (`--admin-url` / `--data-plane-url` /
|
|
88
|
+
`--tenant-id`) skips every prompt — scriptable. `--profile staging`
|
|
89
|
+
creates/updates `[staging]`, leaving other sections intact. The file
|
|
90
|
+
stays hand-editable INI, but note a rewrite does not preserve
|
|
91
|
+
comments (aws-cli behaves the same). `aac configure` never prompts
|
|
92
|
+
for credentials — api_keys are minted at `aac tenant register`
|
|
93
|
+
(deliberate deviation from `aws configure`).
|
|
94
|
+
|
|
95
|
+
Precedence: flag > env (`AAC_ADMIN_URL` / `AAC_DATA_PLANE_URL` /
|
|
96
|
+
`AAC_TENANT_ID`) > profile > localhost defaults. `--profile` selects a
|
|
97
|
+
section. `aac configure list` prints each effective setting with its
|
|
98
|
+
source (`flag` / `env:AAC_*` / `profile:<name>` / `default` / `unset`).
|
|
99
|
+
|
|
100
|
+
### `AAC_CLI_HOME` — isolated homes
|
|
101
|
+
|
|
102
|
+
`AAC_CLI_HOME` relocates the whole `~/.aac` tree (config +
|
|
103
|
+
credentials). Two everyday uses:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# 1. Throwaway smoke/test home — nothing touches your real config:
|
|
107
|
+
AAC_CLI_HOME=/tmp/aac-smoke aac tenant register --tenant-id smoke.example ...
|
|
108
|
+
|
|
109
|
+
# 2. Multi-account operators — hard-wall separation beyond profiles
|
|
110
|
+
# (separate credential files, not just separate config sections):
|
|
111
|
+
alias aac-prod='AAC_CLI_HOME=$HOME/.aac-prod aac'
|
|
112
|
+
alias aac-staging='AAC_CLI_HOME=$HOME/.aac-staging aac'
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Profiles share one credentials directory; `AAC_CLI_HOME` gives each
|
|
116
|
+
context its own.
|
|
117
|
+
|
|
118
|
+
Credentials: `~/.aac/credentials/{tenant_id}`, the bare `aac_ak_...`
|
|
119
|
+
string at mode 0600, written by `aac tenant register` (the key is
|
|
120
|
+
printed EXACTLY ONCE — only its peppered hash exists server-side) and
|
|
121
|
+
presented as `Authorization: Bearer` by `aac chain show`. Same bare-
|
|
122
|
+
string format the joined compose smoke writes into sidecar key dirs.
|
|
123
|
+
|
|
124
|
+
## Choosing a tenant_id
|
|
125
|
+
|
|
126
|
+
`tenant_id` is your org's FEDERATION IDENTIFIER — the stable handle
|
|
127
|
+
every other tenant verifies your signatures under: it appears in
|
|
128
|
+
`X-AAC-Originator-Tenant-Id` headers, `/.well-known/aac-root-keys/
|
|
129
|
+
{tenant_id}` paths, SIEM stream directories, and supplier whitelists.
|
|
130
|
+
Grammar: **1-64 characters of `[a-z0-9._-]`, starting and ending
|
|
131
|
+
alphanumeric**; an org domain like `acme.com` is the convention. Pick
|
|
132
|
+
it like an AWS account ID: it identifies you to the federation and
|
|
133
|
+
cannot be renamed later. `--parent-tenant-id` takes the parent org's
|
|
134
|
+
`tenant_id` (same grammar) — the server resolves handles to internal
|
|
135
|
+
row ids; no database identifier ever crosses the API (B118 D3/D4).
|
|
136
|
+
Domain ownership verification (DNS TXT) is a separate, additive
|
|
137
|
+
control tracked in the `tenant_domains` table — the challenge flow
|
|
138
|
+
ships in a follow-up increment.
|
|
139
|
+
|
|
140
|
+
## Semantics worth knowing
|
|
141
|
+
|
|
142
|
+
* `aac chain show` accepts ANY hop's token id or the chain root id
|
|
143
|
+
(`--root-token-id` is an accepted alias); visibility is
|
|
144
|
+
participant-tenant over the symmetric composite closure (Week 12) —
|
|
145
|
+
non-participants get the same 404 as unknown tokens.
|
|
146
|
+
* Timelines are §V.2.1 METADATA-TIER: predicates and business
|
|
147
|
+
narratives stay in your tenant SIEM stream; the table output's
|
|
148
|
+
footer says so (§6.1 federated join is the full-fidelity story).
|
|
149
|
+
* Exit codes (originator-cli convention): 0 success / 1 server
|
|
150
|
+
rejected / 2 unreachable / 3 CLI-input error.
|
|
151
|
+
|
|
152
|
+
## Tests
|
|
153
|
+
|
|
154
|
+
`uv run pytest cli/aac/tests/` — pytest-httpx mocks; no control plane
|
|
155
|
+
needed. Against a live stack: bring up the joined topology
|
|
156
|
+
(`./bin/run-wedge-a-control-plane-compose.sh --keep-up`) and point the
|
|
157
|
+
flags at localhost.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
aac_cli/__init__.py,sha256=q2dYQofeGHHkeUFEKoy7yWvA4_fhTiuywYE7RDd7ZBY,271
|
|
2
|
+
aac_cli/__main__.py,sha256=iZrK_3EnviGoJv0bB5mzd1FeimIKhwp-_dvzsuGQL_0,156
|
|
3
|
+
aac_cli/cli.py,sha256=56q47Hbti7oCANGFaAYzNnf5l4ri23yOWv3J5jcY67Y,21687
|
|
4
|
+
aac_cli/config.py,sha256=f2zlS6ra6n6y4FZ3HYP_q9gsaWqosuoAzO7oauEsb7Y,12570
|
|
5
|
+
aac_cli-0.1.0.dist-info/licenses/LICENSE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
|
|
6
|
+
aac_cli-0.1.0.dist-info/METADATA,sha256=5AWs6Ox3BzMpQobpaZoQt65G25KExK-8k-yzQ0kznEc,6269
|
|
7
|
+
aac_cli-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
8
|
+
aac_cli-0.1.0.dist-info/entry_points.txt,sha256=f6JNWD9QbmHelzouQAAgb7gVY6iw9-RYdFuh7oWV8jE,47
|
|
9
|
+
aac_cli-0.1.0.dist-info/top_level.txt,sha256=XDP5oOHG6T35TmrH4oU9z_K76k8-PhA7UiQDyGHtOA4,8
|
|
10
|
+
aac_cli-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
aac_cli
|