@ory/argus 0.6.1 → 0.7.0
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.
- package/assets/skills/ory-e2b-sandbox/SKILL.md +2 -2
- package/assets/skills/permissions-onboarding/SKILL.md +2 -2
- package/dist/agent-auth.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/dev.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/local/manager.js +1 -1
- package/dist/permissions-cli.js +3 -3
- package/dist/setup.js +3 -3
- package/dist/status-cli.d.ts +1 -1
- package/dist/status-cli.js +10 -10
- package/dist/subject.d.ts +2 -2
- package/dist/subject.js +2 -2
- package/dist/{auth-gate.d.ts → user-login.d.ts} +10 -10
- package/dist/{auth-gate.js → user-login.js} +14 -14
- package/package.json +1 -1
|
@@ -66,7 +66,7 @@ export const template = Template()
|
|
|
66
66
|
// Sandbox runtime defaults. Per-tenant secrets (project URL, tokens, client
|
|
67
67
|
// IDs) MUST be passed at Sandbox.create() time, never baked into the image.
|
|
68
68
|
.setEnvs({
|
|
69
|
-
|
|
69
|
+
ORY_USER_LOGIN: "1",
|
|
70
70
|
ORY_PERMISSION_MODE: "observe",
|
|
71
71
|
ORY_PERMISSION_NAMESPACE: "AgentTools",
|
|
72
72
|
ORY_AGENT_DEBUG: "true",
|
|
@@ -198,7 +198,7 @@ await sbx.commands.run("{{BIN}} --version"); // sanity check
|
|
|
198
198
|
```
|
|
199
199
|
|
|
200
200
|
Sandboxes are headless, so the user **must** pre-supply
|
|
201
|
-
`ORY_USER_SESSION_TOKEN` or `ORY_USER_OAUTH2_TOKEN` — otherwise
|
|
201
|
+
`ORY_USER_SESSION_TOKEN` or `ORY_USER_OAUTH2_TOKEN` — otherwise user login's
|
|
202
202
|
PKCE browser flow has no target and hangs. See {{REF_AUTH_SETUP}} for the full
|
|
203
203
|
env-var matrix.
|
|
204
204
|
|
|
@@ -92,9 +92,9 @@ out-of-band as they come into scope.
|
|
|
92
92
|
Two common failure modes:
|
|
93
93
|
|
|
94
94
|
1. **No user identity cached.** Bootstrap needs to know which subject
|
|
95
|
-
to grant tuples to. If
|
|
95
|
+
to grant tuples to. If user login has never run (no PKCE login,
|
|
96
96
|
no `ORY_USER_SUBJECT_ID`), the command refuses. Run the harness once
|
|
97
|
-
with `
|
|
97
|
+
with `ORY_USER_LOGIN=1` to cache a user token, or set
|
|
98
98
|
`ORY_USER_SUBJECT_ID=<id>` to target a known subject.
|
|
99
99
|
2. **Credentials lack write scope on the permission namespace.** The
|
|
100
100
|
command prints the full tuple list so you can apply them manually
|
package/dist/agent-auth.js
CHANGED
|
@@ -290,7 +290,7 @@ async function resolveAgentCredentials(options = {}) {
|
|
|
290
290
|
}
|
|
291
291
|
return {
|
|
292
292
|
kind: "none",
|
|
293
|
-
reason: "No agent credentials configured. Run with a user session (
|
|
293
|
+
reason: "No agent credentials configured. Run with a user session (ORY_USER_LOGIN=1) or set ORY_AGENT_API_KEY / ORY_AGENT_CLIENT_ID + ORY_AGENT_CLIENT_SECRET / ORY_AGENT_REGISTRATION_TOKEN.",
|
|
294
294
|
warnings,
|
|
295
295
|
};
|
|
296
296
|
}
|
package/dist/cli.js
CHANGED
|
@@ -146,7 +146,7 @@ function printEnvironment() {
|
|
|
146
146
|
console.log("");
|
|
147
147
|
console.log("Environment:");
|
|
148
148
|
const vars = [
|
|
149
|
-
["
|
|
149
|
+
["ORY_USER_LOGIN", process.env.ORY_USER_LOGIN, false],
|
|
150
150
|
[
|
|
151
151
|
"ORY_AGENT_API_KEY",
|
|
152
152
|
process.env.ORY_AGENT_API_KEY ? "(set)" : undefined,
|
package/dist/dev.js
CHANGED
|
@@ -403,9 +403,9 @@ function buildLocalOryEnv(gatewayUrl, seed) {
|
|
|
403
403
|
return {
|
|
404
404
|
ORY_PROJECT_URL: gatewayUrl,
|
|
405
405
|
ORY_PERMISSION_NAMESPACE: seed.permissions.namespace,
|
|
406
|
-
// User
|
|
406
|
+
// User login — always on in local dev so the launcher demonstrates
|
|
407
407
|
// the interactive PKCE login UX end-to-end every session.
|
|
408
|
-
|
|
408
|
+
ORY_USER_LOGIN: "1",
|
|
409
409
|
// Agent identity — the harness self-registers via DCR on first run
|
|
410
410
|
// using the user's bearer as the initial access token. No static
|
|
411
411
|
// client_credentials are seeded; explicitly clear them so a leaking
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { Tracer, ActiveSpan, deriveTraceId, formatSpan, watchTraceFile, type Tra
|
|
|
4
4
|
export { loadConfig, saveConfig, resolveConfig, mutateConfig, getConfigPath, getDataDir, getHarnessDataDir, type OryPluginConfig, type OryOAuth2Tokens, type OryUserCredentials, type OryAgentCredentialsBlock, type OryAgentDynamicCredentials, type PermissionMode, } from "./config.js";
|
|
5
5
|
export { pkceLogin, refreshAccessToken, detectHeadless, generateCodeVerifier, sha256Base64Url, buildAuthorizeUrl, LOOPBACK_PORTS, DEFAULT_LOGIN_TIMEOUT_MS, type PkceLoginOptions, type PkceLoginOutcome, type PkceDeclineReason, } from "./auth.js";
|
|
6
6
|
export { loadTokens, saveTokens, clearTokens, isExpired, refreshAndSave, tryAcquirePkceFlightLock, clearPkceFlightLock, waitForPeerTokens, waitForPeerTokensSync, TOKEN_EXPIRY_SKEW_SEC, type PkceFlightLock, } from "./auth-store.js";
|
|
7
|
-
export { ensureUserAuthenticated, ensureAuthenticated, type
|
|
7
|
+
export { ensureUserAuthenticated, ensureAuthenticated, type UserLoginDecision, type UserLoginMode, type UserLoginOptions, } from "./user-login.js";
|
|
8
8
|
export { resolveAgentCredentials, ensureAgentIdentity, ensureSubAgentIdentity, fetchClientCredentialsToken, registerAgentClient, loadAgentDynamicCredentials, saveAgentDynamicCredentials, clearAgentDynamicCredentials, loadSubAgentDynamicCredentials, saveSubAgentDynamicCredentials, clearSubAgentDynamicCredentials, AGENT_TOKEN_EXPIRY_SKEW_SEC, type AgentCredentials, type AgentCredentialKind, type ResolveAgentCredentialsOptions, type EnsureAgentIdentityOptions, type RegisterAgentClientArgs, type SubAgentIdentity, type EnsureSubAgentIdentityOptions, } from "./agent-auth.js";
|
|
9
9
|
export { type SessionInfo, type OAuth2TokenInfo, type PermissionCheck, type PermissionResult, type BatchPermissionResult, type OryError, type OryErrorCode, } from "./types.js";
|
|
10
10
|
export { runConfigureCommand, runAgentCommand, printOryConfig, printEnvironment, printLogTail, printEnvHelp, printTraceTail, runWatchCommand, isTtyAvailable, promptOnTty, promptForProjectUrl, interactiveConfigPrompt, } from "./cli.js";
|
package/dist/index.js
CHANGED
|
@@ -42,9 +42,9 @@ Object.defineProperty(exports, "clearPkceFlightLock", { enumerable: true, get: f
|
|
|
42
42
|
Object.defineProperty(exports, "waitForPeerTokens", { enumerable: true, get: function () { return auth_store_js_1.waitForPeerTokens; } });
|
|
43
43
|
Object.defineProperty(exports, "waitForPeerTokensSync", { enumerable: true, get: function () { return auth_store_js_1.waitForPeerTokensSync; } });
|
|
44
44
|
Object.defineProperty(exports, "TOKEN_EXPIRY_SKEW_SEC", { enumerable: true, get: function () { return auth_store_js_1.TOKEN_EXPIRY_SKEW_SEC; } });
|
|
45
|
-
var
|
|
46
|
-
Object.defineProperty(exports, "ensureUserAuthenticated", { enumerable: true, get: function () { return
|
|
47
|
-
Object.defineProperty(exports, "ensureAuthenticated", { enumerable: true, get: function () { return
|
|
45
|
+
var user_login_js_1 = require("./user-login.js");
|
|
46
|
+
Object.defineProperty(exports, "ensureUserAuthenticated", { enumerable: true, get: function () { return user_login_js_1.ensureUserAuthenticated; } });
|
|
47
|
+
Object.defineProperty(exports, "ensureAuthenticated", { enumerable: true, get: function () { return user_login_js_1.ensureAuthenticated; } });
|
|
48
48
|
var agent_auth_js_1 = require("./agent-auth.js");
|
|
49
49
|
Object.defineProperty(exports, "resolveAgentCredentials", { enumerable: true, get: function () { return agent_auth_js_1.resolveAgentCredentials; } });
|
|
50
50
|
Object.defineProperty(exports, "ensureAgentIdentity", { enumerable: true, get: function () { return agent_auth_js_1.ensureAgentIdentity; } });
|
package/dist/local/manager.js
CHANGED
|
@@ -647,7 +647,7 @@ function printSeedResult(result) {
|
|
|
647
647
|
console.log("To use with any Ory agent plugin, set these environment variables:");
|
|
648
648
|
console.log("");
|
|
649
649
|
console.log(` export ORY_PROJECT_URL=${configs_js_1.GATEWAY_URL}`);
|
|
650
|
-
console.log(` export
|
|
650
|
+
console.log(` export ORY_USER_LOGIN=1`);
|
|
651
651
|
console.log(` export ORY_OAUTH2_CLIENT_ID=${result.user.client.clientId}`);
|
|
652
652
|
console.log(` export ORY_USER_SUBJECT_NAMESPACE=User`);
|
|
653
653
|
console.log(` export ORY_USER_SUBJECT_ID=${result.user.identity.id}`);
|
package/dist/permissions-cli.js
CHANGED
|
@@ -40,7 +40,7 @@ function resolveNamespace() {
|
|
|
40
40
|
* Apply persisted user OAuth2 tokens (if any) to the client's user
|
|
41
41
|
* principal so downstream subject resolution and tuple writes see a
|
|
42
42
|
* concrete identity. Mirrors what `ensureUserAuthenticated` does on a
|
|
43
|
-
* cache hit — but works whether or not `
|
|
43
|
+
* cache hit — but works whether or not `ORY_USER_LOGIN` is enabled.
|
|
44
44
|
*/
|
|
45
45
|
function attachCachedUserPrincipal(client) {
|
|
46
46
|
const tokens = (0, auth_store_js_1.loadTokens)();
|
|
@@ -151,7 +151,7 @@ async function runPermissionsStatus(binName, harness) {
|
|
|
151
151
|
const subjectId = (0, subject_js_1.subjectLabel)(subject);
|
|
152
152
|
if (subjectId === "agent:unknown") {
|
|
153
153
|
console.log("No user identity resolved.");
|
|
154
|
-
console.log("Run the harness once (so
|
|
154
|
+
console.log("Run the harness once (so user login caches a token) or set");
|
|
155
155
|
console.log("ORY_USER_SUBJECT_ID to probe against a known subject.");
|
|
156
156
|
return 0;
|
|
157
157
|
}
|
|
@@ -235,7 +235,7 @@ async function runPermissionsBootstrap(binName, harness, args) {
|
|
|
235
235
|
console.error("No user identity resolved — refusing to write permissions for an unknown subject.");
|
|
236
236
|
console.error("");
|
|
237
237
|
console.error("Either:");
|
|
238
|
-
console.error(" - run the harness once with
|
|
238
|
+
console.error(" - run the harness once with ORY_USER_LOGIN=1 so a user token is cached, or");
|
|
239
239
|
console.error(" - set ORY_USER_SUBJECT_ID=<id> to target a known subject.");
|
|
240
240
|
return 1;
|
|
241
241
|
}
|
package/dist/setup.js
CHANGED
|
@@ -374,7 +374,7 @@ Environment variables:
|
|
|
374
374
|
ORY_PROJECT_URL Your Ory project URL (required at runtime)
|
|
375
375
|
ORY_AGENT_API_KEY Agent API key / OAuth2 bearer (preferred name;
|
|
376
376
|
ORY_API_KEY is honored as a deprecated alias)
|
|
377
|
-
|
|
377
|
+
ORY_USER_LOGIN Set to "1" to enable the interactive user login
|
|
378
378
|
ORY_PERMISSION_MODE "observe" (default) or "enforce" — what to do on deny
|
|
379
379
|
ORY_AGENT_DEBUG Set to "true" for debug logging
|
|
380
380
|
ORY_AGENT_LOG_FILE Path to write debug logs
|
|
@@ -391,8 +391,8 @@ function printNextSteps(harnessName, uninstallCmd) {
|
|
|
391
391
|
console.log(" export ORY_PROJECT_URL=https://your-project.projects.oryapis.com");
|
|
392
392
|
console.log(" export ORY_AGENT_API_KEY=ory_pat_...");
|
|
393
393
|
console.log("");
|
|
394
|
-
console.log(" 2. Turn on the interactive user login
|
|
395
|
-
console.log(" export
|
|
394
|
+
console.log(" 2. Turn on the interactive user login (opt-in):");
|
|
395
|
+
console.log(" export ORY_USER_LOGIN=1");
|
|
396
396
|
console.log(` Without this, ${harnessName} runs without a human Ory identity attached`);
|
|
397
397
|
console.log(" to the session and permission checks fall back to a session:<id> subject.");
|
|
398
398
|
console.log("");
|
package/dist/status-cli.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Render the "User identity" block. Shows the `
|
|
2
|
+
* Render the "User identity" block. Shows the `ORY_USER_LOGIN` state and,
|
|
3
3
|
* when a PKCE token is cached, the resolved subject and expiry.
|
|
4
4
|
*/
|
|
5
5
|
export declare function printUserIdentitySection(): void;
|
package/dist/status-cli.js
CHANGED
|
@@ -24,10 +24,10 @@ const cli_js_1 = require("./cli.js");
|
|
|
24
24
|
function resolveNamespace() {
|
|
25
25
|
return process.env.ORY_PERMISSION_NAMESPACE ?? "AgentTools";
|
|
26
26
|
}
|
|
27
|
-
const
|
|
28
|
-
function
|
|
29
|
-
const v = process.env.
|
|
30
|
-
return !!v &&
|
|
27
|
+
const USER_LOGIN_ENABLED = new Set(["1", "true", "yes", "on"]);
|
|
28
|
+
function isUserLoginEnabled() {
|
|
29
|
+
const v = process.env.ORY_USER_LOGIN?.toLowerCase();
|
|
30
|
+
return !!v && USER_LOGIN_ENABLED.has(v);
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Format a relative duration like "4h 32m" or "12s" for a future deadline.
|
|
@@ -49,22 +49,22 @@ function formatExpiresIn(expiresAtSec, nowMs = Date.now()) {
|
|
|
49
49
|
return `${remaining}s`;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
-
* Render the "User identity" block. Shows the `
|
|
52
|
+
* Render the "User identity" block. Shows the `ORY_USER_LOGIN` state and,
|
|
53
53
|
* when a PKCE token is cached, the resolved subject and expiry.
|
|
54
54
|
*/
|
|
55
55
|
function printUserIdentitySection() {
|
|
56
|
-
const
|
|
56
|
+
const loginOn = isUserLoginEnabled();
|
|
57
57
|
const tokens = (0, auth_store_js_1.loadTokens)();
|
|
58
58
|
console.log("");
|
|
59
59
|
console.log("User identity (interactive PKCE login):");
|
|
60
|
-
console.log(`
|
|
60
|
+
console.log(` Login: ${loginOn ? "on (ORY_USER_LOGIN)" : "off (set ORY_USER_LOGIN=1 to enable)"}`);
|
|
61
61
|
if (!tokens) {
|
|
62
62
|
console.log(" Token cache: empty");
|
|
63
|
-
if (
|
|
63
|
+
if (loginOn) {
|
|
64
64
|
console.log(" Subject: (will resolve at next session start)");
|
|
65
65
|
}
|
|
66
66
|
else {
|
|
67
|
-
console.log(" Subject: (
|
|
67
|
+
console.log(" Subject: (login disabled — no PKCE flow will run)");
|
|
68
68
|
}
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
@@ -209,7 +209,7 @@ async function printPermissionsSection(binName, harness) {
|
|
|
209
209
|
}
|
|
210
210
|
const hasUser = !!process.env.ORY_USER_SUBJECT_ID || isUserTokenUsable();
|
|
211
211
|
if (!hasUser) {
|
|
212
|
-
console.log(` Coverage: n/a (no cached user identity — run with
|
|
212
|
+
console.log(` Coverage: n/a (no cached user identity — run with ORY_USER_LOGIN=1 once,`);
|
|
213
213
|
console.log(` or set ORY_USER_SUBJECT_ID to probe a known subject)`);
|
|
214
214
|
return;
|
|
215
215
|
}
|
package/dist/subject.d.ts
CHANGED
|
@@ -27,8 +27,8 @@ export type UserSubjectRef = {
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
30
|
-
* Resolve the user subject for permission checks. Prefers the
|
|
31
|
-
* `userPrincipal.subject`, falls back to `ORY_USER_SUBJECT_ID`, then the
|
|
30
|
+
* Resolve the user subject for permission checks. Prefers the user
|
|
31
|
+
* login's `userPrincipal.subject`, falls back to `ORY_USER_SUBJECT_ID`, then the
|
|
32
32
|
* legacy `ORY_AGENT_SUBJECT_ID`, then the caller-supplied `fallback`
|
|
33
33
|
* (typically `session:<id>`).
|
|
34
34
|
*
|
package/dist/subject.js
CHANGED
|
@@ -21,8 +21,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
exports.resolveUserSubject = resolveUserSubject;
|
|
22
22
|
exports.subjectLabel = subjectLabel;
|
|
23
23
|
/**
|
|
24
|
-
* Resolve the user subject for permission checks. Prefers the
|
|
25
|
-
* `userPrincipal.subject`, falls back to `ORY_USER_SUBJECT_ID`, then the
|
|
24
|
+
* Resolve the user subject for permission checks. Prefers the user
|
|
25
|
+
* login's `userPrincipal.subject`, falls back to `ORY_USER_SUBJECT_ID`, then the
|
|
26
26
|
* legacy `ORY_AGENT_SUBJECT_ID`, then the caller-supplied `fallback`
|
|
27
27
|
* (typically `session:<id>`).
|
|
28
28
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* User
|
|
2
|
+
* User login. Orchestrates the "first interaction must
|
|
3
3
|
* authenticate the human user" requirement across all plugins:
|
|
4
4
|
*
|
|
5
5
|
* 1. Resolve config (env + ~/.config/ory-agent-plugins/config.json).
|
|
@@ -17,20 +17,20 @@
|
|
|
17
17
|
* Every terminal path emits exactly one `user.auth` trace span so that
|
|
18
18
|
* the audit trail is complete regardless of outcome.
|
|
19
19
|
*
|
|
20
|
-
* The whole
|
|
21
|
-
* `
|
|
20
|
+
* The whole flow is a no-op (mode `disabled`) unless the
|
|
21
|
+
* `ORY_USER_LOGIN` env var is set to `1`/`true`.
|
|
22
22
|
*
|
|
23
|
-
* This
|
|
23
|
+
* This authenticates the *user* (the human at the keyboard). The
|
|
24
24
|
* separate agent identity (the AI process making the calls) is resolved
|
|
25
25
|
* non-interactively via env-configured machine credentials and is not
|
|
26
|
-
* handled here — see `ensureAgentIdentity
|
|
26
|
+
* handled here — see `ensureAgentIdentity`.
|
|
27
27
|
*/
|
|
28
28
|
import { OryAgentClient } from "./client.js";
|
|
29
29
|
import { type OryOAuth2Tokens } from "./config.js";
|
|
30
30
|
import { promptForProjectUrl } from "./cli.js";
|
|
31
31
|
import { pkceLogin } from "./auth.js";
|
|
32
|
-
export type
|
|
33
|
-
export interface
|
|
32
|
+
export type UserLoginMode = "disabled" | "audit_only" | "env_token" | "ok" | "refreshed" | "skipped" | "declined" | "error";
|
|
33
|
+
export interface UserLoginOptions {
|
|
34
34
|
/** Bin name used in user-facing prompts (e.g. "ory-claude"). */
|
|
35
35
|
binName: string;
|
|
36
36
|
/** Logical harness name (used by the tracer). */
|
|
@@ -47,11 +47,11 @@ export interface AuthGateOptions {
|
|
|
47
47
|
/** Override the prompt-for-URL step (for tests). */
|
|
48
48
|
promptForProjectUrlFn?: typeof promptForProjectUrl;
|
|
49
49
|
}
|
|
50
|
-
export interface
|
|
50
|
+
export interface UserLoginDecision {
|
|
51
51
|
/** Whether the caller should let the session proceed. */
|
|
52
52
|
proceed: boolean;
|
|
53
53
|
/** Stable mode identifier for telemetry and tests. */
|
|
54
|
-
mode:
|
|
54
|
+
mode: UserLoginMode;
|
|
55
55
|
/** Human-readable reason; safe to surface to the operator. */
|
|
56
56
|
reason: string;
|
|
57
57
|
/** Subject (sub claim) when authenticated. */
|
|
@@ -61,7 +61,7 @@ export interface AuthGateDecision {
|
|
|
61
61
|
* The entry point that every plugin's session-start handler should call
|
|
62
62
|
* to authenticate the human user. Always returns a decision; never throws.
|
|
63
63
|
*/
|
|
64
|
-
export declare function ensureUserAuthenticated(client: OryAgentClient, options:
|
|
64
|
+
export declare function ensureUserAuthenticated(client: OryAgentClient, options: UserLoginOptions): Promise<UserLoginDecision>;
|
|
65
65
|
/** Re-export so callers don't need to import auth.ts directly. */
|
|
66
66
|
export type { OryOAuth2Tokens };
|
|
67
67
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* User
|
|
3
|
+
* User login. Orchestrates the "first interaction must
|
|
4
4
|
* authenticate the human user" requirement across all plugins:
|
|
5
5
|
*
|
|
6
6
|
* 1. Resolve config (env + ~/.config/ory-agent-plugins/config.json).
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
* Every terminal path emits exactly one `user.auth` trace span so that
|
|
19
19
|
* the audit trail is complete regardless of outcome.
|
|
20
20
|
*
|
|
21
|
-
* The whole
|
|
22
|
-
* `
|
|
21
|
+
* The whole flow is a no-op (mode `disabled`) unless the
|
|
22
|
+
* `ORY_USER_LOGIN` env var is set to `1`/`true`.
|
|
23
23
|
*
|
|
24
|
-
* This
|
|
24
|
+
* This authenticates the *user* (the human at the keyboard). The
|
|
25
25
|
* separate agent identity (the AI process making the calls) is resolved
|
|
26
26
|
* non-interactively via env-configured machine credentials and is not
|
|
27
|
-
* handled here — see `ensureAgentIdentity
|
|
27
|
+
* handled here — see `ensureAgentIdentity`.
|
|
28
28
|
*/
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.ensureAuthenticated = void 0;
|
|
@@ -34,8 +34,8 @@ const cli_js_1 = require("./cli.js");
|
|
|
34
34
|
const auth_store_js_1 = require("./auth-store.js");
|
|
35
35
|
const auth_js_1 = require("./auth.js");
|
|
36
36
|
const ENABLED_VALUES = new Set(["1", "true", "yes", "on"]);
|
|
37
|
-
function
|
|
38
|
-
const v = process.env.
|
|
37
|
+
function isUserLoginEnabled() {
|
|
38
|
+
const v = process.env.ORY_USER_LOGIN?.toLowerCase();
|
|
39
39
|
return !!v && ENABLED_VALUES.has(v);
|
|
40
40
|
}
|
|
41
41
|
function clientId() {
|
|
@@ -63,17 +63,17 @@ function recordAuthSpan(client, decision) {
|
|
|
63
63
|
* to authenticate the human user. Always returns a decision; never throws.
|
|
64
64
|
*/
|
|
65
65
|
async function ensureUserAuthenticated(client, options) {
|
|
66
|
-
if (!
|
|
66
|
+
if (!isUserLoginEnabled()) {
|
|
67
67
|
const decision = {
|
|
68
68
|
proceed: true,
|
|
69
69
|
mode: "disabled",
|
|
70
|
-
reason: "
|
|
70
|
+
reason: "ORY_USER_LOGIN is not enabled",
|
|
71
71
|
};
|
|
72
72
|
recordAuthSpan(client, decision);
|
|
73
73
|
return decision;
|
|
74
74
|
}
|
|
75
75
|
try {
|
|
76
|
-
const decision = await
|
|
76
|
+
const decision = await runUserLogin(client, options);
|
|
77
77
|
attachUserPrincipal(client, decision);
|
|
78
78
|
recordAuthSpan(client, decision);
|
|
79
79
|
return decision;
|
|
@@ -123,7 +123,7 @@ function attachUserPrincipal(client, decision) {
|
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
async function
|
|
126
|
+
async function runUserLogin(client, options) {
|
|
127
127
|
const ttyCheck = options.isTtyAvailableFn ?? cli_js_1.isTtyAvailable;
|
|
128
128
|
const tty = ttyCheck();
|
|
129
129
|
let resolved = (0, config_js_1.resolveConfig)();
|
|
@@ -131,7 +131,7 @@ async function runGate(client, options) {
|
|
|
131
131
|
return {
|
|
132
132
|
proceed: true,
|
|
133
133
|
mode: "audit_only",
|
|
134
|
-
reason: "Configured for audit-only mode;
|
|
134
|
+
reason: "Configured for audit-only mode; user login is a no-op",
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
137
|
// 1. Project URL.
|
|
@@ -220,8 +220,8 @@ async function runGate(client, options) {
|
|
|
220
220
|
// `-t`, `docker exec` without `-it`, IDE-integrated terminals) can still
|
|
221
221
|
// complete sign-in by pasting the URL into any browser that can reach
|
|
222
222
|
// 127.0.0.1. Truly unattended runs (CI=true) are short-circuited by
|
|
223
|
-
// `pkceLogin` itself via `detectHeadless`, and operators can bypass
|
|
224
|
-
//
|
|
223
|
+
// `pkceLogin` itself via `detectHeadless`, and operators can bypass
|
|
224
|
+
// login entirely with `ORY_USER_SESSION_TOKEN` or `ORY_USER_LOGIN=0`.
|
|
225
225
|
// PKCE-flight lock so concurrent processes share a single browser flow.
|
|
226
226
|
const lock = (0, auth_store_js_1.tryAcquirePkceFlightLock)();
|
|
227
227
|
if (!lock) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ory/argus",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Ory Argus: the core API for building authentication, authorization, and audit into AI agent harness plugins, extensions, and custom integrations",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://ory.com",
|