lighthouse-cli 0.43.1__tar.gz → 0.44.0__tar.gz
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.
- {lighthouse_cli-0.43.1/lighthouse_cli.egg-info → lighthouse_cli-0.44.0}/PKG-INFO +1 -1
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/README.md +1 -1
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/__init__.py +1 -1
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/connect.py +51 -8
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/locales/ar.json +2 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/locales/de.json +2 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/locales/en-US.json +2 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/locales/en.json +2 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/locales/es.json +2 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/locales/fr.json +2 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/locales/ga.json +2 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/locales/it.json +2 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/locales/ja.json +2 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/locales/nl.json +2 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/locales/pt.json +2 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/locales/zh-Hans.json +2 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/locales/zh-Hant.json +2 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/sealing.py +70 -5
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0/lighthouse_cli.egg-info}/PKG-INFO +1 -1
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse_cli.egg-info/SOURCES.txt +1 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/pyproject.toml +1 -1
- lighthouse_cli-0.44.0/tests/test_connect_datadog_modes.py +150 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/LICENSE +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/NOTICE +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/__main__.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/__init__.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/agents.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/approvals.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/builds.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/collectors.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/connections.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/datasets.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/evals.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/kb.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/language.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/limits.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/login.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/models.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/offline.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/runs.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/spend.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/stack.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/terms.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/verify.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/commands/whoami.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/config.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/credentials.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/device.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/exits.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/flags.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/http.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/i18n.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/main.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/out.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse/py.typed +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse_cli.egg-info/dependency_links.txt +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse_cli.egg-info/entry_points.txt +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse_cli.egg-info/requires.txt +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse_cli.egg-info/top_level.txt +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/setup.cfg +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_approvals.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_ci_credential.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_collectors.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_commands.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_connect_erp_hr.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_connect_finav.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_connect_library.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_datasets.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_dev_surface.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_fixtures.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_golden.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_i18n.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_installers.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_offline.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_plumbing.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_sealing.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_sealing_hybrid.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_stack.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_verify.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_verify_hybrid.py +0 -0
- {lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/tests/test_version.py +0 -0
|
@@ -143,7 +143,7 @@ a terminal, and when `CI`, `NO_COLOR` or `TERM=dumb` is set.
|
|
|
143
143
|
|---|---|
|
|
144
144
|
| `login`, `logout`, `tokens` | sign in, sign out, see and revoke your delegated tokens |
|
|
145
145
|
| `whoami` | which tenant, which person, which role, which scopes, where the credential came from |
|
|
146
|
-
| `connect [provider]` | what is connected; open a provider's own approval; with `--credential-stdin`, connect an existing token as yourself (read from standard input, `--access read_write` by choice; needs `cloudflared access login https://<host
|
|
146
|
+
| `connect [provider]` | what is connected; open a provider's own approval; with `--credential-stdin`, connect an existing token as yourself (read from standard input, `--access read_write` by choice; needs `cloudflared access login https://<host>`; for Datadog, either the key pair, a service account's and recommended for production, or a personal access token for pilots as `{"token", "site"}` or one line with `--auth-mode pat`, sealed to your deployment only, never both shapes at once); with `--reuse-local`, offer the `gh`, `glab` or `DD_*` sign-in already on this machine, sent the same way only after you type `yes` at a terminal (never under `--yes` or `--no-input`) |
|
|
147
147
|
| `connections`, `connections schedule <id> --mode ...`, `connections sync <id>` | each connection's sync schedule, last and next sync; set a schedule (`off`, `every_15m`, `hourly`, `working_hours --tz ...`, `daily --at HH:MM --tz ...`) or sync now, as yourself (a client administrator; needs `cloudflared access login https://<host>`; checked by the service exactly as on the card) |
|
|
148
148
|
| `collectors`, `collectors request --vendor ... --product ... --reads ... --cloud ...` | your tenant's collector requests and their stage in Atlantic's backlog; ask for another (handler or client administrator; `--kind`, `--access read_write`, `--urgency`, `--docs-url` optional; at a terminal it asks for what is missing). The request becomes a public issue that never names your organisation |
|
|
149
149
|
| `datasets`, `datasets signals`, `datasets settings`, `datasets export --kind sft\|preference\|retrieval [--use-case ...]`, `datasets show <id>` | training datasets from Reinforcement signals: built in your deployment, redacted there and written to your own storage; LightHouse™ and this command see the manifest's counts and hashes, never a row. Exporting needs the handler role, exports switched on for the use case, `dataset.export` on, and a sign-in with the `datasets` scope |
|
|
@@ -231,6 +231,11 @@ def _configure(ap: argparse.ArgumentParser) -> None:
|
|
|
231
231
|
"(needs `cloudflared access login https://<host>`)")
|
|
232
232
|
ap.add_argument("--access", choices=("read", "read_write"), default="read",
|
|
233
233
|
help="with --credential-stdin: read (the default) or read_write")
|
|
234
|
+
ap.add_argument("--auth-mode", choices=("keys", "pat"), default=None, dest="auth_mode",
|
|
235
|
+
help="with --credential-stdin, Datadog: keys (an API key and a service "
|
|
236
|
+
"account's application key, recommended for production) or pat (a "
|
|
237
|
+
"personal access token, for pilots); read from a JSON credential's "
|
|
238
|
+
"own fields where it has them")
|
|
234
239
|
ap.add_argument("--target", action="append", default=[], metavar="KEY=VALUE",
|
|
235
240
|
help="with --credential-stdin: what the connection points at "
|
|
236
241
|
"(organisation=..., instance_url=..., site=...); repeatable")
|
|
@@ -377,19 +382,36 @@ def _sealer(ctx: Context, client: Any, provider: Provider) -> dict[str, Any] | N
|
|
|
377
382
|
"pinned": pinned is not None}
|
|
378
383
|
|
|
379
384
|
|
|
380
|
-
def
|
|
381
|
-
|
|
385
|
+
def _datadog(credential: str, target: dict[str, str],
|
|
386
|
+
mode: str | None) -> tuple[dict[str, str], str, dict[str, str]]:
|
|
387
|
+
"""A Datadog credential in either shape (issue 321): its fields, its auth
|
|
388
|
+
mode, and the target with the portal's name for its site."""
|
|
382
389
|
try:
|
|
383
|
-
fields = sealing.
|
|
390
|
+
fields, got = sealing.datadog_fields(credential, target, mode)
|
|
384
391
|
except sealing.SealingError as e:
|
|
385
392
|
raise CliError(str(e), code=USAGE, error="bad_credential") from None
|
|
393
|
+
site = DD_SITES[fields["site"]]
|
|
394
|
+
return fields, got, {**target, "site": site}
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
def _sealed_body(where: dict[str, Any], provider: Provider, credential: str,
|
|
398
|
+
target: dict[str, str], mode: str | None = None) -> dict[str, Any]:
|
|
399
|
+
extra: dict[str, str] = {}
|
|
400
|
+
if provider.name == "datadog":
|
|
401
|
+
fields, got, target = _datadog(credential, target, mode)
|
|
402
|
+
extra = {"auth_mode": got}
|
|
403
|
+
else:
|
|
404
|
+
try:
|
|
405
|
+
fields = sealing.credential_fields(provider.name, credential, target)
|
|
406
|
+
except sealing.SealingError as e:
|
|
407
|
+
raise CliError(str(e), code=USAGE, error="bad_credential") from None
|
|
386
408
|
cid = sealing.connection_id()
|
|
387
409
|
body = {"sealed": sealing.seal(where["public"], sealing.canonical(fields),
|
|
388
410
|
deployment=where["full"], connector=provider.name, name=cid,
|
|
389
411
|
suite=where.get("suite", sealing.SUITE)),
|
|
390
412
|
"fingerprint": sealing.fingerprint(fields, where["fingerprint_key"]),
|
|
391
413
|
"connection": cid, "deployment": where["deployment"], "target": target,
|
|
392
|
-
"sealed_by": "cli"}
|
|
414
|
+
"sealed_by": "cli", **extra}
|
|
393
415
|
fields.clear()
|
|
394
416
|
return body
|
|
395
417
|
|
|
@@ -412,6 +434,12 @@ def _connect_token(ctx: Context, provider: Provider, credential: str | None = No
|
|
|
412
434
|
raise CliError(provider.read_only_why or f"{provider.label} connects read-only; "
|
|
413
435
|
"connect it with --access read", code=USAGE, error="read_only_connector")
|
|
414
436
|
credential = credential if credential is not None else _read_credential(ctx)
|
|
437
|
+
mode = getattr(ctx.args, "auth_mode", None)
|
|
438
|
+
if mode is not None and provider.name != "datadog":
|
|
439
|
+
raise CliError("--auth-mode is for Datadog", code=USAGE, error="bad_auth_mode")
|
|
440
|
+
if provider.name == "datadog":
|
|
441
|
+
# Checked before anything is sent: a mixed or malformed shape stops here.
|
|
442
|
+
_, mode, _ = _datadog(credential, target, mode)
|
|
415
443
|
host = ctx.host
|
|
416
444
|
client = ctx.new_client(host, None, session=person_session(host))
|
|
417
445
|
path = f"/api/v1/connectors/{provider.name}/token"
|
|
@@ -427,10 +455,20 @@ def _connect_token(ctx: Context, provider: Provider, credential: str | None = No
|
|
|
427
455
|
raise CliError(f"{provider.label}'s credential is only ever sealed to your "
|
|
428
456
|
f"deployment, which cannot keep it yet (engine {engine} with its own "
|
|
429
457
|
"store); nothing was sent", code=FAILED, error="sealing_required")
|
|
430
|
-
if where is None:
|
|
431
|
-
|
|
458
|
+
if where is None and mode == "pat":
|
|
459
|
+
# Issue 321: a personal token is kept only in the client's own store.
|
|
460
|
+
raise CliError("a Datadog personal access token is only ever sealed to your "
|
|
461
|
+
"deployment, which cannot keep it yet; nothing was sent",
|
|
462
|
+
code=FAILED, error="sealing_required")
|
|
463
|
+
if where is None and provider.name == "datadog":
|
|
464
|
+
fields, _, target = _datadog(credential, target, mode)
|
|
465
|
+
body: dict[str, Any] = {"credential": f"{fields['api_key']}\n{fields['app_key']}",
|
|
466
|
+
"target": target}
|
|
467
|
+
fields.clear()
|
|
468
|
+
elif where is None:
|
|
469
|
+
body = {"credential": credential, "target": target}
|
|
432
470
|
else:
|
|
433
|
-
body = _sealed_body(where, provider, credential, target)
|
|
471
|
+
body = _sealed_body(where, provider, credential, target, mode)
|
|
434
472
|
if access != "read":
|
|
435
473
|
body["access"] = access
|
|
436
474
|
try:
|
|
@@ -443,7 +481,7 @@ def _connect_token(ctx: Context, provider: Provider, credential: str | None = No
|
|
|
443
481
|
where = _sealer(ctx, client, provider)
|
|
444
482
|
if where is None:
|
|
445
483
|
raise
|
|
446
|
-
body = {**_sealed_body(where, provider, credential, target),
|
|
484
|
+
body = {**_sealed_body(where, provider, credential, target, mode),
|
|
447
485
|
**({"access": access} if access != "read" else {})}
|
|
448
486
|
got = client.post(path, body) or {}
|
|
449
487
|
finally:
|
|
@@ -455,6 +493,9 @@ def _connect_token(ctx: Context, provider: Provider, credential: str | None = No
|
|
|
455
493
|
"access": got.get("access"),
|
|
456
494
|
"can_write": got.get("can_write"), "write_scopes": got.get("write_scopes") or [],
|
|
457
495
|
"access_note": got.get("access_note"), "state": got.get("state"),
|
|
496
|
+
# Issue 309: the kind of identity the connection runs as.
|
|
497
|
+
"auth_mode": got.get("auth_mode"), "identity_type": got.get("identity_type"),
|
|
498
|
+
"identity": got.get("identity_label"),
|
|
458
499
|
"fingerprint": got.get("fingerprint"), "replaced": got.get("replaced") or [],
|
|
459
500
|
"card": got.get("label"),
|
|
460
501
|
"sealed_by": got.get("sealed_by") or ("cli" if where else None),
|
|
@@ -706,6 +747,7 @@ def _show(out: Out, body: dict[str, Any]) -> None:
|
|
|
706
747
|
out.pairs([("sent to your own store", body.get("card") or body["label"]),
|
|
707
748
|
("deployment", body.get("deployment") or ""),
|
|
708
749
|
("access", "can write" if body.get("can_write") else "read only"),
|
|
750
|
+
*([("identity", body["identity"])] if body.get("identity") else []),
|
|
709
751
|
("connection", body.get("connection") or "")])
|
|
710
752
|
out.note(body.get("reason") or "waiting for your deployment to keep it")
|
|
711
753
|
if body.get("custody"):
|
|
@@ -718,6 +760,7 @@ def _show(out: Out, body: dict[str, Any]) -> None:
|
|
|
718
760
|
out.pairs([("connected", body.get("card") or body["label"]),
|
|
719
761
|
("access", "can write" if body.get("can_write") else "read only"),
|
|
720
762
|
("state", body.get("state") or ""),
|
|
763
|
+
*([("identity", body["identity"])] if body.get("identity") else []),
|
|
721
764
|
("connection", body.get("connection") or "")])
|
|
722
765
|
if body.get("access_note"):
|
|
723
766
|
out.note(body["access_note"])
|
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
"help.connect.every": "بلا مزوّد: اعرض القادمة أيضاً",
|
|
119
119
|
"help.connect.credential_stdin": "اربط رمزاً موجوداً، يُقرأ من الإدخال القياسي، بصفتك (يتطلب `cloudflared access login https://<host>`)",
|
|
120
120
|
"help.connect.access": "مع --credential-stdin: read (الافتراضي) أو read_write",
|
|
121
|
+
"help.connect.auth_mode": "مع --credential-stdin، Datadog: keys (مفتاح API ومفتاح تطبيق لحساب خدمة، موصى به للإنتاج) أو pat (رمز وصول شخصي، للتجارب)؛ يُقرأ من حقول بيانات الاعتماد بصيغة JSON عند وجودها",
|
|
121
122
|
"help.connect.target": "مع --credential-stdin: ما يشير إليه الاتصال (organisation=..., instance_url=..., site=...)؛ قابل للتكرار",
|
|
122
123
|
"help.connect.deployment": "مع --credential-stdin: عملية النشر التي تحتفظ ببيانات الاعتماد، حيث يكون للمؤسسة أكثر من واحدة",
|
|
123
124
|
"help.connect.deployment_key": "مع --credential-stdin: ثبّت المفتاح العام لعملية النشر (base64 أو PEM، كما طبعته بنيتك التحتية)؛ يُختم الرمز فقط لمفتاح ختم وقّعه ذلك المفتاح (أو LIGHTHOUSE_DEPLOYMENT_KEY)",
|
|
@@ -265,6 +266,7 @@
|
|
|
265
266
|
"label.approve_at": "الموافقة في",
|
|
266
267
|
"label.sent_to_your_own_store": "أُرسل إلى مخزنك",
|
|
267
268
|
"label.access": "الوصول",
|
|
269
|
+
"label.identity": "الهوية",
|
|
268
270
|
"label.connection": "الاتصال",
|
|
269
271
|
"label.connected": "متصل",
|
|
270
272
|
"label.syncing": "يزامن",
|
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
"help.connect.every": "ohne Anbieter: auch die kommenden auflisten",
|
|
119
119
|
"help.connect.credential_stdin": "ein vorhandenes Token, von der Standardeingabe gelesen, als Sie selbst verbinden (erfordert `cloudflared access login https://<Host>`)",
|
|
120
120
|
"help.connect.access": "mit --credential-stdin: read (Standard) oder read_write",
|
|
121
|
+
"help.connect.auth_mode": "mit --credential-stdin, Datadog: keys (ein API-Schlüssel und der Anwendungsschlüssel eines Dienstkontos, für die Produktion empfohlen) oder pat (ein persönliches Zugriffstoken, für Pilotprojekte); bei einem JSON-Berechtigungsnachweis aus dessen eigenen Feldern gelesen",
|
|
121
122
|
"help.connect.target": "mit --credential-stdin: worauf die Verbindung zeigt (organisation=..., instance_url=..., site=...); wiederholbar",
|
|
122
123
|
"help.connect.deployment": "mit --credential-stdin: die Bereitstellung, die das Zugangsdatum aufbewahrt, wenn der Mandant mehr als eine hat",
|
|
123
124
|
"help.connect.deployment_key": "mit --credential-stdin: den öffentlichen Schlüssel der Bereitstellung festschreiben (Base64 oder PEM, wie Ihre Infrastruktur ihn ausgegeben hat); das Token wird nur für einen Versiegelungsschlüssel versiegelt, den dieser Schlüssel signiert hat (oder LIGHTHOUSE_DEPLOYMENT_KEY)",
|
|
@@ -265,6 +266,7 @@
|
|
|
265
266
|
"label.approve_at": "genehmigen unter",
|
|
266
267
|
"label.sent_to_your_own_store": "an Ihren eigenen Speicher gesendet",
|
|
267
268
|
"label.access": "Zugriff",
|
|
269
|
+
"label.identity": "Identität",
|
|
268
270
|
"label.connection": "Verbindung",
|
|
269
271
|
"label.connected": "verbunden",
|
|
270
272
|
"label.syncing": "synchronisiert gerade",
|
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
"help.connect.every": "with no provider: list the coming ones too",
|
|
119
119
|
"help.connect.credential_stdin": "connect an existing token, read from standard input, as yourself (needs `cloudflared access login https://<host>`)",
|
|
120
120
|
"help.connect.access": "with --credential-stdin: read (the default) or read_write",
|
|
121
|
+
"help.connect.auth_mode": "with --credential-stdin, Datadog: keys (an API key and a service account's application key, recommended for production) or pat (a personal access token, for pilots); read from a JSON credential's own fields where it has them",
|
|
121
122
|
"help.connect.target": "with --credential-stdin: what the connection points at (organization=..., instance_url=..., site=...); repeatable",
|
|
122
123
|
"help.connect.deployment": "with --credential-stdin: the deployment that keeps the credential, where the tenant has more than one",
|
|
123
124
|
"help.connect.deployment_key": "with --credential-stdin: pin the deployment's public key (base64 or PEM, as your infrastructure printed it); the token is sealed only to a sealing key that key signed (or LIGHTHOUSE_DEPLOYMENT_KEY)",
|
|
@@ -265,6 +266,7 @@
|
|
|
265
266
|
"label.approve_at": "approve at",
|
|
266
267
|
"label.sent_to_your_own_store": "sent to your own store",
|
|
267
268
|
"label.access": "access",
|
|
269
|
+
"label.identity": "identity",
|
|
268
270
|
"label.connection": "connection",
|
|
269
271
|
"label.connected": "connected",
|
|
270
272
|
"label.syncing": "syncing",
|
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
"help.connect.every": "with no provider: list the coming ones too",
|
|
119
119
|
"help.connect.credential_stdin": "connect an existing token, read from standard input, as yourself (needs `cloudflared access login https://<host>`)",
|
|
120
120
|
"help.connect.access": "with --credential-stdin: read (the default) or read_write",
|
|
121
|
+
"help.connect.auth_mode": "with --credential-stdin, Datadog: keys (an API key and a service account's application key, recommended for production) or pat (a personal access token, for pilots); read from a JSON credential's own fields where it has them",
|
|
121
122
|
"help.connect.target": "with --credential-stdin: what the connection points at (organisation=..., instance_url=..., site=...); repeatable",
|
|
122
123
|
"help.connect.deployment": "with --credential-stdin: the deployment that keeps the credential, where the tenant has more than one",
|
|
123
124
|
"help.connect.deployment_key": "with --credential-stdin: pin the deployment's public key (base64 or PEM, as your infrastructure printed it); the token is sealed only to a sealing key that key signed (or LIGHTHOUSE_DEPLOYMENT_KEY)",
|
|
@@ -265,6 +266,7 @@
|
|
|
265
266
|
"label.approve_at": "approve at",
|
|
266
267
|
"label.sent_to_your_own_store": "sent to your own store",
|
|
267
268
|
"label.access": "access",
|
|
269
|
+
"label.identity": "identity",
|
|
268
270
|
"label.connection": "connection",
|
|
269
271
|
"label.connected": "connected",
|
|
270
272
|
"label.syncing": "syncing",
|
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
"help.connect.every": "sin proveedor: listar también los próximos",
|
|
119
119
|
"help.connect.credential_stdin": "conectar un token existente, leído de la entrada estándar, como usted mismo (requiere `cloudflared access login https://<host>`)",
|
|
120
120
|
"help.connect.access": "con --credential-stdin: read (por defecto) o read_write",
|
|
121
|
+
"help.connect.auth_mode": "con --credential-stdin, Datadog: keys (una clave de API y la clave de aplicación de una cuenta de servicio, recomendado para producción) o pat (un token de acceso personal, para pilotos); se lee de los campos de una credencial JSON cuando los tiene",
|
|
121
122
|
"help.connect.target": "con --credential-stdin: a qué apunta la conexión (organisation=..., instance_url=..., site=...); repetible",
|
|
122
123
|
"help.connect.deployment": "con --credential-stdin: el despliegue que guarda la credencial, cuando el inquilino tiene más de uno",
|
|
123
124
|
"help.connect.deployment_key": "con --credential-stdin: fijar la clave pública del despliegue (base64 o PEM, tal como la imprimió su infraestructura); el token solo se sella para una clave de sellado firmada por esa clave (o LIGHTHOUSE_DEPLOYMENT_KEY)",
|
|
@@ -265,6 +266,7 @@
|
|
|
265
266
|
"label.approve_at": "aprobar en",
|
|
266
267
|
"label.sent_to_your_own_store": "enviado a su propio almacén",
|
|
267
268
|
"label.access": "acceso",
|
|
269
|
+
"label.identity": "identidad",
|
|
268
270
|
"label.connection": "conexión",
|
|
269
271
|
"label.connected": "conectado",
|
|
270
272
|
"label.syncing": "sincronizando",
|
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
"help.connect.every": "sans fournisseur : lister aussi ceux à venir",
|
|
119
119
|
"help.connect.credential_stdin": "connecter un jeton existant, lu sur l'entrée standard, en votre nom (nécessite `cloudflared access login https://<hôte>`)",
|
|
120
120
|
"help.connect.access": "avec --credential-stdin : read (par défaut) ou read_write",
|
|
121
|
+
"help.connect.auth_mode": "avec --credential-stdin, Datadog : keys (une clé d'API et la clé d'application d'un compte de service, recommandé en production) ou pat (un jeton d'accès personnel, pour les pilotes) ; lu dans les champs d'un identifiant JSON lorsqu'il les contient",
|
|
121
122
|
"help.connect.target": "avec --credential-stdin : ce vers quoi pointe la connexion (organisation=..., instance_url=..., site=...) ; répétable",
|
|
122
123
|
"help.connect.deployment": "avec --credential-stdin : le déploiement qui conserve l'identifiant, lorsque le locataire en a plusieurs",
|
|
123
124
|
"help.connect.deployment_key": "avec --credential-stdin : épingler la clé publique du déploiement (base64 ou PEM, telle qu'affichée par votre infrastructure) ; le jeton n'est scellé que pour une clé de scellement signée par cette clé (ou LIGHTHOUSE_DEPLOYMENT_KEY)",
|
|
@@ -265,6 +266,7 @@
|
|
|
265
266
|
"label.approve_at": "approuver sur",
|
|
266
267
|
"label.sent_to_your_own_store": "envoyé à votre propre stockage",
|
|
267
268
|
"label.access": "accès",
|
|
269
|
+
"label.identity": "identité",
|
|
268
270
|
"label.connection": "connexion",
|
|
269
271
|
"label.connected": "connecté",
|
|
270
272
|
"label.syncing": "synchronisation en cours",
|
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
"help.connect.every": "gan soláthraí: liostaigh na cinn atá ag teacht freisin",
|
|
119
119
|
"help.connect.credential_stdin": "nasc comhartha atá ann cheana, léite ón ionchur caighdeánach, mar tú féin (teastaíonn `cloudflared access login https://<óstríomhaire>`)",
|
|
120
120
|
"help.connect.access": "le --credential-stdin: read (an réamhshocrú) nó read_write",
|
|
121
|
+
"help.connect.auth_mode": "le --credential-stdin, Datadog: keys (eochair API agus eochair feidhmchláir chuntas seirbhíse, molta don táirgeadh) nó pat (comhartha rochtana pearsanta, do phíolótaí); léite ó réimsí an dintiúir JSON nuair atá siad aige",
|
|
121
122
|
"help.connect.target": "le --credential-stdin: cad a dhíríonn an nasc air (organisation=..., instance_url=..., site=...); inathrá",
|
|
122
123
|
"help.connect.deployment": "le --credential-stdin: an t-imscaradh a choinníonn an dintiúr, nuair atá níos mó ná ceann amháin ag an tionónta",
|
|
123
124
|
"help.connect.deployment_key": "le --credential-stdin: bioráin an eochair phoiblí den imscaradh (base64 nó PEM, mar a phriontáil do bhonneagar í); ní shéalaítear an comhartha ach d'eochair shéalaithe a shínigh an eochair sin (nó LIGHTHOUSE_DEPLOYMENT_KEY)",
|
|
@@ -265,6 +266,7 @@
|
|
|
265
266
|
"label.approve_at": "formheas ag",
|
|
266
267
|
"label.sent_to_your_own_store": "seolta chuig do stór féin",
|
|
267
268
|
"label.access": "rochtain",
|
|
269
|
+
"label.identity": "aitheantas",
|
|
268
270
|
"label.connection": "nasc",
|
|
269
271
|
"label.connected": "nasctha",
|
|
270
272
|
"label.syncing": "ag sioncronú",
|
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
"help.connect.every": "senza fornitore: elencare anche quelli in arrivo",
|
|
119
119
|
"help.connect.credential_stdin": "collegare un token esistente, letto dallo standard input, come te stesso (richiede `cloudflared access login https://<host>`)",
|
|
120
120
|
"help.connect.access": "con --credential-stdin: read (predefinito) o read_write",
|
|
121
|
+
"help.connect.auth_mode": "con --credential-stdin, Datadog: keys (una chiave API e la chiave applicativa di un account di servizio, consigliato in produzione) o pat (un token di accesso personale, per i progetti pilota); letto dai campi di una credenziale JSON quando li contiene",
|
|
121
122
|
"help.connect.target": "con --credential-stdin: a cosa punta la connessione (organisation=..., instance_url=..., site=...); ripetibile",
|
|
122
123
|
"help.connect.deployment": "con --credential-stdin: il rilascio che conserva la credenziale, quando il tenant ne ha più di uno",
|
|
123
124
|
"help.connect.deployment_key": "con --credential-stdin: fissare la chiave pubblica del rilascio (base64 o PEM, come l'ha stampata la tua infrastruttura); il token viene sigillato solo per una chiave di sigillatura firmata da quella chiave (o LIGHTHOUSE_DEPLOYMENT_KEY)",
|
|
@@ -265,6 +266,7 @@
|
|
|
265
266
|
"label.approve_at": "approva su",
|
|
266
267
|
"label.sent_to_your_own_store": "inviato al tuo store",
|
|
267
268
|
"label.access": "accesso",
|
|
269
|
+
"label.identity": "identità",
|
|
268
270
|
"label.connection": "connessione",
|
|
269
271
|
"label.connected": "connesso",
|
|
270
272
|
"label.syncing": "in sincronizzazione",
|
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
"help.connect.every": "プロバイダー未指定時:近日対応予定のものも一覧表示します",
|
|
119
119
|
"help.connect.credential_stdin": "既存のトークンを標準入力から読み取り、ご自身として接続します(`cloudflared access login https://<host>` が必要)",
|
|
120
120
|
"help.connect.access": "--credential-stdin と併用:read(既定)または read_write",
|
|
121
|
+
"help.connect.auth_mode": "--credential-stdin と併用、Datadog:keys(API キーとサービスアカウントのアプリケーションキー、本番環境に推奨)または pat(個人アクセストークン、パイロット用)。JSON 形式の資格情報では、その項目から読み取ります",
|
|
121
122
|
"help.connect.target": "--credential-stdin と併用:接続の対象(organisation=...、instance_url=...、site=...)。複数回指定できます",
|
|
122
123
|
"help.connect.deployment": "--credential-stdin と併用:テナントに複数ある場合に、認証情報を保管するデプロイ",
|
|
123
124
|
"help.connect.deployment_key": "--credential-stdin と併用:デプロイの公開鍵を固定します(インフラが出力した base64 または PEM)。トークンは、その鍵が署名した封印鍵に対してのみ封印されます(または LIGHTHOUSE_DEPLOYMENT_KEY)",
|
|
@@ -265,6 +266,7 @@
|
|
|
265
266
|
"label.approve_at": "承認URL",
|
|
266
267
|
"label.sent_to_your_own_store": "自社ストアへ送信",
|
|
267
268
|
"label.access": "アクセス",
|
|
269
|
+
"label.identity": "ID の種類",
|
|
268
270
|
"label.connection": "接続",
|
|
269
271
|
"label.connected": "接続日",
|
|
270
272
|
"label.syncing": "同期中",
|
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
"help.connect.every": "zonder aanbieder: ook de aankomende weergeven",
|
|
119
119
|
"help.connect.credential_stdin": "een bestaand token koppelen, van de standaardinvoer gelezen, als jezelf (vereist `cloudflared access login https://<host>`)",
|
|
120
120
|
"help.connect.access": "met --credential-stdin: read (standaard) of read_write",
|
|
121
|
+
"help.connect.auth_mode": "met --credential-stdin, Datadog: keys (een API-sleutel en de applicatiesleutel van een serviceaccount, aanbevolen voor productie) of pat (een persoonlijk toegangstoken, voor pilots); gelezen uit de velden van een JSON-referentie als die ze heeft",
|
|
121
122
|
"help.connect.target": "met --credential-stdin: waarnaar de verbinding verwijst (organisation=..., instance_url=..., site=...); herhaalbaar",
|
|
122
123
|
"help.connect.deployment": "met --credential-stdin: de implementatie die het inloggegeven bewaart, als de tenant er meer dan één heeft",
|
|
123
124
|
"help.connect.deployment_key": "met --credential-stdin: de publieke sleutel van de implementatie vastzetten (base64 of PEM, zoals je infrastructuur hem afdrukte); het token wordt alleen verzegeld voor een verzegelsleutel die door die sleutel is ondertekend (of LIGHTHOUSE_DEPLOYMENT_KEY)",
|
|
@@ -265,6 +266,7 @@
|
|
|
265
266
|
"label.approve_at": "goedkeuren op",
|
|
266
267
|
"label.sent_to_your_own_store": "verzonden naar je eigen opslag",
|
|
267
268
|
"label.access": "toegang",
|
|
269
|
+
"label.identity": "identiteit",
|
|
268
270
|
"label.connection": "verbinding",
|
|
269
271
|
"label.connected": "verbonden",
|
|
270
272
|
"label.syncing": "synchroniseert",
|
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
"help.connect.every": "sem fornecedor: listar também os que vêm a caminho",
|
|
119
119
|
"help.connect.credential_stdin": "ligar um token existente, lido da entrada padrão, como você próprio (requer `cloudflared access login https://<host>`)",
|
|
120
120
|
"help.connect.access": "com --credential-stdin: read (por omissão) ou read_write",
|
|
121
|
+
"help.connect.auth_mode": "com --credential-stdin, Datadog: keys (uma chave de API e a chave de aplicação de uma conta de serviço, recomendado para produção) ou pat (um token de acesso pessoal, para pilotos); lido dos campos de uma credencial JSON quando os tem",
|
|
121
122
|
"help.connect.target": "com --credential-stdin: para onde aponta a ligação (organisation=..., instance_url=..., site=...); repetível",
|
|
122
123
|
"help.connect.deployment": "com --credential-stdin: a implementação que guarda a credencial, quando o inquilino tem mais do que uma",
|
|
123
124
|
"help.connect.deployment_key": "com --credential-stdin: fixar a chave pública da implementação (base64 ou PEM, como a sua infraestrutura a imprimiu); o token só é selado para uma chave de selagem assinada por essa chave (ou LIGHTHOUSE_DEPLOYMENT_KEY)",
|
|
@@ -265,6 +266,7 @@
|
|
|
265
266
|
"label.approve_at": "aprovar em",
|
|
266
267
|
"label.sent_to_your_own_store": "enviado para o seu armazenamento",
|
|
267
268
|
"label.access": "acesso",
|
|
269
|
+
"label.identity": "identidade",
|
|
268
270
|
"label.connection": "ligação",
|
|
269
271
|
"label.connected": "ligado",
|
|
270
272
|
"label.syncing": "a sincronizar",
|
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
"help.connect.every": "未指定提供商时:同时列出即将推出的",
|
|
119
119
|
"help.connect.credential_stdin": "以你自己的身份连接现有令牌,从标准输入读取(需要 `cloudflared access login https://<host>`)",
|
|
120
120
|
"help.connect.access": "与 --credential-stdin 搭配:read(默认)或 read_write",
|
|
121
|
+
"help.connect.auth_mode": "与 --credential-stdin 搭配,Datadog:keys(API 密钥和服务账户的应用密钥,建议用于生产)或 pat(个人访问令牌,用于试点);JSON 凭据中有相应字段时从中读取",
|
|
121
122
|
"help.connect.target": "与 --credential-stdin 搭配:连接指向的目标(organisation=...、instance_url=...、site=...);可重复使用",
|
|
122
123
|
"help.connect.deployment": "与 --credential-stdin 搭配:保管凭据的部署,适用于租户有多个部署的情况",
|
|
123
124
|
"help.connect.deployment_key": "与 --credential-stdin 搭配:固定部署的公钥(base64 或 PEM,按你的基础设施所打印的格式);令牌只会封装给由该密钥签名的封装密钥(或 LIGHTHOUSE_DEPLOYMENT_KEY)",
|
|
@@ -265,6 +266,7 @@
|
|
|
265
266
|
"label.approve_at": "批准地址",
|
|
266
267
|
"label.sent_to_your_own_store": "发送到你自己的存储",
|
|
267
268
|
"label.access": "访问",
|
|
269
|
+
"label.identity": "身份类型",
|
|
268
270
|
"label.connection": "连接",
|
|
269
271
|
"label.connected": "已连接",
|
|
270
272
|
"label.syncing": "同步中",
|
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
"help.connect.every": "未指定提供商時:同時列出即將推出的",
|
|
119
119
|
"help.connect.credential_stdin": "以你自己的身份連線現有權杖,從標準輸入讀取(需要 `cloudflared access login https://<host>`)",
|
|
120
120
|
"help.connect.access": "與 --credential-stdin 搭配:read(預設)或 read_write",
|
|
121
|
+
"help.connect.auth_mode": "與 --credential-stdin 搭配,Datadog:keys(API 金鑰和服務帳戶的應用程式金鑰,建議用於正式環境)或 pat(個人存取權杖,用於試行);JSON 憑證中有相應欄位時從中讀取",
|
|
121
122
|
"help.connect.target": "與 --credential-stdin 搭配:連線指向的目標(organisation=...、instance_url=...、site=...);可重複使用",
|
|
122
123
|
"help.connect.deployment": "與 --credential-stdin 搭配:保管憑據的部署,適用於租用戶有多個部署的情況",
|
|
123
124
|
"help.connect.deployment_key": "與 --credential-stdin 搭配:固定部署的公鑰(base64 或 PEM,按你的基礎設施所列印的格式);權杖只會封裝給由該金鑰簽名的封裝金鑰(或 LIGHTHOUSE_DEPLOYMENT_KEY)",
|
|
@@ -265,6 +266,7 @@
|
|
|
265
266
|
"label.approve_at": "批准地址",
|
|
266
267
|
"label.sent_to_your_own_store": "傳送到你自己的儲存",
|
|
267
268
|
"label.access": "訪問",
|
|
269
|
+
"label.identity": "身分類型",
|
|
268
270
|
"label.connection": "連線",
|
|
269
271
|
"label.connected": "已連線",
|
|
270
272
|
"label.syncing": "同步中",
|
|
@@ -234,6 +234,75 @@ def _two_lines(secret: str, first: str, second: str) -> tuple[str, str]:
|
|
|
234
234
|
return a.strip(), b.strip()
|
|
235
235
|
|
|
236
236
|
|
|
237
|
+
DATADOG_KEYS = ("api_key", "app_key")
|
|
238
|
+
DATADOG_MODES = ("keys", "pat")
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
def _datadog_site(given: Any, target: Mapping[str, Any]) -> str:
|
|
242
|
+
"""The engine's name for the site: from the credential, where it names
|
|
243
|
+
one (either the portal's name, us1, or Datadog's, datadoghq.com), else
|
|
244
|
+
from `--target site=`; the two may not disagree."""
|
|
245
|
+
named = str(target.get("site") or "").strip()
|
|
246
|
+
if given is not None:
|
|
247
|
+
given = str(given).strip()
|
|
248
|
+
got = DATADOG_ENGINE_SITES.get(given) or (
|
|
249
|
+
given if given in DATADOG_ENGINE_SITES.values() else None)
|
|
250
|
+
if got is None:
|
|
251
|
+
raise SealingError("site is one of Datadog's own sites")
|
|
252
|
+
if named and DATADOG_ENGINE_SITES.get(named) != got:
|
|
253
|
+
raise SealingError("site in the credential and --target site name different sites")
|
|
254
|
+
return got
|
|
255
|
+
got = DATADOG_ENGINE_SITES.get(named or "us1")
|
|
256
|
+
if got is None:
|
|
257
|
+
raise SealingError("site is one of Datadog's own sites")
|
|
258
|
+
return got
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def datadog_fields(secret: str, target: Mapping[str, Any],
|
|
262
|
+
mode: str | None = None) -> tuple[dict[str, str], str]:
|
|
263
|
+
"""A Datadog credential in either of its two shapes (issue 321), and its
|
|
264
|
+
auth mode: the key pair (`keys`, a service account's application key with
|
|
265
|
+
an API key) or a personal access token (`pat`, for pilots).
|
|
266
|
+
|
|
267
|
+
Either shape as a JSON object, `{"api_key", "app_key"}` or
|
|
268
|
+
`{"token", "site"}`, never fields of both; or as lines: the API key then
|
|
269
|
+
the application key, or with `--auth-mode pat` the token alone."""
|
|
270
|
+
secret = secret.strip()
|
|
271
|
+
if mode is not None and mode not in DATADOG_MODES:
|
|
272
|
+
raise SealingError("auth mode is keys or pat")
|
|
273
|
+
if secret.startswith("{"):
|
|
274
|
+
try:
|
|
275
|
+
doc = json.loads(secret)
|
|
276
|
+
except ValueError:
|
|
277
|
+
raise SealingError("the credential is a JSON object of its fields") from None
|
|
278
|
+
if not isinstance(doc, dict) or not all(isinstance(v, str) and v.strip()
|
|
279
|
+
for v in doc.values()):
|
|
280
|
+
raise SealingError("the credential is a JSON object of text fields")
|
|
281
|
+
has_keys = any(k in doc for k in DATADOG_KEYS)
|
|
282
|
+
if has_keys and "token" in doc:
|
|
283
|
+
raise SealingError("a datadog credential is api_key and app_key, or token and "
|
|
284
|
+
"site, never fields of both")
|
|
285
|
+
got = "pat" if "token" in doc else "keys"
|
|
286
|
+
allowed = {"token", "site"} if got == "pat" else {*DATADOG_KEYS, "site"}
|
|
287
|
+
if extra := set(doc) - allowed:
|
|
288
|
+
raise SealingError(f"a datadog credential has no field {sorted(extra)[0]}")
|
|
289
|
+
if got == "keys" and not all(k in doc for k in DATADOG_KEYS):
|
|
290
|
+
raise SealingError("a datadog key pair has api_key and app_key")
|
|
291
|
+
if mode is not None and mode != got:
|
|
292
|
+
raise SealingError(f"the credential is the {got} shape, not {mode}")
|
|
293
|
+
site = _datadog_site(doc.get("site"), target)
|
|
294
|
+
if got == "pat":
|
|
295
|
+
return {"token": doc["token"].strip(), "site": site}, "pat"
|
|
296
|
+
return {"api_key": doc["api_key"].strip(), "app_key": doc["app_key"].strip(),
|
|
297
|
+
"site": site}, "keys"
|
|
298
|
+
if mode == "pat":
|
|
299
|
+
if "\n" in secret:
|
|
300
|
+
raise SealingError("a personal access token is one line")
|
|
301
|
+
return {"token": secret, "site": _datadog_site(None, target)}, "pat"
|
|
302
|
+
api_key, app_key = _two_lines(secret, "the API key", "the application key")
|
|
303
|
+
return {"api_key": api_key, "app_key": app_key, "site": _datadog_site(None, target)}, "keys"
|
|
304
|
+
|
|
305
|
+
|
|
237
306
|
def credential_fields(connector: str, secret: str, target: Mapping[str, Any]) -> dict[str, str]:
|
|
238
307
|
"""What was piped in, and the identifiers named, as the engine stores them
|
|
239
308
|
(the service's `sealing.credential_fields`, line for line)."""
|
|
@@ -264,11 +333,7 @@ def credential_fields(connector: str, secret: str, target: Mapping[str, Any]) ->
|
|
|
264
333
|
if connector in WAVE_047:
|
|
265
334
|
return _erp_hr_fields(connector, secret, target)
|
|
266
335
|
if connector == "datadog":
|
|
267
|
-
|
|
268
|
-
engine_site = DATADOG_ENGINE_SITES.get(str(target.get("site") or "us1"))
|
|
269
|
-
if engine_site is None:
|
|
270
|
-
raise SealingError("site is one of Datadog's own sites")
|
|
271
|
-
return {"api_key": api_key, "app_key": app_key, "site": engine_site}
|
|
336
|
+
return datadog_fields(secret, target)[0]
|
|
272
337
|
out = {"service_account": secret}
|
|
273
338
|
user = str(target.get("user") or "").strip()
|
|
274
339
|
if user:
|
|
@@ -18,7 +18,7 @@ build-backend = "setuptools.build_meta"
|
|
|
18
18
|
|
|
19
19
|
[project]
|
|
20
20
|
name = "lighthouse-cli"
|
|
21
|
-
version = "0.
|
|
21
|
+
version = "0.44.0"
|
|
22
22
|
description = "The LightHouse command line: sign in, connect your estate, deploy agents, watch runs"
|
|
23
23
|
requires-python = ">=3.11"
|
|
24
24
|
license = "Apache-2.0"
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Copyright 2026 Atlantic Agentic Labs. All Rights Reserved.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
"""Issue 321: `lighthouse-ai connect datadog --credential-stdin` takes either
|
|
4
|
+
Datadog shape, the key pair (a service account's) or a personal access token
|
|
5
|
+
(`{token, site}`, for pilots), seals the one it was given with its auth mode,
|
|
6
|
+
and refuses a mixed shape before anything is sent. Invented keys throughout."""
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import json
|
|
10
|
+
from typing import Any
|
|
11
|
+
|
|
12
|
+
import httpx
|
|
13
|
+
import pytest
|
|
14
|
+
|
|
15
|
+
from lighthouse import sealing
|
|
16
|
+
from tests.api_fixtures import load
|
|
17
|
+
from tests.conftest import HOST, Runner, routes
|
|
18
|
+
from tests.test_commands import SESSION, signed_in
|
|
19
|
+
from tests.test_sealing import FIXTURE_FP_KEY, VECTORS, opened
|
|
20
|
+
|
|
21
|
+
DD_TOKEN = "ddpat-not-a-real-personal-token-0001" # noqa: S105 # nosec B105
|
|
22
|
+
DD_API = "not-a-real-dd-api-key-000000000000"
|
|
23
|
+
DD_APP = "not-a-real-dd-app-key-0000000000000000000"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _session(monkeypatch: Any) -> None:
|
|
27
|
+
from lighthouse.commands import connect as connect_module
|
|
28
|
+
monkeypatch.setattr(connect_module, "person_session", lambda host: SESSION)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _pending(seen: list[httpx.Request]) -> Any:
|
|
32
|
+
def handler(request: httpx.Request) -> httpx.Response:
|
|
33
|
+
seen.append(request)
|
|
34
|
+
body = json.loads(request.content)
|
|
35
|
+
personal = body.get("auth_mode") == "pat"
|
|
36
|
+
return httpx.Response(202, json={
|
|
37
|
+
"id": body.get("connection", "cx-abcdef123456"), "connector": "datadog",
|
|
38
|
+
"label": "Datadog", "access": "read", "can_write": False, "write_scopes": [],
|
|
39
|
+
"access_note": "Read only.", "state": "pending", "pending": True,
|
|
40
|
+
"reason": "Waiting for your deployment example-org-prod to keep it.",
|
|
41
|
+
"sealed_by": "cli", "deployment": "example-org-prod", "secret_store": "aws",
|
|
42
|
+
"auth_mode": body.get("auth_mode"),
|
|
43
|
+
"identity_type": "personal" if personal else "service_account",
|
|
44
|
+
"identity_label": "Personal, for pilots" if personal
|
|
45
|
+
else "Service account (recommended for production)",
|
|
46
|
+
"fingerprint": body.get("fingerprint", "a" * 32), "replaced": [],
|
|
47
|
+
"command": {"command_id": "0" * 32, "status": "queued"}})
|
|
48
|
+
return handler
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _run(run: Runner, monkeypatch: Any, stdin: str, *args: str,
|
|
52
|
+
sealing_doc: str = "connectors-sealing-ready") -> tuple[Any, list[httpx.Request]]:
|
|
53
|
+
_session(monkeypatch)
|
|
54
|
+
signed_in(run)
|
|
55
|
+
seen: list[httpx.Request] = []
|
|
56
|
+
run.transport = routes({("GET", "/api/v1/connectors"): load("connectors"),
|
|
57
|
+
("GET", "/api/v1/connectors/sealing"): load(sealing_doc),
|
|
58
|
+
("POST", "/api/v1/connectors/datadog/token"): _pending(seen)})
|
|
59
|
+
pin = ("--deployment-key", VECTORS["deployment_public_key"]) \
|
|
60
|
+
if sealing_doc == "connectors-sealing-ready" else ()
|
|
61
|
+
result = run(f"--host={HOST}", "connect", "datadog", "--credential-stdin", "--json",
|
|
62
|
+
*pin, *args, stdin=stdin)
|
|
63
|
+
return result, seen
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def test_a_personal_token_is_sealed_with_its_site_and_labelled_personal(
|
|
67
|
+
run: Runner, monkeypatch: Any) -> None:
|
|
68
|
+
result, seen = _run(run, monkeypatch, json.dumps({"token": DD_TOKEN, "site": "eu1"}))
|
|
69
|
+
assert result.code == 0, result.stderr
|
|
70
|
+
(req,) = seen
|
|
71
|
+
assert DD_TOKEN.encode() not in req.content
|
|
72
|
+
body = json.loads(req.content)
|
|
73
|
+
assert body["auth_mode"] == "pat" and body["target"] == {"site": "eu1"}
|
|
74
|
+
fields = {"token": DD_TOKEN, "site": "datadoghq.eu"}
|
|
75
|
+
assert opened(body["sealed"], "datadog", body["connection"]) == sealing.canonical(fields)
|
|
76
|
+
assert body["fingerprint"] == sealing.fingerprint(fields, FIXTURE_FP_KEY)
|
|
77
|
+
assert result.json["identity_type"] == "personal"
|
|
78
|
+
assert result.json["identity"] == "Personal, for pilots"
|
|
79
|
+
assert DD_TOKEN not in result.stdout + result.stderr
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def test_a_token_line_needs_the_mode_named(run: Runner, monkeypatch: Any) -> None:
|
|
83
|
+
result, seen = _run(run, monkeypatch, DD_TOKEN + "\n", "--auth-mode", "pat",
|
|
84
|
+
"--target", "site=us5")
|
|
85
|
+
assert result.code == 0, result.stderr
|
|
86
|
+
body = json.loads(seen[0].content)
|
|
87
|
+
assert body["auth_mode"] == "pat" and body["target"] == {"site": "us5"}
|
|
88
|
+
assert opened(body["sealed"], "datadog", body["connection"]) == sealing.canonical(
|
|
89
|
+
{"token": DD_TOKEN, "site": "us5.datadoghq.com"})
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@pytest.mark.parametrize("stdin", [f"{DD_API}\n{DD_APP}\n",
|
|
93
|
+
json.dumps({"api_key": DD_API, "app_key": DD_APP,
|
|
94
|
+
"site": "datadoghq.eu"})])
|
|
95
|
+
def test_the_key_pair_in_either_form_is_sealed_as_a_service_account(
|
|
96
|
+
run: Runner, monkeypatch: Any, stdin: str) -> None:
|
|
97
|
+
result, seen = _run(run, monkeypatch, stdin, "--target", "site=eu1")
|
|
98
|
+
assert result.code == 0, result.stderr
|
|
99
|
+
body = json.loads(seen[0].content)
|
|
100
|
+
assert body["auth_mode"] == "keys" and body["target"] == {"site": "eu1"}
|
|
101
|
+
assert opened(body["sealed"], "datadog", body["connection"]) == sealing.canonical(
|
|
102
|
+
{"api_key": DD_API, "app_key": DD_APP, "site": "datadoghq.eu"})
|
|
103
|
+
assert result.json["identity_type"] == "service_account"
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
@pytest.mark.parametrize(("stdin", "args", "words"), [
|
|
107
|
+
(json.dumps({"api_key": DD_API, "app_key": DD_APP, "token": DD_TOKEN, "site": "eu1"}), (),
|
|
108
|
+
"never fields of both"),
|
|
109
|
+
(json.dumps({"api_key": DD_API, "token": DD_TOKEN}), (), "never fields of both"),
|
|
110
|
+
(json.dumps({"token": DD_TOKEN, "site": "eu1", "user": "x"}), (), "no field user"),
|
|
111
|
+
(json.dumps({"token": DD_TOKEN, "site": "nowhere.example"}), (), "Datadog's own sites"),
|
|
112
|
+
(json.dumps({"token": DD_TOKEN, "site": "eu1"}), ("--target", "site=us1"),
|
|
113
|
+
"different sites"),
|
|
114
|
+
(json.dumps({"token": DD_TOKEN, "site": "eu1"}), ("--auth-mode", "keys"), "not keys"),
|
|
115
|
+
(DD_TOKEN, (), "two lines"),
|
|
116
|
+
])
|
|
117
|
+
def test_a_mixed_or_malformed_shape_is_refused_before_anything_is_sent(
|
|
118
|
+
run: Runner, monkeypatch: Any, stdin: str, args: tuple[str, ...], words: str) -> None:
|
|
119
|
+
result, seen = _run(run, monkeypatch, stdin, *args)
|
|
120
|
+
assert result.code != 0
|
|
121
|
+
assert words in result.stdout + result.stderr
|
|
122
|
+
assert seen == []
|
|
123
|
+
assert DD_TOKEN not in result.stdout + result.stderr
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def test_a_personal_token_is_never_sent_in_the_clear(run: Runner, monkeypatch: Any) -> None:
|
|
127
|
+
result, seen = _run(run, monkeypatch, json.dumps({"token": DD_TOKEN, "site": "eu1"}),
|
|
128
|
+
sealing_doc="connectors-sealing")
|
|
129
|
+
assert result.code != 0 and "only ever sealed" in result.stdout + result.stderr
|
|
130
|
+
assert seen == []
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def test_a_json_key_pair_without_a_deployment_is_sent_as_the_two_lines(
|
|
134
|
+
run: Runner, monkeypatch: Any) -> None:
|
|
135
|
+
result, seen = _run(run, monkeypatch,
|
|
136
|
+
json.dumps({"api_key": DD_API, "app_key": DD_APP, "site": "eu1"}),
|
|
137
|
+
sealing_doc="connectors-sealing")
|
|
138
|
+
assert result.code == 0, result.stderr
|
|
139
|
+
assert json.loads(seen[0].content) == {"credential": f"{DD_API}\n{DD_APP}",
|
|
140
|
+
"target": {"site": "eu1"}}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def test_auth_mode_is_for_datadog_alone(run: Runner, monkeypatch: Any) -> None:
|
|
144
|
+
_session(monkeypatch)
|
|
145
|
+
signed_in(run)
|
|
146
|
+
run.transport = routes({("GET", "/api/v1/connectors"): load("connectors"),
|
|
147
|
+
("GET", "/api/v1/connectors/sealing"): load("connectors-sealing")})
|
|
148
|
+
result = run(f"--host={HOST}", "connect", "github", "--credential-stdin",
|
|
149
|
+
"--auth-mode", "pat", stdin="ghp_notarealtoken000000000000")
|
|
150
|
+
assert result.code != 0 and "for Datadog" in result.stdout + result.stderr
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lighthouse_cli-0.43.1 → lighthouse_cli-0.44.0}/lighthouse_cli.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|