@coffre/ui 0.7.0 → 0.8.1
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/dist/chunks/{audit-sentence-C1_gRxWW.js → audit-sentence-C_wMpAqr.js} +12 -4
- package/dist/chunks/audit-sentence-C_wMpAqr.js.map +1 -0
- package/dist/chunks/{principal-page-DDmmV1KQ.js → principal-page-Cv5PheS9.js} +2 -2
- package/dist/chunks/{principal-page-DDmmV1KQ.js.map → principal-page-Cv5PheS9.js.map} +1 -1
- package/dist/pages/audit.js +1 -1
- package/dist/pages/service-account.js +1 -1
- package/dist/pages/user.js +1 -1
- package/package.json +3 -3
- package/src/lib/audit-sentences.ts +12 -2
- package/src/parity.ts +1 -0
- package/dist/chunks/audit-sentence-C1_gRxWW.js.map +0 -1
|
@@ -132,7 +132,9 @@ var READ_VERBS = {
|
|
|
132
132
|
reveal: ["revealed", "reveal"],
|
|
133
133
|
run: ["ran", "run"],
|
|
134
134
|
compare: ["compared", "compare"],
|
|
135
|
-
copy: ["copied", "copy"]
|
|
135
|
+
copy: ["copied", "copy"],
|
|
136
|
+
use: ["used", "use"],
|
|
137
|
+
expose: ["was given", "be given"]
|
|
136
138
|
};
|
|
137
139
|
function readVerb({ entry }) {
|
|
138
140
|
return READ_VERBS[text(entry.metadata.purpose) ?? "reveal"] ?? READ_VERBS.reveal;
|
|
@@ -196,6 +198,11 @@ var TEMPLATES = {
|
|
|
196
198
|
what: secrets,
|
|
197
199
|
then: ({ entry, batch }) => batch.length > 1 || entry.version === null || entry.version === 1 ? [] : [`, now version ${entry.version}`]
|
|
198
200
|
},
|
|
201
|
+
"credential.use": {
|
|
202
|
+
did: ({ entry }) => entry.metadata.purpose === "expose" ? "was given the values of" : "used the credential",
|
|
203
|
+
tried: ({ entry }) => entry.metadata.purpose === "expose" ? "be given the values of" : "use the credential",
|
|
204
|
+
what: ({ entry }) => [text(entry.metadata.credential) ?? "", ...text(entry.metadata.host) === null ? [] : [` on ${text(entry.metadata.host)}`]]
|
|
205
|
+
},
|
|
199
206
|
"secret.restore": {
|
|
200
207
|
did: "restored",
|
|
201
208
|
tried: "restore",
|
|
@@ -441,8 +448,8 @@ var TEMPLATES = {
|
|
|
441
448
|
what: () => []
|
|
442
449
|
},
|
|
443
450
|
"token.create": {
|
|
444
|
-
did: ({ entry }) => personal(entry) ? "made a personal token" : "issued a bearer token to",
|
|
445
|
-
tried: ({ entry }) => personal(entry) ? "make a personal token" : "issue a bearer token to",
|
|
451
|
+
did: ({ entry }) => entry.metadata.kind === "handle" ? "made a handle" : personal(entry) ? "made a personal token" : "issued a bearer token to",
|
|
452
|
+
tried: ({ entry }) => entry.metadata.kind === "handle" ? "make a handle" : personal(entry) ? "make a personal token" : "issue a bearer token to",
|
|
446
453
|
what: ({ entry }) => personal(entry) ? labelled(entry) : subject(entry),
|
|
447
454
|
then: ({ entry }) => reaching(entry)
|
|
448
455
|
},
|
|
@@ -619,6 +626,7 @@ var TAMPERING = {
|
|
|
619
626
|
var REASONS = {
|
|
620
627
|
no_grant: "no grant",
|
|
621
628
|
bulk_limit: "bulk limit",
|
|
629
|
+
stand_ins: "people get stand-ins",
|
|
622
630
|
expired: "grant expired",
|
|
623
631
|
removed: "removed from coffre",
|
|
624
632
|
not_a_member: "not a member",
|
|
@@ -845,4 +853,4 @@ function memberName(member) {
|
|
|
845
853
|
//#endregion
|
|
846
854
|
export { lines as a, who as c, describe as i, memberName as n, perSecret as o, decidedBy as r, runLabel as s, Sentence as t };
|
|
847
855
|
|
|
848
|
-
//# sourceMappingURL=audit-sentence-
|
|
856
|
+
//# sourceMappingURL=audit-sentence-C_wMpAqr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-sentence-C_wMpAqr.js","names":[],"sources":["../../src/lib/audit-sentences.ts","../../src/components/audit-sentence.tsx"],"sourcesContent":["/**\n * The audit log in sentences: who did what, to what. One entry is one\n * human action, named for it (`secret.read`, `access.grant`, …); a batch of\n * them, one reveal of twelve secrets, shares an operation and reads as one\n * line, \"ran market/prod: 12 secrets\".\n *\n * A sentence is parts rather than a string, so the page can make the people\n * and places in it links. `plain` flattens it, for tests and titles.\n */\nimport { shownMember, type AuditEntryView } from '@coffre/client';\nimport { INSTANCE_ROLES, isInstanceRole, isScope, scopeInWords, type Scope } from '@coffre/core/access';\n\n/** What a sentence is made from: an entry of the log, as `GET /api/audit` gives it. */\nexport type AuditEntry = Pick<\n AuditEntryView,\n | 'seq'\n | 'author'\n | 'actorType'\n | 'actorId'\n | 'action'\n | 'decision'\n | 'reason'\n | 'detail'\n | 'subject'\n | 'project'\n | 'environment'\n | 'key'\n | 'version'\n | 'secrets'\n | 'operationId'\n | 'metadata'\n>;\n\n/**\n * Text, a place (`market`, `market/prod`, `market/prod/KEY`), or a member,\n * as the log stores it (`user:…`, `token:…`): `shownMember` says it as people\n * read it, `service:…`, where it is shown.\n */\nexport type Part = string | { place: string } | { member: string };\n\nexport type Sentence = { parts: Part[]; refused: boolean };\n\n/** What one template needs: the line's leading entry, its batch, and how it was decided. */\ntype Facts = {\n entry: AuditEntry;\n /** Every entry of the batch, the lead included, a read of several once per secret (`perSecret`). */\n batch: AuditEntry[];\n /** Secrets the batch was about. */\n count: number;\n refused: boolean;\n};\n\ntype Template = {\n /** What they did: \"revealed\". */\n did: string | ((facts: Facts) => string);\n /** What they tried, after \"tried to\": \"reveal\". */\n tried: string | ((facts: Facts) => string);\n /** To what: \"market/prod/API_KEY\". */\n what: (facts: Facts) => Part[];\n /** Said only of what happened: \", now version 5\". */\n then?: (facts: Facts) => Part[];\n};\n\n// --- the pieces of a sentence ---------------------------------------------------\n\nconst text = (value: unknown): string | null => (typeof value === 'string' && value !== '' ? value : null);\nconst number = (value: unknown): number | null => (typeof value === 'number' ? value : null);\n\n/** The entry's place, as deep as it goes. */\nfunction place({ project, environment, key }: AuditEntry): Part[] {\n const path = [project, environment, key].filter((part): part is string => part !== null);\n return path.length === 0 ? ['coffre'] : [{ place: path.join('/') }];\n}\n\nfunction environmentOf({ project, environment }: AuditEntry): Part[] {\n return place({ project, environment, key: null } as AuditEntry);\n}\n\n/** The member an entry is about: its subject, or the principal a token entry names. */\nfunction subject(entry: AuditEntry): Part[] {\n if (entry.subject !== null) return [{ member: entry.subject }];\n const id = text(entry.metadata.principalId);\n if (id === null) return ['someone'];\n return [{ member: `${entry.metadata.principalType === 'service' ? 'token' : 'user'}:${id}` }];\n}\n\n/** Whether a token entry is about a personal token, which acts as its person, rather than a service account's. */\nfunction personal(entry: AuditEntry): boolean {\n return entry.metadata.kind === 'personal';\n}\n\n/** A personal token's label, as it was made: ` \"cursor-agent\"`. */\nfunction labelled(entry: AuditEntry): Part[] {\n const label = text(entry.metadata.label);\n return label === null ? [] : [` “${label}”`];\n}\n\n/** Why the vault made someone an Owner itself, said after it. */\nfunction owned(entry: AuditEntry): Part[] {\n return entry.metadata.reason === 'owners' ? [': the deployment names them one'] : [];\n}\n\n/** An MCP client, by the name it connected under. */\nfunction app(entry: AuditEntry): Part[] {\n return [text(entry.metadata.clientName) ?? 'an app'];\n}\n\n/** A tool's call: its name, and what it named. */\nfunction tool(entry: AuditEntry): Part[] {\n const names = Array.isArray(entry.metadata.names) ? entry.metadata.names.filter((name): name is string => typeof name === 'string') : [];\n return [text(entry.metadata.tool) ?? 'a tool', ...(names.length === 0 ? [] : [` on ${names.join(', ')}`])];\n}\n\n/** The client a request came through, said after what it did: \"via Claude\". */\nfunction via(entry: AuditEntry): Part[] {\n const client = (entry.metadata.via as { clientName?: unknown } | undefined)?.clientName;\n return typeof client === 'string' ? [` via ${client}`] : [];\n}\n\n/** Why coffre itself ended a connection, said after it. */\nconst DISCONNECTED: Record<string, string> = {\n code_reused: ': its sign-in code was used twice',\n refresh_reused: ': a refresh token it had replaced was used again',\n revocation_endpoint: ', at its own request',\n superseded: ': a connection with more scopes replaced it',\n};\n\nfunction plural(count: number, one: string, many = `${one}s`): string {\n return `${count} ${count === 1 ? one : many}`;\n}\n\n/** A batch reads as its environment and a count; one entry as its secret. */\n/**\n * The secrets a read or write was about. A read through a reference is a\n * read of its source, \"market/prod/DATABASE_URL through\n * billing/prod/DATABASE_URL\"; a run that read some that way is a run of\n * the environment that holds them. A value a fork inherits is its parent's,\n * read in the fork: \"market/prod/STRIPE_KEY in market/prod-eu\".\n */\nfunction secrets(facts: Facts): Part[] {\n const through = (entry: AuditEntry) => text((entry.metadata.via as { path?: unknown } | undefined)?.path);\n // The fork a value was inherited in, by path: in its parent's project, which holds the reference a read went through.\n const forkOf = (entry: AuditEntry) => {\n const slug = text((entry.metadata.through as { slug?: unknown } | undefined)?.slug);\n const project = through(entry)?.split('/')[0] ?? entry.project;\n return slug === null || project === null ? null : `${project}/${slug}`;\n };\n if (facts.batch.length === 1) {\n const [held, fork] = [through(facts.entry), forkOf(facts.entry)];\n return [...place(facts.entry), ...(held === null ? [] : [' through ', { place: held }]), ...(fork === null ? [] : [' in ', { place: fork }])];\n }\n const fork = facts.batch.map(forkOf).find((path) => path !== null);\n const own = facts.batch.find((entry) => through(entry) === null && forkOf(entry) === null);\n const held = facts.batch.map(through).filter((path): path is string => path !== null);\n const inherited = facts.batch.filter((entry) => forkOf(entry) !== null).length;\n const where = fork !== undefined && fork !== null\n ? [{ place: fork }]\n : own !== undefined ? environmentOf(own) : [{ place: held[0]!.split('/').slice(0, 2).join('/') }];\n return [\n ...where,\n facts.refused ? ', ' : ': ',\n plural(facts.count, 'secret'),\n ...(held.length === 0 ? [] : [`, ${held.length} through ${held.length === 1 ? 'a reference' : 'references'}`]),\n ...(inherited === 0 ? [] : [`, ${inherited} inherited`]),\n ];\n}\n\n/** \"market/prod/OLD\", or \"OLD and STALE in market/prod\" for an archive of several keys refused. */\nfunction archivedKeys(entry: AuditEntry): Part[] {\n const keys = Array.isArray(entry.metadata.keys) ? entry.metadata.keys.filter((key): key is string => text(key) !== null) : [];\n if (entry.key !== null || keys.length === 0) return place(entry);\n return [keys.length === 1 ? keys[0]! : `${keys.slice(0, -1).join(', ')} and ${keys.at(-1)!}`, ' in ', ...environmentOf(entry)];\n}\n\n/** \"SENTRY_DSN in market/dev\", or \"3 keys in market/dev\" for a Dismiss all. */\nfunction missingKeys(facts: Facts): Part[] {\n const key = text(facts.entry.metadata.key);\n return [facts.batch.length === 1 && key !== null ? key : plural(facts.count, 'key'), ' in ', ...environmentOf(facts.entry)];\n}\n\n/** \"billing/prod/DATABASE_URL a reference to market/prod/DATABASE_URL\", from either author's entry. */\nfunction referenceTo(entry: AuditEntry): Part[] {\n const holder = text(entry.metadata.subject);\n const key = text(entry.metadata.key);\n const source = text(entry.metadata.source) ?? text((entry.metadata.source as { path?: unknown } | undefined)?.path);\n return [\n ...(holder !== null ? [{ place: holder }] : key !== null ? place(entry) : environmentOf(entry)),\n ...(source === null ? [] : [' a reference to ', { place: source }]),\n ];\n}\n\nconst READ_VERBS: Record<string, [did: string, tried: string]> = {\n reveal: ['revealed', 'reveal'],\n run: ['ran', 'run'],\n compare: ['compared', 'compare'],\n copy: ['copied', 'copy'],\n // The credential proxy's: a value injected into a request for its person, or one handed to their app.\n use: ['used', 'use'],\n expose: ['was given', 'be given'],\n};\n\nfunction readVerb({ entry }: Facts): [string, string] {\n return READ_VERBS[text(entry.metadata.purpose) ?? 'reveal'] ?? READ_VERBS.reveal!;\n}\n\nconst placeTemplates = (kind: 'project' | 'environment'): Record<string, Template> => {\n // A personal config by what it is a config of, `market/dev`: its own slug is generated, and shown nowhere else.\n const of = (entry: AuditEntry): string | null => {\n const parent = text(entry.metadata.personal) ?? text(entry.metadata.with);\n return parent === null || entry.project === null ? null : `${entry.project}/${parent}`;\n };\n const what = (facts: Facts): Part[] => {\n const personal = kind === 'environment' ? of(facts.entry) : null;\n if (personal !== null) return ['a personal config of ', { place: personal }];\n if (kind === 'environment' && facts.entry.metadata.personal === true) return [`a personal config, ${text(facts.entry.metadata.path) ?? ''}`];\n return [`${kind} `, ...(kind === 'project' ? place({ ...facts.entry, environment: null, key: null }) : environmentOf(facts.entry))];\n };\n return {\n [`${kind}.create`]: {\n did: 'created',\n tried: 'create',\n what,\n // A fork names the environment it copied.\n then: ({ entry }) =>\n text(entry.metadata.inherits) !== null\n ? [`, inheriting from ${text(entry.metadata.inherits)}`]\n : text(entry.metadata.from) === null\n ? []\n : [`, a fork of ${text(entry.metadata.from)}`],\n },\n [`${kind}.update`]: { did: 'changed', tried: 'change', what },\n [`${kind}.archive`]: { did: 'archived', tried: 'archive', what },\n [`${kind}.restore`]: { did: 'restored', tried: 'restore', what },\n // Named by its tombstone from then on, `market~deleted-2026-10-05`, as every entry about it is.\n [`${kind}.delete`]: { did: 'deleted', tried: 'delete', what },\n };\n};\n\n// --- one template per action ----------------------------------------------------\n\nconst TEMPLATES: Record<string, Template> = {\n 'secret.read': {\n did: (facts) => readVerb(facts)[0],\n tried: (facts) => readVerb(facts)[1],\n what: secrets,\n },\n 'secret.write': {\n // New secrets are added, others changed; a batch of both is written.\n did: ({ batch }) => {\n const firsts = batch.filter((entry) => entry.version === 1).length;\n return firsts === batch.length ? 'added' : firsts === 0 ? 'changed' : 'wrote';\n },\n tried: 'change',\n what: secrets,\n then: ({ entry, batch }) =>\n batch.length > 1 || entry.version === null || entry.version === 1 ? [] : [`, now version ${entry.version}`],\n },\n // The credential proxy's own entry beside the vault's read: which credential the keys went into, and where.\n 'credential.use': {\n did: ({ entry }) => (entry.metadata.purpose === 'expose' ? 'was given the values of' : 'used the credential'),\n tried: ({ entry }) => (entry.metadata.purpose === 'expose' ? 'be given the values of' : 'use the credential'),\n what: ({ entry }) => [text(entry.metadata.credential) ?? '', ...(text(entry.metadata.host) === null ? [] : [` on ${text(entry.metadata.host)}`])],\n },\n 'secret.restore': {\n did: 'restored',\n tried: 'restore',\n what: ({ entry }) => [...place(entry), ...(number(entry.metadata.from) === null ? [] : [` to version ${number(entry.metadata.from)}`])],\n then: ({ entry }) => (entry.version === null ? [] : [`, now ${entry.version}`]),\n },\n 'secret.rename': {\n did: 'renamed',\n tried: 'rename',\n what: ({ entry }) => [...place(entry), ...(text(entry.metadata.nextKey) === null ? [] : [` to ${text(entry.metadata.nextKey)}`])],\n // In a fork, carried down from a rename in its parent.\n then: ({ entry }) => (text(entry.metadata.parent) === null ? [] : [`, as ${text(entry.metadata.parent)} did`]),\n },\n 'secret.archive': { did: 'archived', tried: 'archive', what: ({ entry }) => archivedKeys(entry) },\n // In a fork: its own value set aside, kept, for its parent's.\n 'secret.reset': {\n did: 'reset',\n tried: 'reset',\n what: ({ entry }) => place(entry),\n then: ({ entry }) => (text(entry.metadata.from) === null ? [] : [` to ${text(entry.metadata.from)}'s value`]),\n },\n 'missing.dismiss': {\n did: 'dismissed',\n tried: 'dismiss',\n what: (facts) => missingKeys(facts),\n then: () => [' as not needed'],\n },\n 'missing.restore': { did: 'restored', tried: 'restore', what: (facts) => missingKeys(facts), then: () => [' to the missing keys'] },\n 'secret.reference': { did: 'made', tried: 'make', what: ({ entry }) => referenceTo(entry) },\n 'reference.create': { did: 'made', tried: 'make', what: ({ entry }) => referenceTo(entry) },\n 'reference.end': {\n did: ({ entry }) => (entry.metadata.reason === 'replaced' ? 'gave a value of its own to' : entry.metadata.reason === 'abandoned' ? 'abandoned' : 'broke'),\n tried: ({ entry }) => (entry.metadata.reason === 'replaced' ? 'replace' : entry.metadata.reason === 'abandoned' ? 'abandon' : 'break'),\n what: ({ entry }) => {\n const source = text((entry.metadata.source as { path?: unknown } | undefined)?.path);\n const holder = text(entry.metadata.subject);\n if (entry.metadata.reason === 'replaced') return [...(holder === null ? ['a reference'] : [{ place: holder }]), ...(source === null ? [] : [', no longer a reference to ', { place: source }])];\n return ['the reference ', ...(holder === null ? [] : [{ place: holder }]), ...(source === null ? [] : [' to ', { place: source }])];\n },\n then: ({ entry }) => (entry.metadata.reason === 'abandoned' ? [', which its write never stored'] : []),\n },\n 'secret.unarchive': { did: 'brought back', tried: 'bring back', what: (facts) => place(facts.entry) },\n 'secret.move': { did: 'moved', tried: 'move', what: (facts) => place(facts.entry), then: ({ entry }) => intoFolder(entry) },\n ...placeTemplates('project'),\n 'project.move': {\n did: 'moved',\n tried: 'move',\n what: ({ entry }) => ['project ', ...place({ ...entry, environment: null, key: null })],\n then: ({ entry }) => intoFolder(entry),\n },\n ...placeTemplates('environment'),\n 'environment.fork': {\n did: 'forked',\n tried: 'fork',\n what: ({ entry }) => [...environmentOf(entry), ...(text(entry.metadata.slug) === null ? [] : [` into ${text(entry.metadata.slug)}`])],\n },\n 'access.grant': {\n did: 'gave',\n tried: 'give',\n what: ({ entry }) => [...subject(entry), ` ${text(entry.metadata.role) ?? 'a role'} on `, ...placeOnly(entry)],\n then: ({ entry }) => [\n ...(text(entry.metadata.previousRole) === null ? [] : [`, was ${text(entry.metadata.previousRole)}`]),\n ...(text(entry.metadata.expiresAt) === null ? [] : [`, until ${text(entry.metadata.expiresAt)!.slice(0, 10)}`]),\n ...(entry.metadata.reason === 'every-project' ? [', for a grant on every project'] : []),\n ],\n },\n 'access.revoke': {\n did: 'took',\n tried: 'take',\n what: ({ entry }) => [\n ...(text(entry.metadata.previousRole ?? entry.metadata.role) === null ? ['access to '] : [`${text(entry.metadata.previousRole ?? entry.metadata.role)} on `]),\n ...placeOnly(entry),\n ' from ',\n ...subject(entry),\n ],\n // The vault replacing a grant on every project of 0.4: by what, an instance role or project grants.\n then: ({ entry }) => {\n const by = entry.metadata.replacedBy as { role?: unknown } | undefined;\n if (by === undefined) return [];\n const role = typeof by.role === 'string' ? roleName(by.role) : null;\n return [role === null || role === 'Member' ? ', replaced by project grants' : `, replaced by the instance role ${role}`];\n },\n },\n 'member.add': {\n did: 'added',\n tried: 'add',\n what: ({ entry }) => [\n ...subject(entry),\n ...(entry.metadata.rootAdmin === true ? [' as a root admin'] : entry.metadata.owner === true ? [' as an owner'] : asRole(entry)),\n ],\n then: ({ entry }) => owned(entry),\n },\n 'member.remove': {\n did: 'removed',\n tried: 'remove',\n what: (facts) => subject(facts.entry),\n then: ({ entry }) => (number(entry.metadata.revoked) === null ? [] : [`, who held ${plural(number(entry.metadata.revoked)!, 'grant')}`]),\n },\n 'member.restore': {\n did: 'brought back',\n tried: 'bring back',\n what: ({ entry }) => [...subject(entry), ...asRole(entry)],\n then: ({ entry }) => owned(entry),\n },\n 'member.role': {\n did: 'made',\n tried: 'make',\n what: ({ entry }) => [...subject(entry), ` ${article(roleName(text(entry.metadata.role) ?? 'member') ?? 'Member')}`, ...scoped(entry)],\n then: ({ entry }) => {\n const before = roleName(text(entry.metadata.previousRole) ?? '');\n return [\n ...(before === null ? [] : [`, was ${before}`]),\n ...(entry.metadata.reason === 'every-project' ? [', for their grants on every project'] : []),\n ...owned(entry),\n ];\n },\n },\n 'member.owner': {\n did: ({ entry }) => (entry.metadata.owner === false ? 'took owner from' : 'made'),\n tried: ({ entry }) => (entry.metadata.owner === false ? 'take owner from' : 'make'),\n what: ({ entry }) => [...subject(entry), ...(entry.metadata.owner === false ? [] : [' an owner'])],\n },\n // Where people set up service accounts themselves, which those who run the instance set.\n 'settings.change': {\n did: 'set',\n tried: 'set',\n what: ({ entry }) => ['where people set up service accounts', ...setting(entry.metadata.serviceAccounts).map((words) => `: ${words}`)],\n then: ({ entry }) => {\n const previous = (entry.metadata.previous as { serviceAccounts?: unknown } | undefined)?.serviceAccounts;\n return setting(previous).map((words) => `, was ${words}`);\n },\n },\n // A binding trusts CI runs to sign in as a service; removing one is its tombstone.\n 'token.bind': {\n did: 'trusted CI runs to sign in as',\n tried: 'trust CI runs to sign in as',\n what: (facts) => subject(facts.entry),\n then: ({ entry }) => [...inGitHubEnvironment(entry), ...reaching(entry)],\n },\n // The tokens and bindings 0.4 made, given their own scope when 0.5 first checked a credential: what their account held then.\n 'token.seal': {\n did: 'sealed',\n tried: 'seal',\n what: ({ entry }) => [`${sealedOf(entry)} of `, ...subject(entry)],\n then: ({ entry }) => reaching(entry, ', reaching nothing'),\n },\n 'token.unbind': {\n did: 'stopped trusting CI runs to sign in as',\n tried: 'stop trusting CI runs to sign in as',\n what: (facts) => subject(facts.entry),\n },\n 'vault.tampered': {\n did: 'found',\n tried: 'check',\n what: ({ entry }) => [\n ...(entry.subject === null ? ['an entry'] : [...subject(entry), \"'s record\"]),\n ` tampered with: ${TAMPERING[entry.reason ?? ''] ?? 'it fails its seal'}`,\n ],\n },\n 'key.rotate': { did: 'rotated its key', tried: 'rotate its key', what: () => [] },\n // An MCP client a person connected, such as Claude: named as the consent page showed it.\n 'mcp.connect': { did: 'connected', tried: 'connect', what: ({ entry }) => app(entry) },\n // A tool an MCP client called, by its name, and the places it named.\n 'mcp.call': { did: 'used', tried: 'use', what: ({ entry }) => tool(entry), then: ({ entry }) => via(entry) },\n // A person's decision, on coffre's page, on a change an MCP client asked for; the change's own entries follow, via the client.\n 'mcp.approve': { did: 'approved', tried: 'approve', what: ({ entry }) => tool(entry), then: ({ entry }) => [` for ${text(entry.metadata.clientName) ?? 'an app'}`] },\n 'mcp.deny': { did: 'turned down', tried: 'turn down', what: ({ entry }) => tool(entry), then: ({ entry }) => [` for ${text(entry.metadata.clientName) ?? 'an app'}`] },\n 'mcp.view': { did: 'opened an approval', tried: 'open an approval', what: () => [] },\n // The app's prompt declined, which cancels the approval it would have opened.\n 'mcp.cancel': { did: 'cancelled', tried: 'cancel', what: ({ entry }) => tool(entry), then: ({ entry }) => via(entry) },\n 'mcp.disconnect': {\n did: 'disconnected',\n tried: 'disconnect',\n what: ({ entry }) => [...app(entry), ...(entry.metadata.principalId === undefined ? [] : [' of ', ...subject(entry)])],\n then: ({ entry }) => [DISCONNECTED[text(entry.metadata.reason) ?? ''] ?? ''],\n },\n\n // Detail, hidden unless asked for.\n sign_in: {\n did: ({ entry }) => (entry.metadata.kind === 'cli' ? 'signed in to the CLI' : 'signed in'),\n tried: 'sign in',\n what: ({ entry }) => (text(entry.metadata.provider) === null ? [] : [`with ${text(entry.metadata.provider)}`]),\n },\n sign_out: { did: 'signed out', tried: 'sign out', what: () => [] },\n // A personal token is its person's own, and named by its label; a bearer token is a service account's.\n 'token.create': {\n did: ({ entry }) => (entry.metadata.kind === 'handle' ? 'made a handle' : personal(entry) ? 'made a personal token' : 'issued a bearer token to'),\n tried: ({ entry }) => (entry.metadata.kind === 'handle' ? 'make a handle' : personal(entry) ? 'make a personal token' : 'issue a bearer token to'),\n what: ({ entry }) => (personal(entry) ? labelled(entry) : subject(entry)),\n then: ({ entry }) => reaching(entry),\n },\n 'token.revoke': {\n did: ({ entry }) => (personal(entry) ? 'revoked a personal token of' : 'revoked a bearer token of'),\n tried: ({ entry }) => (personal(entry) ? 'revoke a personal token of' : 'revoke a bearer token of'),\n what: (facts) => subject(facts.entry),\n },\n // A personal token refused a route only its person reaches: the route, as the API names it.\n 'token.use': {\n did: 'used a personal token for',\n tried: 'use a personal token for',\n what: ({ entry }) => [text(entry.metadata.route) ?? 'something'],\n },\n 'device.approve': { did: 'approved a CLI sign-in', tried: 'approve a CLI sign-in', what: () => [] },\n 'device.deny': { did: 'turned down a CLI sign-in', tried: 'turn down a CLI sign-in', what: () => [] },\n 'mcp.read': { did: 'used', tried: 'use', what: ({ entry }) => tool(entry), then: ({ entry }) => via(entry) },\n 'mcp.token': {\n did: ({ entry }) => (entry.metadata.grant === 'refresh_token' ? 'refreshed the tokens of' : 'gave its first tokens to'),\n tried: 'give tokens to',\n what: ({ entry }) => app(entry),\n },\n 'account.link': {\n did: 'linked',\n tried: 'link',\n what: ({ entry }) => [`a ${text(entry.metadata.provider) ?? 'sign-in'} account`],\n },\n 'account.unlink': {\n did: 'unlinked',\n tried: 'unlink',\n what: ({ entry }) => [`a ${text(entry.metadata.provider) ?? 'sign-in'} account`],\n },\n 'key.wrap': { did: 'sealed the key of', tried: 'seal the key of', what: (facts) => versioned(facts.entry) },\n 'key.rewrap': { did: 'resealed the key of', tried: 'reseal the key of', what: (facts) => versioned(facts.entry) },\n 'key.intent': { did: 'asked KMS about', tried: 'ask KMS about', what: (facts) => secrets(facts) },\n 'key.check': {\n did: 'recorded the check value of',\n tried: 'check',\n what: ({ entry }) => [['the', text(entry.metadata.kekProvider) === 'local' ? null : text(entry.metadata.kekProvider), 'vault key', text(entry.metadata.kekId)].filter((word) => word !== null).join(' ')],\n },\n 'audit.heartbeat': { did: 'checked in', tried: 'check in', what: () => [] },\n 'audit.checkpoint': {\n did: 'signed the log',\n tried: 'sign the log',\n what: ({ entry }) => (number(entry.metadata.seq) === null ? [] : [`through entry ${number(entry.metadata.seq)}`]),\n },\n\n // Only ever refused: a read of a list, which is not logged when allowed.\n 'secret.list': { did: 'listed', tried: 'list', what: ({ entry }) => environmentOf(entry) },\n 'secret.history': { did: 'read the history of', tried: 'read the history of', what: (facts) => place(facts.entry) },\n 'secret.update': { did: 'changed', tried: 'change', what: (facts) => place(facts.entry) },\n};\n\n/** \" to the folder stripe\", or \" out of its folder\". */\nfunction intoFolder(entry: AuditEntry): Part[] {\n const folder = text(entry.metadata.to);\n return [folder === null ? ' out of its folder' : ` to the folder ${folder}`];\n}\n\n/** An instance role's name, from its slug; null for none it knows. */\nfunction roleName(role: string): string | null {\n return isInstanceRole(role) ? INSTANCE_ROLES[role].name : null;\n}\n\nfunction article(name: string): string {\n return `${/^[AEIOU]/.test(name) ? 'an' : 'a'} ${name}`;\n}\n\n/** Whether an entry's scope narrows the role; its projects are ids, which a sentence cannot name. */\nfunction scoped(entry: AuditEntry): Part[] {\n const scope = entry.metadata.scope as { projects?: unknown; environments?: unknown } | undefined;\n return scope === undefined || (scope.projects === 'all' && scope.environments === 'all') ? [] : [', with a scope'];\n}\n\n/**\n * What a token or binding reaches, its scope, each role with the places it\n * holds, counted, as the log names them by id: `, reaching developer on 2 places`.\n */\nfunction reaching(entry: AuditEntry, none = ''): Part[] {\n const scope = entry.metadata.scope;\n if (!Array.isArray(scope)) return [];\n if (scope.length === 0) return none === '' ? [] : [none];\n const byRole = new Map<string, number>();\n for (const grant of scope as { role?: unknown }[]) {\n const role = text(grant.role);\n if (role !== null) byRole.set(role, (byRole.get(role) ?? 0) + 1);\n }\n return [`, reaching ${[...byRole].map(([role, count]) => `${role} on ${plural(count, 'place')}`).join(', ')}`];\n}\n\n/** The GitHub environment a binding takes its runs from, when it names one. */\nfunction inGitHubEnvironment(entry: AuditEntry): Part[] {\n const environment = text((entry.metadata.claims as Record<string, unknown> | undefined)?.environment);\n return environment === null || !String(entry.metadata.profile).startsWith('github') ? [] : [`, in GitHub environment ${environment}`];\n}\n\n/** The tokens and trust bindings a `token.seal` names, counted: `2 tokens and a trust binding`. */\nfunction sealedOf(entry: AuditEntry): string {\n const count = (key: string) => (Array.isArray(entry.metadata[key]) ? (entry.metadata[key] as unknown[]).length : 0);\n const parts = [[count('tokens'), 'token'], [count('bindings'), 'trust binding']] as const;\n return parts.filter(([n]) => n > 0).map(([n, one]) => plural(n, one)).join(' and ') || 'nothing';\n}\n\n/**\n * The setting of where people set up service accounts, in words: its\n * projects counted, as the log names them by id, its environments by name.\n *\n * All projects · all but prod 2 projects · dev only\n */\nfunction setting(scope: unknown): string[] {\n if (!isScope(scope)) return [];\n const { projects } = scope;\n const counted: Scope = projects === 'all'\n ? scope\n : { ...scope, projects: 'only' in projects ? { only: [plural(projects.only.length, 'project')] } : { except: [plural(projects.except.length, 'project')] } };\n return [scopeInWords(counted)];\n}\n\n/** The role a member is added or brought back with, said when it is more than Member. */\nfunction asRole(entry: AuditEntry): Part[] {\n const role = roleName(text(entry.metadata.role) ?? '');\n return role === null || role === 'Member' ? [] : [` as ${article(role)}`, ...scoped(entry)];\n}\n\nfunction placeOnly(entry: AuditEntry): Part[] {\n // A grant on every project names no project: its place is a path in its payload, `*` or `*/dev`.\n const everywhere = entry.project === null ? text(entry.metadata.place) : null;\n if (everywhere !== null) return [everywhere === '*' ? 'every project' : `${everywhere.slice('*/'.length)} in every project`];\n return place({ ...entry, key: null });\n}\n\nfunction versioned(entry: AuditEntry): Part[] {\n return [...place(entry), ...(entry.version === null ? [] : [`, version ${entry.version}`])];\n}\n\nconst TAMPERING: Record<string, string> = {\n mac: \"it does not carry the vault's seal\",\n stale: 'an older copy was put back',\n forged_entry: 'the vault did not write it',\n};\n\n/** Why something was refused, in words. Codes from the vault and the app. */\nconst REASONS: Record<string, string> = {\n no_grant: 'no grant',\n bulk_limit: 'bulk limit',\n stand_ins: 'people get stand-ins',\n expired: 'grant expired',\n removed: 'removed from coffre',\n not_a_member: 'not a member',\n not_registered: 'not invited',\n tampered: 'their record was tampered with',\n bad_claim: 'the key did not match the secret',\n deleted: 'the place was deleted',\n not_allowed: 'not allowed',\n root_admin: 'root admins are set by the deployment',\n last_owner: 'they are the last Owner of the whole instance',\n requires_instance_admin: 'requires an admin or owner of the whole instance',\n requires_instance_owner: 'requires an instance owner',\n own_role: 'nobody changes their own role',\n own_grant: 'nobody grants themselves a role',\n service_cannot_hold_role: 'service accounts hold project grants only',\n not_service_manager: 'they hold less than the service account, or than they gave it',\n unknown_environment: 'no such environment',\n unknown_secret: 'no such secret',\n no_value: 'it holds no value',\n unknown_project: 'no such project',\n not_archived: 'it was not archived',\n referenced: 'references read it',\n kms_unavailable: 'KMS did not answer',\n wrong_kek: \"the vault's key is not the one that wrapped the data\",\n person_denied: 'they said no',\n too_many_connections: 'too many connected apps',\n unknown_connection: 'no such connected app',\n not_yours: \"it was someone else's\",\n too_many_approvals: 'too many changes waiting for approval',\n request_state: 'its retry did not match its call',\n changed: 'the change was not the one shown',\n replaced: 'what it replaces changed since it was shown',\n unconfirmed: 'what it replaces could not be read',\n disconnected: 'the app was disconnected',\n personal_token: 'only its person can, signed in as themselves',\n beyond_holder: 'more than they hold',\n};\n\n/** What a missing permission meant, from the app's `missing_<permission>`. */\nconst MISSING: Record<string, string> = {\n secret_read: 'no grant to read it',\n secret_write: 'no grant to write',\n secret_archive: 'no grant to archive',\n audit_read: 'no grant to read the audit log',\n environment_manage: 'no grant to manage environments',\n grant_manage: 'no grant to manage access',\n project_manage: 'no grant to manage the project',\n};\n\nexport function reasonInWords(reason: string | null): string {\n if (reason === null) return 'refused';\n if (reason.startsWith('missing_')) return MISSING[reason.slice('missing_'.length)] ?? 'no grant';\n return REASONS[reason] ?? reason.replace(/_/g, ' ');\n}\n\n// --- lines ----------------------------------------------------------------------\n\n/** In a batch of mixed actions, the one the line is named for: a write, not its reads. */\nconst LEAD = ['secret.write', 'secret.read'];\n\nexport function leadOf(batch: AuditEntry[]): AuditEntry {\n for (const action of LEAD) {\n const found = batch.find((entry) => entry.action === action);\n if (found !== undefined) return found;\n }\n return batch[0]!;\n}\n\n/**\n * A read of several secrets, logged once for its place, as the entries it\n * would be about one secret each: its key and version, and what its own\n * part of the metadata says, such as the reference it went through. Any\n * other entry as it is.\n */\nexport function perSecret<T extends AuditEntry>(entry: T): T[] {\n const listed = entry.metadata.secrets;\n // One whose list was emptied or mangled, which verification would flag, still reads as itself.\n if (entry.secrets === null || entry.secrets.length === 0 || !Array.isArray(listed)) return [entry];\n return entry.secrets.map(({ key, version }, i) => {\n const own = listed[i];\n return {\n ...entry,\n key,\n version,\n secrets: null,\n metadata: { ...entry.metadata, secrets: undefined, ...(typeof own === 'object' && own !== null && !Array.isArray(own) ? own : {}) },\n };\n });\n}\n\n/** What a line says: one entry, or a batch that shares an operation. */\nexport function describe(batch: AuditEntry[]): Sentence {\n const entry = perSecret(leadOf(batch))[0]!;\n const same = batch.filter((other) => other.action === entry.action).flatMap(perSecret);\n const denied = same.filter((other) => other.decision === 'deny');\n const refused = denied.length === same.length;\n const facts: Facts = {\n entry,\n batch: same,\n count: new Set(same.map((other) => `${other.project}/${other.environment}/${other.key}`)).size,\n refused,\n };\n const template = TEMPLATES[entry.action];\n if (template === undefined) return { parts: [entry.action, ' ', ...place(entry)], refused };\n const say = (verb: Template['did']) => (typeof verb === 'string' ? verb : verb(facts));\n const what = template.what(facts);\n const gap = what.length === 0 ? [] : [' '];\n if (refused) {\n const reason = reasonInWords((denied[0] ?? entry).reason);\n return { parts: ['tried to ', say(template.tried), ...gap, ...what, `: ${reason}`], refused };\n }\n const partly = denied.length === 0 ? [] : [`, ${denied.length} refused: ${reasonInWords(denied[0]!.reason)}`];\n return { parts: [say(template.did), ...gap, ...what, ...(template.then?.(facts) ?? []), ...partly], refused };\n}\n\n/** Who acted, as a part: a member links to their page; coffre itself is text. */\nexport function who(entry: Pick<AuditEntry, 'actorType' | 'actorId'>): string | { member: string } {\n if (entry.actorType === 'user') return { member: `user:${entry.actorId}` };\n if (entry.actorType === 'service') return { member: `token:${entry.actorId}` };\n return SYSTEM[entry.actorId] ?? entry.actorId;\n}\n\nconst SYSTEM: Record<string, string> = {\n scheduler: 'the scheduler',\n cron: 'the scheduler',\n vault: 'the vault',\n app: 'coffre',\n};\n\n/** Which components wrote the line, the vault first: \"vault\", \"app\", \"vault, app\". */\nexport function decidedBy(batch: Pick<AuditEntry, 'author'>[]): string {\n return (['vault', 'app'] as const).filter((author) => batch.some((entry) => entry.author === author)).join(', ');\n}\n\n/**\n * Entries in the order the page shows them, newest first, each batch as one\n * line at its newest entry. The server leaves detail out unless asked.\n */\nexport function lines<T extends AuditEntry>(entries: T[]): T[][] {\n const shown: T[][] = [];\n const batches = new Map<string, T[]>();\n for (const entry of entries) {\n const batch = entry.operationId === null ? undefined : batches.get(entry.operationId);\n if (batch !== undefined) {\n batch.push(entry);\n continue;\n }\n const fresh = [entry];\n if (entry.operationId !== null) batches.set(entry.operationId, fresh);\n shown.push(fresh);\n }\n return shown;\n}\n\n/** A sentence as text. */\nexport function plain(parts: Part[]): string {\n return parts\n .map((part) =>\n typeof part === 'string' ? part : 'place' in part ? part.place : part.member.startsWith('user:') ? part.member.slice(5) : shownMember(part.member),\n )\n .join('');\n}\n\n/**\n * The CI run an entry was written for, as its issuer stated it at the\n * exchange: `acme/api run 7001 at 3f2a9c1`, a GitLab pipeline, or the\n * token's subject. Null for an entry no trust binding's credential wrote.\n */\nexport function runLabel(run: { claims: Record<string, string | number> } | null): string | null {\n if (run === null) return null;\n const { claims } = run;\n const text = (name: string) => (typeof claims[name] === 'string' || typeof claims[name] === 'number' ? String(claims[name]) : null);\n const at = text('sha') === null ? '' : ` at ${text('sha')!.slice(0, 7)}`;\n if (text('repository') !== null && text('run_id') !== null) return `${text('repository')} run ${text('run_id')}${at}`;\n if (text('project_path') !== null && text('pipeline_id') !== null) return `${text('project_path')} pipeline ${text('pipeline_id')}${at}`;\n return text('sub') === null ? 'a CI run' : `CI run ${text('sub')}`;\n}\n","import { serviceName, shownMember } from '@coffre/client';\nimport { Fragment } from 'react';\nimport { Link } from '@tanstack/react-router';\nimport type { Part } from '../lib/audit-sentences';\nimport { breakAfterUnderscores } from './ui';\n\n/** A sentence, its people and places links to their pages. */\nexport function Sentence({ parts }: { parts: Part[] }) {\n return (\n <>\n {parts.map((part, index) => (\n <Fragment key={index}>\n {typeof part === 'string' ? (\n part\n ) : 'place' in part ? (\n <PlaceLink path={part.place} />\n ) : (\n <MemberLink member={part.member} />\n )}\n </Fragment>\n ))}\n </>\n );\n}\n\nfunction PlaceLink({ path }: { path: string }) {\n const [project, environment] = path.split('/') as [string, string | undefined];\n const text = <span className=\"mono\">{breakAfterUnderscores(path)}</span>;\n return environment === undefined ? (\n <Link to=\"/projects/$project\" params={{ project }}>\n {text}\n </Link>\n ) : (\n <Link to=\"/projects/$project/$environment\" params={{ project, environment }}>\n {text}\n </Link>\n );\n}\n\n/** A member from the log, which keeps `token:<name>`, shown as people read it: `service:<name>`, to its page. */\nfunction MemberLink({ member }: { member: string }) {\n return member.startsWith('token:') ? (\n <Link to=\"/service-accounts/$account\" params={{ account: serviceName(member) }}>\n {shownMember(member)}\n </Link>\n ) : (\n <Link to=\"/users/$user\" params={{ user: memberName(member) }}>\n {memberName(member)}\n </Link>\n );\n}\n\nexport function memberName(member: string): string {\n return member.startsWith('user:') ? member.slice('user:'.length) : shownMember(member);\n}\n"],"mappings":";;;;;;;AAiEA,IAAM,QAAQ,UAAmC,OAAO,UAAU,YAAY,UAAU,KAAK,QAAQ;AACrG,IAAM,UAAU,UAAmC,OAAO,UAAU,WAAW,QAAQ;;AAGvF,SAAS,MAAM,EAAE,SAAS,aAAa,OAA2B;CAChE,MAAM,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,UACG,MAAM,KAAK,MAAM,UAChB,oBAAC,UAAD,EAAA,UACG,OAAO,SAAS,WACf,OACE,WAAW,OACb,oBAAC,WAAD,EAAW,MAAM,KAAK,MAAQ,CAAA,IAE9B,oBAAC,YAAD,EAAY,QAAQ,KAAK,OAAS,CAAA,EAE5B,GARK,KAQL,CACX,EACD,CAAA;AAEN;AAEA,SAAS,UAAU,EAAE,QAA0B;CAC7C,MAAM,CAAC,SAAS,eAAe,KAAK,MAAM,GAAG;CAC7C,MAAM,OAAO,oBAAC,QAAD;EAAM,WAAU;YAAQ,sBAAsB,IAAI;CAAQ,CAAA;CACvE,OAAO,gBAAgB,KAAA,IACrB,oBAAC,MAAD;EAAM,IAAG;EAAqB,QAAQ,EAAE,QAAQ;YAC7C;CACG,CAAA,IAEN,oBAAC,MAAD;EAAM,IAAG;EAAkC,QAAQ;GAAE;GAAS;EAAY;YACvE;CACG,CAAA;AAEV;;AAGA,SAAS,WAAW,EAAE,UAA8B;CAClD,OAAO,OAAO,WAAW,QAAQ,IAC/B,oBAAC,MAAD;EAAM,IAAG;EAA6B,QAAQ,EAAE,SAAS,YAAY,MAAM,EAAE;YAC1E,YAAY,MAAM;CACf,CAAA,IAEN,oBAAC,MAAD;EAAM,IAAG;EAAe,QAAQ,EAAE,MAAM,WAAW,MAAM,EAAE;YACxD,WAAW,MAAM;CACd,CAAA;AAEV;AAEA,SAAgB,WAAW,QAAwB;CACjD,OAAO,OAAO,WAAW,OAAO,IAAI,OAAO,MAAM,CAAc,IAAI,YAAY,MAAM;AACvF"}
|
|
@@ -9,7 +9,7 @@ import { M as revokeMemberToken, U as projectAccessLabel, V as accessRows, d as
|
|
|
9
9
|
import { t as PrincipalAvatar } from "./principal-DFBswTBr.js";
|
|
10
10
|
import { i as PrincipalActions, n as InstanceRole, r as KIND } from "./directory-BQNOdze_.js";
|
|
11
11
|
import { t as PersonalTokensCard } from "./personal-tokens-B8rkT-DI.js";
|
|
12
|
-
import { a as lines, i as describe, t as Sentence } from "./audit-sentence-
|
|
12
|
+
import { a as lines, i as describe, t as Sentence } from "./audit-sentence-C_wMpAqr.js";
|
|
13
13
|
import { t as useAction } from "./use-action-BB-RcHo1.js";
|
|
14
14
|
import { n as GrantsTable, t as GrantRowView } from "./grants-CJIBrkod.js";
|
|
15
15
|
import { r as RemovedNotice, t as PrincipalReportCards } from "./offboarding-CrgwaetA.js";
|
|
@@ -900,4 +900,4 @@ function AccessChangeTag({ change }) {
|
|
|
900
900
|
//#endregion
|
|
901
901
|
export { PrincipalLayout as n, ActionsLog as r, PrincipalAccess as t };
|
|
902
902
|
|
|
903
|
-
//# sourceMappingURL=principal-page-
|
|
903
|
+
//# sourceMappingURL=principal-page-Cv5PheS9.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"principal-page-DDmmV1KQ.js","names":[],"sources":["../../src/components/actions-log.tsx","../../src/lib/service-setup.ts","../../src/lib/access-plan.ts","../../src/components/expiry-field.tsx","../../src/components/principal-page.tsx"],"sourcesContent":["import { useInfiniteQuery } from '@tanstack/react-query';\nimport { uiResult, useCoffre } from '../lib/coffre';\nimport { keys } from '../lib/queries';\nimport { describe, lines } from '../lib/audit-sentences';\nimport { Sentence } from './audit-sentence';\nimport { EmptyState, Notice, Spinner, Timestamp } from './ui';\nimport { Activity, Clock, ShieldCheck, SlashCircle } from './icons';\n\nconst PAGE_SIZE = 50;\n\n/**\n * Everything one member did, newest first, from the audit log: the same\n * entries `coffre audit --actor` lists, said as the audit page says them.\n * Older pages come on request.\n */\nexport function ActionsLog({ member }: { member: string }) {\n const client = useCoffre();\n const log = useInfiniteQuery({\n queryKey: [...keys.audit, 'actor', member],\n staleTime: 0,\n initialPageParam: undefined as number | undefined,\n queryFn: ({ pageParam }) =>\n uiResult(() => client.audit.list({ actor: member, limit: PAGE_SIZE, before: pageParam })),\n // A page lists fewer entries where they name many secrets: `more` says whether older ones follow.\n getNextPageParam: (page) =>\n page.ok && page.more && page.entries.length > 0 ? page.entries.at(-1)!.seq : undefined,\n });\n\n if (log.isPending) {\n return (\n <p className=\"hint\">\n <Spinner size={13} /> Reading the log…\n </p>\n );\n }\n const failed = log.data?.pages.find((page) => !page.ok);\n if (failed !== undefined && !failed.ok) return <Notice tone=\"bad\">{failed.error}</Notice>;\n const entries = (log.data?.pages ?? []).flatMap((page) => (page.ok ? page.entries : []));\n const shown = lines(entries);\n\n return (\n <>\n <section className=\"card\" aria-label=\"Actions log\">\n {shown.length === 0 ? (\n <EmptyState title=\"Nothing yet\" />\n ) : (\n <div className=\"dt-wrap\">\n <table className=\"dt actions-log stacks stacks-inline\">\n <thead>\n <tr>\n <th className=\"col-shrink\">\n <span className=\"th\">\n <Clock size={14} />\n When\n </span>\n </th>\n <th>\n <span className=\"th\">\n <Activity size={14} />\n Action\n </span>\n </th>\n <th className=\"col-shrink\">\n <span className=\"th\">\n <ShieldCheck size={14} />\n Outcome\n </span>\n </th>\n </tr>\n </thead>\n <tbody>\n {shown.map((batch) => {\n const lead = batch[0]!;\n const sentence = describe(batch);\n return (\n <tr key={lead.seq} className={sentence.refused ? 'is-denied' : undefined}>\n <td className=\"nowrap cell-muted\" title={lead.occurredAt}>\n <Timestamp iso={lead.occurredAt} display=\"relative\" />\n </td>\n <td className=\"cell-sentence\">\n <span className=\"sentence\">\n <Sentence parts={sentence.parts} />\n </span>\n </td>\n <td className=\"nowrap\" data-label=\"Outcome\">\n {sentence.refused ? (\n <span className=\"decided decided-refused\">\n <SlashCircle size={13} />\n Refused\n </span>\n ) : (\n <span className=\"cell-muted\">Allowed</span>\n )}\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n )}\n </section>\n {log.hasNextPage && (\n <div className=\"table-actions\">\n <button\n type=\"button\"\n className=\"btn\"\n disabled={log.isFetchingNextPage}\n onClick={() => void log.fetchNextPage()}\n >\n {log.isFetchingNextPage && <Spinner />}\n Show older\n </button>\n </div>\n )}\n </>\n );\n}\n","import { inScope, ROLE_NAMES, ROLES, type Permission, type Role, type Scope } from '@coffre/core/access';\n\nimport type { ProjectSummary } from '../shared/models';\n\n/** What `givable` reads of the shell: the projects, what you hold in each environment, and the setting. */\ntype Holder = {\n projects: readonly ProjectSummary[];\n environments: readonly { project: string; environment: string; permissions: Permission[] }[];\n /** The instance's setting as `/me` says it, projects by slug, those you see; null for a service account. */\n serviceSetup: Scope | null;\n};\n\n/**\n * The roles you may give a service account at a project, or one of its\n * environments, as the server decides it (`givesService` in\n * @coffre/core/access): any, where you manage access; otherwise, inside the\n * instance's setting, those whose every permission you hold there.\n *\n * a Developer of every dev, at market/dev viewer, developer\n * the same, at market none: a project takes holding all of it\n */\nexport function givable(holder: Holder, project: ProjectSummary, environment: string | null): Role[] {\n const held = environment === null\n ? project.permissions\n : holder.environments.find((entry) => entry.project === project.slug && entry.environment === environment)?.permissions ?? [];\n if (held.includes('grant.manage')) return [...ROLE_NAMES];\n const setting = holder.serviceSetup;\n // The setting names projects by slug here, so a place is matched by its slugs.\n const place = environment === null\n ? { projectId: project.slug }\n : { projectId: project.slug, environmentId: environment, environmentSlug: environment };\n if (setting === null || !inScope(setting, place)) return [];\n return ROLE_NAMES.filter((role) => ROLES[role].permissions.every((permission) => held.includes(permission)));\n}\n\n/** The projects where you may give a service account something: on the project, or on one of its environments. */\nexport function serviceProjects(holder: Holder): ProjectSummary[] {\n return holder.projects.filter((project) =>\n givable(holder, project, null).length > 0 ||\n project.environments.some((environment) => givable(holder, project, environment.slug).length > 0));\n}\n","import type { AccessValue } from '@coffre/client';\nimport type { Role } from '@coffre/core/access';\n\nimport type { GrantRow } from '../shared/models';\n\n/** Read or write on one environment, and when it ends: an ISO instant, or null for never. */\nexport type EnvironmentAccess = { role: Extract<Role, 'viewer' | 'developer'>; expiresAt: string | null };\n\n/**\n * What one project is set to in a principal's access editor: nothing, owner,\n * read or write everywhere, or read or write per environment. Every grant the\n * plan asks for carries its own expiry.\n *\n * `custom` is for grants that do not fit that shape -- an auditor grant, or\n * read everywhere plus write on one environment. The editor shows them and\n * leaves them alone unless another setting is picked.\n */\nexport type AccessPlan = {\n level: 'none' | Extract<Role, 'owner' | 'viewer' | 'developer'> | 'env' | 'custom';\n /** When the project-wide level ends. */\n expiresAt: string | null;\n /** Environments without an entry get no access. */\n environments: Record<string, EnvironmentAccess>;\n};\n\nexport type HeldGrant = Pick<\n GrantRow,\n 'id' | 'role' | 'roleName' | 'environmentSlug' | 'expiresAt'\n>;\n\nexport type AccessChange =\n | { kind: 'create'; role: string; environmentSlug: string | null; expiresAt: string | null }\n | { kind: 'expiry'; grant: HeldGrant; expiresAt: string | null }\n | { kind: 'revoke'; grant: HeldGrant };\n\n/** An environment's access in a plan; slugs like `constructor` are not inherited. */\nexport function environmentAccess(plan: AccessPlan, slug: string): EnvironmentAccess | null {\n return Object.hasOwn(plan.environments, slug) ? plan.environments[slug] : null;\n}\n\n/**\n * Read what a principal holds on a project back into the editor's terms.\n * `environments` are the ones the editor can set: live, and not archived.\n */\nexport function planFromGrants(\n grants: readonly HeldGrant[],\n environments: readonly string[],\n): AccessPlan {\n if (grants.length === 0) return { level: 'none', expiresAt: null, environments: {} };\n\n const [only] = grants;\n if (\n grants.length === 1 &&\n only.environmentSlug === null &&\n (only.role === 'owner' || only.role === 'viewer' || only.role === 'developer')\n ) {\n return { level: only.role, expiresAt: only.expiresAt, environments: {} };\n }\n\n const perEnvironment: Record<string, EnvironmentAccess> = {};\n for (const grant of grants) {\n const slug = grant.environmentSlug;\n if (\n slug === null ||\n !environments.includes(slug) ||\n Object.hasOwn(perEnvironment, slug) ||\n (grant.role !== 'viewer' && grant.role !== 'developer')\n ) {\n return { level: 'custom', expiresAt: null, environments: {} };\n }\n perEnvironment[slug] = { role: grant.role, expiresAt: grant.expiresAt };\n }\n return { level: 'env', expiresAt: null, environments: perEnvironment };\n}\n\n/**\n * Switch a plan's level. Going from read or write everywhere to per\n * environment starts every environment at that level and expiry, so the\n * switch alone keeps the same reach.\n */\nexport function withLevel(\n plan: AccessPlan,\n level: AccessPlan['level'],\n environments: readonly string[],\n): AccessPlan {\n if (\n level === 'env' &&\n (plan.level === 'viewer' || plan.level === 'developer') &&\n Object.keys(plan.environments).length === 0\n ) {\n const access = { role: plan.level, expiresAt: plan.expiresAt };\n return {\n ...plan,\n level,\n environments: Object.fromEntries(environments.map((slug) => [slug, access])),\n };\n }\n return { ...plan, level };\n}\n\n/** Set one environment's access, or take it away with `null`. */\nexport function withEnvironment(\n plan: AccessPlan,\n slug: string,\n access: EnvironmentAccess | null,\n): AccessPlan {\n const environments = { ...plan.environments };\n if (access === null) delete environments[slug];\n else environments[slug] = access;\n return { ...plan, environments };\n}\n\nfunction grantsFor(\n plan: AccessPlan,\n): { role: string; environmentSlug: string | null; expiresAt: string | null }[] {\n switch (plan.level) {\n case 'none':\n case 'custom':\n return [];\n case 'owner':\n case 'viewer':\n case 'developer':\n return [{ role: plan.level, environmentSlug: null, expiresAt: plan.expiresAt }];\n case 'env':\n return Object.entries(plan.environments).map(([environmentSlug, access]) => ({\n environmentSlug,\n ...access,\n }));\n }\n}\n\n/** The server and the date field spell the same instant differently. */\nfunction sameExpiry(a: string | null, b: string | null): boolean {\n return a === b || (a !== null && b !== null && Date.parse(a) === Date.parse(b));\n}\n\n/**\n * The changes that take what is held to the plan: grants to create, grants\n * whose expiry moves, and grants to revoke, in that order. Asking for what is\n * already held yields nothing, so applying the same plan twice is a no-op.\n */\nexport function accessChanges(grants: readonly HeldGrant[], plan: AccessPlan): AccessChange[] {\n if (plan.level === 'custom') return [];\n\n const key = (grant: { role: string; environmentSlug: string | null }) =>\n `${grant.role}@${grant.environmentSlug ?? ''}`;\n const wanted = new Map(grantsFor(plan).map((grant) => [key(grant), grant]));\n const held = new Map(grants.map((grant) => [key(grant), grant]));\n\n const changes: AccessChange[] = [];\n for (const [id, grant] of wanted) {\n if (!held.has(id)) changes.push({ kind: 'create', ...grant });\n }\n for (const [id, grant] of held) {\n const want = wanted.get(id);\n if (want !== undefined && !sameExpiry(grant.expiresAt, want.expiresAt)) {\n changes.push({ kind: 'expiry', grant, expiresAt: want.expiresAt });\n }\n }\n for (const [id, grant] of held) {\n if (!wanted.has(id)) changes.push({ kind: 'revoke', grant });\n }\n return changes;\n}\n\n/**\n * The changes as the API's access patch for one project: each place it\n * touches, and the role to hold there until when, or `null` for none.\n *\n * { \"market\": null, \"market/dev\": { \"role\": \"developer\", \"until\": \"2026-12-31T23:59:59.000Z\" } }\n *\n * A place holds one role, so where a level changes, the revoke of the old\n * role and the create of the new land on the same place, and the new role\n * wins: the server replaces one with the other, never passing through none.\n */\nexport function accessPatch(project: string, changes: readonly AccessChange[]): Record<string, AccessValue> {\n const place = (environmentSlug: string | null) =>\n environmentSlug === null ? project : `${project}/${environmentSlug}`;\n const holding = (role: string, expiresAt: string | null): AccessValue =>\n expiresAt === null ? (role as Role) : { role: role as Role, until: expiresAt };\n\n const patch: Record<string, AccessValue> = {};\n for (const change of changes) {\n if (change.kind === 'revoke') patch[place(change.grant.environmentSlug)] = null;\n }\n for (const change of changes) {\n if (change.kind === 'expiry') patch[place(change.grant.environmentSlug)] = holding(change.grant.role, change.expiresAt);\n if (change.kind === 'create') patch[place(change.environmentSlug)] = holding(change.role, change.expiresAt);\n }\n return patch;\n}\n\n/** A date field's value as the instant access ends: the close of that day, UTC. */\nexport function expiryFromDate(date: string): string | null {\n return date === '' ? null : new Date(`${date}T23:59:59Z`).toISOString();\n}\n\n/** A date field's value for an expiry. Expiries are shown as UTC dates everywhere. */\nexport function dateFromExpiry(expiresAt: string | null): string {\n return expiresAt === null ? '' : expiresAt.slice(0, 10);\n}\n","import { dateFromExpiry, expiryFromDate } from '../lib/access-plan';\nimport { X } from './icons';\n\n/**\n * When one grant ends, as a date: access lasts through that day, UTC. Blank\n * reads \"Never\" where the browser lets the empty field be restyled.\n */\nexport function ExpiryField({\n label,\n expiresAt,\n onChange,\n}: {\n label: string;\n expiresAt: string | null;\n onChange: (expiresAt: string | null) => void;\n}) {\n const date = dateFromExpiry(expiresAt);\n return (\n <span className={`expiry${date === '' ? ' is-never' : ''}`}>\n <input\n className=\"input select-sm\"\n type=\"date\"\n aria-label={label}\n min={new Date().toISOString().slice(0, 10)}\n value={date}\n onChange={(event) => onChange(expiryFromDate(event.target.value))}\n />\n <span className=\"expiry-never\" aria-hidden=\"true\">\n Never\n </span>\n <button\n className=\"btn btn-quiet btn-sm btn-icon\"\n type=\"button\"\n aria-label={`${label}: never`}\n title=\"Never expires\"\n onClick={() => onChange(null)}\n >\n <X size={12} />\n </button>\n </span>\n );\n}\n","import { useState } from 'react';\nimport { useQueryClient, useSuspenseQuery } from '@tanstack/react-query';\nimport { Link, Outlet } from '@tanstack/react-router';\nimport { INSTANCE_ROLES, ROLE_NAMES, ROLES, scopeInWords, unscoped, type Role } from '@coffre/core/access';\nimport { useShell } from '../lib/use-shell';\nimport { toast } from 'sonner';\nimport { memberRef, useCoffre } from '../lib/coffre';\nimport { directoryList, revokeMemberToken } from '../lib/changes';\nimport { affects, hasAppsTab, keys, listsAccess, managedProjects, queries, signInWays } from '../lib/queries';\nimport { useChangeStatus } from '../lib/use-change';\nimport { useMounted } from '../lib/mounted';\nimport { ItemFailure } from './row-state';\nimport { useAction } from '../lib/use-action';\nimport { accessRows, projectAccessLabel, type ProjectAccess } from '../lib/project-access';\nimport { givable, serviceProjects } from '../lib/service-setup';\nimport {\n accessChanges,\n accessPatch,\n dateFromExpiry,\n environmentAccess,\n expiryFromDate,\n planFromGrants,\n withEnvironment,\n withLevel,\n type AccessChange,\n type AccessPlan,\n} from '../lib/access-plan';\nimport type { MemberAccess, TokenRow } from '@coffre/client';\nimport type { DirectoryPrincipal, ProjectSummary } from '../shared/models';\nimport { ClosedDoor, PageHeader } from './page';\nimport { EmptyState, ErrorLine, Modal, Notice, Spinner } from './ui';\nimport { GrantRowView, GrantsTable } from './grants';\nimport { ExpiryField } from './expiry-field';\nimport { InstanceRole, KIND, PrincipalActions } from './directory';\nimport { PrincipalReportCards, RemovedNotice } from './offboarding';\nimport { PersonalTokensCard } from './personal-tokens';\nimport { PrincipalAvatar } from './principal';\nimport { Tile } from './tile';\nimport { Activity, Archive, Clock, Folder, Key, Link as LinkIcon, Pencil, Users, X } from './icons';\nimport { PageTabs } from './tabs';\n\ntype PrincipalType = DirectoryPrincipal['principalType'];\n\n/** The roles you may give at a project, or one of its environments: any where you manage access (`givable`). */\ntype Offers = (project: ProjectSummary, environment: string | null) => readonly Role[];\n\n/** Who a user or service account is to the instance, as an owner reads it; null for anyone else. */\nfunction useReport(principalType: PrincipalType, principalId: string) {\n const { capabilities } = useShell();\n return useSuspenseQuery(queries.report(useCoffre(), memberRef(principalType, principalId), capabilities.runsInstance)).data;\n}\n\n/**\n * What `loadAccess` read in one request: their role and scope, and, for each\n * project where you manage access, the grants they hold there. For a\n * service account you manage, each project where you may give it\n * something, and what (`offers`).\n */\nfunction useMemberAccess(principalType: PrincipalType, principalId: string): {\n access: MemberAccess | null;\n error: string | null;\n projects: ProjectAccess[];\n offers: Offers;\n} {\n const shell = useShell();\n const { data } = useSuspenseQuery(queries.memberAccess(useCoffre(), memberRef(principalType, principalId), listsAccess(shell)));\n const error = data !== null && !data.ok ? data.error : null;\n const access = data?.ok === true ? data : null;\n const yours = principalType === 'service' && access?.managed === true;\n const listed = yours ? serviceProjects(shell) : managedProjects(shell.projects);\n return {\n access,\n error,\n offers: yours ? (project, environment) => givable(shell, project, environment) : () => ROLE_NAMES,\n projects: listed.map((project) => ({\n project,\n grants: (access?.grants ?? []).filter((grant) => grant.project === project.slug).map((grant) => ({\n id: grant.id,\n principalType,\n principalId,\n role: grant.role,\n roleName: grant.roleName,\n permissions: grant.permissions,\n scope: grant.environment === null ? 'project' : 'environment',\n environmentSlug: grant.environment,\n expiresAt: grant.expiresAt,\n })),\n grantsError: error,\n })),\n };\n}\n\n/**\n * A user's or service account's page: who it is, its menu, and its tabs,\n * each a page of its own under this one. Access is a user's first tab; a\n * service account's is how it signs in, while it shows one. A tab the\n * deployment left out is not offered.\n */\nexport function PrincipalLayout({ principalType, principalId }: { principalType: PrincipalType; principalId: string }) {\n const shell = useShell();\n const mounted = useMounted();\n const { capabilities } = shell;\n const report = useReport(principalType, principalId);\n // A service account you manage, though you do not run the instance: what it holds, from its access.\n const { data: held } = useSuspenseQuery(queries.memberAccess(useCoffre(), memberRef(principalType, principalId), listsAccess(shell)));\n const yours = principalType === 'service' && held?.ok === true && held.managed;\n // A role change or removal made from this page's menu, refused.\n const { status, dismiss } = useChangeStatus(directoryList.queryKey);\n const change = status(memberRef(principalType, principalId));\n const kind = KIND[principalType];\n const people = principalType === 'user';\n const found = report?.ok === true ? report.report : null;\n const removed = found?.status === 'removed';\n const entry =\n found !== null && !removed\n ? {\n principalType,\n principalId,\n instanceRole: found.instanceRole,\n scope: found.scope,\n tampered: found.status === 'tampered',\n managed: principalType === 'service',\n declared: found.declared,\n }\n : yours\n ? { principalType, principalId, instanceRole: 'member' as const, scope: null, tampered: false, managed: true }\n : undefined;\n\n // Owners get a report about anyone ever registered, removed or not, so a\n // miss there means there is no such user. Everyone else only reaches this\n // page through projects they manage, or a service account they manage.\n const unknown = report?.ok === true && found === null;\n if (unknown || (report === null && managedProjects(shell.projects).length === 0 && !yours)) {\n return (\n <ClosedDoor\n icon={people ? <Users size={18} /> : <Key size={18} />}\n label={<span className=\"mono\">{people ? principalId : `service:${principalId}`}</span>}\n title={people ? 'No such user for you' : 'No such service account for you'}\n actions={\n <Link className=\"btn\" to={people ? '/users' : '/service-accounts'}>\n All {people ? 'users' : 'service accounts'}\n </Link>\n }\n >\n {report === null\n ? `A ${kind}'s page lists its access to the projects where you manage access, and you manage none.`\n : `No ${kind} by that name has ever been registered here.`}\n </ClosedDoor>\n );\n }\n\n const access = (\n <>\n {removed ? <Archive size={15} /> : <Folder size={15} />}\n {removed ? 'Offboarding' : 'Access'}\n </>\n );\n const activity = (\n <>\n <Activity size={15} />\n Activity\n </>\n );\n const tabs = people\n ? [\n <Link key=\"access\" to=\"/users/$user\" params={{ user: principalId }} activeOptions={{ exact: true, includeSearch: false }}>\n {access}\n </Link>,\n // Only an owner reads the report that lists them; removal disconnects them.\n hasAppsTab(shell, report) && mounted('/users/$user/apps') && (\n <Link key=\"apps\" to=\"/users/$user/apps\" params={{ user: principalId }}>\n <LinkIcon size={15} />\n Connected apps\n </Link>\n ),\n capabilities.canReadAudit && mounted('/users/$user/activity') && (\n <Link key=\"activity\" to=\"/users/$user/activity\" params={{ user: principalId }}>\n {activity}\n </Link>\n ),\n ]\n : [\n signInWays(shell, held) !== null && (\n <Link key=\"sign-in\" to=\"/service-accounts/$account\" params={{ account: principalId }} activeOptions={{ exact: true, includeSearch: false }}>\n <LinkIcon size={15} />\n Sign-in\n </Link>\n ),\n mounted('/service-accounts/$account/access') && (\n <Link key=\"access\" to=\"/service-accounts/$account/access\" params={{ account: principalId }}>\n {access}\n </Link>\n ),\n capabilities.canReadAudit && mounted('/service-accounts/$account/activity') && (\n <Link key=\"activity\" to=\"/service-accounts/$account/activity\" params={{ account: principalId }}>\n {activity}\n </Link>\n ),\n ];\n\n return (\n <>\n <PageHeader\n lead={<PrincipalAvatar type={principalType} id={principalId} size=\"lg\" />}\n title={principalType === 'service' ? `service:${principalId}` : principalId}\n description={\n principalType === 'service'\n ? 'A service account: an identity for CI and other automation.'\n : undefined\n }\n meta={\n removed ? (\n <span className=\"tag tag-red\">Removed</span>\n ) : (\n entry?.principalType === 'user' && <InstanceRole principal={entry} />\n )\n }\n actions={entry !== undefined && <PrincipalActions principal={entry} trigger=\"btn btn-icon\" />}\n />\n\n {change.state === 'failed' && (\n <div className=\"report-notice\">\n <ItemFailure status={change} onDismiss={() => dismiss(change.mutationId)} />\n </div>\n )}\n {report?.ok === false && (\n <div className=\"report-notice\">\n <Notice tone=\"bad\">{report.error}</Notice>\n </div>\n )}\n <PageTabs label={people ? 'User sections' : 'Service account sections'}>{tabs}</PageTabs>\n\n <Outlet />\n </>\n );\n}\n\n/**\n * A user's or service account's Access tab: its grants on every project\n * where you manage access, and on every project; once it is removed, what\n * its offboarding did instead.\n */\nexport function PrincipalAccess({ principalType, principalId }: { principalType: PrincipalType; principalId: string }) {\n const report = useReport(principalType, principalId);\n const { access: held, error, projects: access, offers } = useMemberAccess(principalType, principalId);\n const kind = KIND[principalType];\n const people = principalType === 'user';\n const found = report?.ok === true ? report.report : null;\n const removed = found?.status === 'removed';\n\n // One request, so one error, said once in place of the rows (`UnreadAccess`).\n const rows = accessRows(access).flatMap((row) => (row.grant === null ? [] : [row]));\n // Grants to someone removed are refused until they are added back.\n const editable = removed\n ? []\n : access.filter(\n ({ project, grantsError }) => project.archivedAt === null && grantsError === null,\n );\n\n return (\n <>\n {removed && found !== null && <RemovedNotice report={found} />}\n\n {/* Removal ends every grant, so there is no access left to show. */}\n {!removed && (\n <>\n {people && held !== null && <InstanceRoleNote access={held} />}\n\n <section className=\"card\" aria-label=\"Project access\">\n {error !== null ? (\n <UnreadAccess member={memberRef(principalType, principalId)} error={error} />\n ) : rows.length === 0 ? (\n <EmptyState title=\"No project access yet\">\n {editable.length > 0 ? undefined : `None of the projects where you manage access has a grant for this ${kind}.`}\n </EmptyState>\n ) : (\n <GrantsTable\n lead={\n <span className=\"th\">\n <Folder size={14} />\n Project\n </span>\n }\n >\n {rows.map(({ project, grant }, index) => (\n <GrantRowView\n key={grant.id}\n number={index + 1}\n project={project.slug}\n grant={grant}\n leadLabel=\"Project\"\n lead={\n <span className=\"cell-project\">\n <Tile name={project.slug} />\n <Link\n className=\"cell-link\"\n to={people ? '/projects/$project/users' : '/projects/$project/service-accounts'}\n params={{ project: project.slug }}\n >\n {project.slug}\n </Link>\n {project.archivedAt !== null && <span className=\"tag tag-red\">Archived</span>}\n </span>\n }\n />\n ))}\n </GrantsTable>\n )}\n </section>\n\n {editable.length > 0 && (\n <div className=\"table-actions\">\n <EditAccess principalType={principalType} principalId={principalId} access={editable} offers={offers} />\n </div>\n )}\n\n {!(held?.managed === true && principalType === 'service') && (\n <p className=\"hint section-foot\">Only projects where you manage access are listed.</p>\n )}\n\n </>\n )}\n\n {found !== null && <PrincipalReportCards report={found} />}\n {/* A report from an instance before 0.7, mid-deploy or rolled back, lists none. */}\n {found !== null && !removed && (found.personalTokens ?? []).length > 0 && (\n <MemberPersonalTokens member={memberRef(principalType, principalId)} tokens={found.personalTokens} />\n )}\n </>\n );\n}\n\n/** A person's personal tokens, for whoever runs the instance, who reads their report and may revoke any of them. */\nfunction MemberPersonalTokens({ member, tokens }: { member: string; tokens: TokenRow[] }) {\n return (\n <PersonalTokensCard\n tokens={tokens}\n change={revokeMemberToken(useCoffre(), member)}\n description=\"Tokens they made, each acting as them within what it reaches. Removing them from coffre revokes every one.\"\n />\n );\n}\n\n/** What a person's instance role gives them, above the grants that add to it: nothing for a Member. */\nfunction InstanceRoleNote({ access }: { access: MemberAccess }) {\n if (access.instanceRole === 'member') return null;\n const { name } = INSTANCE_ROLES[access.instanceRole];\n return (\n <div className=\"report-notice\">\n <Notice tone=\"info\">\n <strong>{name}</strong>\n {access.scope === null ? '' : unscoped(access.scope) ? ' in every project' : `: ${scopeInWords(access.scope)}`}, from their instance role. The\n grants below add to it.\n </Notice>\n </div>\n );\n}\n\n/** Their access could not be read: why, and another try, never an empty list that reads as no access. */\nfunction UnreadAccess({ member, error }: { member: string; error: string }) {\n const queryClient = useQueryClient();\n const [retrying, setRetrying] = useState(false);\n return (\n <div className=\"row-failure-line unread-access\">\n <ErrorLine error={`Their access could not be read. ${error}`} />\n <button\n type=\"button\"\n className=\"act\"\n disabled={retrying}\n onClick={() => {\n setRetrying(true);\n void queryClient.refetchQueries({ queryKey: keys.memberAccess(member) }).finally(() => setRetrying(false));\n }}\n >\n {retrying && <Spinner size={13} />}\n Retry\n </button>\n </div>\n );\n}\n\n/**\n * One principal's access to every project you manage, edited in one place.\n *\n * Each project opens set to what the principal holds: a project-wide level,\n * or read or write per environment, each with its own expiry. Saving sends\n * only the difference, every project in one `access.set`: the server applies\n * all of it in one transaction, or none of it.\n */\nfunction EditAccess({\n principalType,\n principalId,\n access,\n offers,\n}: {\n principalType: PrincipalType;\n principalId: string;\n access: ProjectAccess[];\n offers: Offers;\n}) {\n const coffre = useCoffre();\n const [open, setOpen] = useState(false);\n const [edits, setEdits] = useState<Record<string, AccessPlan>>({});\n const { pending, error, setError, run } = useAction();\n const kind = KIND[principalType];\n\n const rows = access.map(({ project, grants }) => {\n const environments = project.environments\n .filter(\n // Your personal config takes no grant: it is no place to give access to.\n (environment) => environment.details !== null && environment.details.archivedAt === null && !environment.personal,\n )\n .map((environment) => environment.slug);\n const held = planFromGrants(grants, environments);\n const plan = Object.hasOwn(edits, project.slug) ? edits[project.slug] : held;\n // What you may give here: every role where you manage access; a service account you manage, what you hold.\n const whole = offers(project, null);\n const each = Object.fromEntries(environments.map((slug) => [slug, offers(project, slug)]));\n return { project, grants, environments, held, plan, whole, each, changes: accessChanges(grants, plan) };\n });\n const changed = rows.filter((row) => row.changes.length > 0);\n\n function close() {\n setOpen(false);\n setEdits({});\n setError(null);\n }\n\n return (\n <>\n <button className=\"btn btn-primary\" onClick={() => setOpen(true)}>\n <Pencil size={14} />\n Edit access\n </button>\n\n <Modal\n open={open}\n onOpenChange={(next) => (next ? setOpen(true) : close())}\n title={\n <>\n Edit access for <span className=\"mono\">{principalId}</span>\n </>\n }\n description={`Set what this ${kind} can reach on each project you ${principalType === 'service' ? 'may give it access to' : 'manage'}, and until when.`}\n wide\n >\n <form\n className=\"form\"\n onSubmit={(event) => {\n event.preventDefault();\n run(\n () =>\n coffre.access.set(\n memberRef(principalType, principalId),\n Object.assign({}, ...changed.map(({ project, changes }) => accessPatch(project.slug, changes))),\n ),\n {\n affects: changed.flatMap(({ project }) =>\n affects.access(project.slug, memberRef(principalType, principalId)),\n ),\n onSuccess: () => {\n toast.success(\n `Updated ${principalId}’s access on ${changed.length} project${changed.length === 1 ? '' : 's'}`,\n );\n close();\n },\n },\n );\n }}\n >\n <ul className=\"plan-list\">\n <li className=\"plan-head\" aria-hidden=\"true\">\n <span>Project</span>\n <span>Access</span>\n <span>Expires</span>\n </li>\n {rows.map(({ project, grants, environments, held, plan, whole, each, changes }) => {\n const id = `plan-${project.slug}`;\n const edit = (next: AccessPlan) =>\n setEdits((current) => ({ ...current, [project.slug]: next }));\n return (\n <li\n key={project.slug}\n className={`plan-row${changes.length > 0 ? ' is-changed' : ''}`}\n >\n <label className=\"plan-project\" htmlFor={id}>\n <Tile name={project.slug} />\n <span className=\"plan-project-text\">\n <span className=\"plan-project-name\">{project.slug}</span>\n {held.level === 'custom' && (\n <span className=\"plan-project-held\">\n Holds {grants.map((grant) => projectAccessLabel(grant)).join(', ')}\n </span>\n )}\n </span>\n </label>\n <select\n id={id}\n className=\"select select-sm\"\n value={plan.level}\n onChange={(event) =>\n edit(\n withLevel(plan, event.target.value as AccessPlan['level'], environments),\n )\n }\n >\n {held.level === 'custom' && <option value=\"custom\">Keep as is</option>}\n <option value=\"none\">No access</option>\n {whole.includes('owner') && <option value=\"owner\">{ROLES.owner.name}</option>}\n {whole.includes('viewer') && <option value=\"viewer\">{ROLES.viewer.name}: all</option>}\n {whole.includes('developer') && <option value=\"developer\">{ROLES.developer.name}: all</option>}\n {environments.some((slug) => each[slug]!.length > 0) && <option value=\"env\">Per environment…</option>}\n </select>\n {(plan.level === 'owner' ||\n plan.level === 'viewer' ||\n plan.level === 'developer') && (\n <ExpiryField\n label={`${project.slug} expires`}\n expiresAt={plan.expiresAt}\n onChange={(expiresAt) => edit({ ...plan, expiresAt })}\n />\n )}\n\n {plan.level === 'env' && (\n <ul className=\"plan-envs\" aria-label={`Environments of ${project.slug}`}>\n {environments.map((slug) => {\n const current = environmentAccess(plan, slug);\n return (\n <li key={slug} className=\"plan-env\">\n <label className=\"mono\" htmlFor={`${id}-${slug}`}>\n {slug}\n </label>\n <select\n id={`${id}-${slug}`}\n className=\"select select-sm\"\n value={current?.role ?? ''}\n onChange={(event) => {\n const role = event.target.value;\n edit(\n withEnvironment(\n plan,\n slug,\n role === 'viewer' || role === 'developer'\n ? { role, expiresAt: current?.expiresAt ?? null }\n : null,\n ),\n );\n }}\n >\n <option value=\"\">No access</option>\n {each[slug]!.includes('viewer') && <option value=\"viewer\">{ROLES.viewer.name}</option>}\n {each[slug]!.includes('developer') && <option value=\"developer\">{ROLES.developer.name}</option>}\n </select>\n {current !== null && (\n <ExpiryField\n label={`${slug} of ${project.slug} expires`}\n expiresAt={current.expiresAt}\n onChange={(expiresAt) =>\n edit(withEnvironment(plan, slug, { ...current, expiresAt }))\n }\n />\n )}\n </li>\n );\n })}\n </ul>\n )}\n\n {changes.length > 0 && (\n <ul className=\"plan-changes\" aria-label={`Changes to ${project.slug}`}>\n {changes.map((change) => (\n <li\n key={\n change.kind === 'create'\n ? `+${change.role}@${change.environmentSlug ?? ''}`\n : change.grant.id\n }\n >\n <AccessChangeTag change={change} />\n </li>\n ))}\n </ul>\n )}\n </li>\n );\n })}\n </ul>\n\n <ErrorLine error={error} />\n\n <div className=\"dialog-actions\">\n <button className=\"btn\" type=\"button\" onClick={close}>\n Cancel\n </button>\n <button\n className=\"btn btn-primary\"\n type=\"submit\"\n disabled={pending || changed.length === 0}\n >\n {pending && <Spinner />}\n Save changes\n </button>\n </div>\n </form>\n </Modal>\n </>\n );\n}\n\nfunction AccessChangeTag({ change }: { change: AccessChange }) {\n const until = (expiresAt: string | null) =>\n expiresAt === null ? '' : ` until ${dateFromExpiry(expiresAt)}`;\n switch (change.kind) {\n case 'create':\n return (\n <span className=\"tag tag-green\">\n <span aria-hidden=\"true\">+</span>\n <span className=\"visually-hidden\">Adds</span>\n {projectAccessLabel({ ...change, roleName: change.role })}\n {until(change.expiresAt)}\n </span>\n );\n case 'expiry':\n return (\n <span className=\"tag tag-blue\">\n <Clock size={12} />\n <span className=\"visually-hidden\">Moves the expiry of</span>\n {projectAccessLabel(change.grant)}\n {change.expiresAt === null ? ', no expiry' : until(change.expiresAt)}\n </span>\n );\n case 'revoke':\n return (\n <span className=\"tag tag-red\">\n <span aria-hidden=\"true\">−</span>\n <span className=\"visually-hidden\">Removes</span>\n {projectAccess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;;CACD,CAAA,CACP,EAAA,CAAA;AAEN;AAEA,SAAS,gBAAgB,EAAE,UAAoC;CAC7D,MAAM,SAAS,cACb,cAAc,OAAO,KAAK,UAAU,eAAe,SAAS;CAC9D,QAAQ,OAAO,MAAf;EACE,KAAK,UACH,OACE,qBAAC,QAAD;GAAM,WAAU;aAAhB;IACE,oBAAC,QAAD;KAAM,eAAY;eAAO;IAAO,CAAA;IAChC,oBAAC,QAAD;KAAM,WAAU;eAAkB;IAAU,CAAA;IAC3C,mBAAmB;KAAE,GAAG;KAAQ,UAAU,OAAO;IAAK,CAAC;IACvD,MAAM,OAAO,SAAS;GACnB;;EAEV,KAAK,UACH,OACE,qBAAC,QAAD;GAAM,WAAU;aAAhB;IACE,oBAAC,OAAD,EAAO,MAAM,GAAK,CAAA;IAClB,oBAAC,QAAD;KAAM,WAAU;eAAkB;IAAyB,CAAA;IAC1D,mBAAmB,OAAO,KAAK;IAC/B,OAAO,cAAc,OAAO,gBAAgB,MAAM,OAAO,SAAS;GAC/D;;EAEV,KAAK,UACH,OACE,qBAAC,QAAD;GAAM,WAAU;aAAhB;IACE,oBAAC,QAAD;KAAM,eAAY;eAAO;IAAO,CAAA;IAChC,oBAAC,QAAD;KAAM,WAAU;eAAkB;IAAa,CAAA;IAC9C,mBAAmB,OAAO,KAAK;GAC5B;;CAEZ;AACF"}
|
|
1
|
+
{"version":3,"file":"principal-page-Cv5PheS9.js","names":[],"sources":["../../src/components/actions-log.tsx","../../src/lib/service-setup.ts","../../src/lib/access-plan.ts","../../src/components/expiry-field.tsx","../../src/components/principal-page.tsx"],"sourcesContent":["import { useInfiniteQuery } from '@tanstack/react-query';\nimport { uiResult, useCoffre } from '../lib/coffre';\nimport { keys } from '../lib/queries';\nimport { describe, lines } from '../lib/audit-sentences';\nimport { Sentence } from './audit-sentence';\nimport { EmptyState, Notice, Spinner, Timestamp } from './ui';\nimport { Activity, Clock, ShieldCheck, SlashCircle } from './icons';\n\nconst PAGE_SIZE = 50;\n\n/**\n * Everything one member did, newest first, from the audit log: the same\n * entries `coffre audit --actor` lists, said as the audit page says them.\n * Older pages come on request.\n */\nexport function ActionsLog({ member }: { member: string }) {\n const client = useCoffre();\n const log = useInfiniteQuery({\n queryKey: [...keys.audit, 'actor', member],\n staleTime: 0,\n initialPageParam: undefined as number | undefined,\n queryFn: ({ pageParam }) =>\n uiResult(() => client.audit.list({ actor: member, limit: PAGE_SIZE, before: pageParam })),\n // A page lists fewer entries where they name many secrets: `more` says whether older ones follow.\n getNextPageParam: (page) =>\n page.ok && page.more && page.entries.length > 0 ? page.entries.at(-1)!.seq : undefined,\n });\n\n if (log.isPending) {\n return (\n <p className=\"hint\">\n <Spinner size={13} /> Reading the log…\n </p>\n );\n }\n const failed = log.data?.pages.find((page) => !page.ok);\n if (failed !== undefined && !failed.ok) return <Notice tone=\"bad\">{failed.error}</Notice>;\n const entries = (log.data?.pages ?? []).flatMap((page) => (page.ok ? page.entries : []));\n const shown = lines(entries);\n\n return (\n <>\n <section className=\"card\" aria-label=\"Actions log\">\n {shown.length === 0 ? (\n <EmptyState title=\"Nothing yet\" />\n ) : (\n <div className=\"dt-wrap\">\n <table className=\"dt actions-log stacks stacks-inline\">\n <thead>\n <tr>\n <th className=\"col-shrink\">\n <span className=\"th\">\n <Clock size={14} />\n When\n </span>\n </th>\n <th>\n <span className=\"th\">\n <Activity size={14} />\n Action\n </span>\n </th>\n <th className=\"col-shrink\">\n <span className=\"th\">\n <ShieldCheck size={14} />\n Outcome\n </span>\n </th>\n </tr>\n </thead>\n <tbody>\n {shown.map((batch) => {\n const lead = batch[0]!;\n const sentence = describe(batch);\n return (\n <tr key={lead.seq} className={sentence.refused ? 'is-denied' : undefined}>\n <td className=\"nowrap cell-muted\" title={lead.occurredAt}>\n <Timestamp iso={lead.occurredAt} display=\"relative\" />\n </td>\n <td className=\"cell-sentence\">\n <span className=\"sentence\">\n <Sentence parts={sentence.parts} />\n </span>\n </td>\n <td className=\"nowrap\" data-label=\"Outcome\">\n {sentence.refused ? (\n <span className=\"decided decided-refused\">\n <SlashCircle size={13} />\n Refused\n </span>\n ) : (\n <span className=\"cell-muted\">Allowed</span>\n )}\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n )}\n </section>\n {log.hasNextPage && (\n <div className=\"table-actions\">\n <button\n type=\"button\"\n className=\"btn\"\n disabled={log.isFetchingNextPage}\n onClick={() => void log.fetchNextPage()}\n >\n {log.isFetchingNextPage && <Spinner />}\n Show older\n </button>\n </div>\n )}\n </>\n );\n}\n","import { inScope, ROLE_NAMES, ROLES, type Permission, type Role, type Scope } from '@coffre/core/access';\n\nimport type { ProjectSummary } from '../shared/models';\n\n/** What `givable` reads of the shell: the projects, what you hold in each environment, and the setting. */\ntype Holder = {\n projects: readonly ProjectSummary[];\n environments: readonly { project: string; environment: string; permissions: Permission[] }[];\n /** The instance's setting as `/me` says it, projects by slug, those you see; null for a service account. */\n serviceSetup: Scope | null;\n};\n\n/**\n * The roles you may give a service account at a project, or one of its\n * environments, as the server decides it (`givesService` in\n * @coffre/core/access): any, where you manage access; otherwise, inside the\n * instance's setting, those whose every permission you hold there.\n *\n * a Developer of every dev, at market/dev viewer, developer\n * the same, at market none: a project takes holding all of it\n */\nexport function givable(holder: Holder, project: ProjectSummary, environment: string | null): Role[] {\n const held = environment === null\n ? project.permissions\n : holder.environments.find((entry) => entry.project === project.slug && entry.environment === environment)?.permissions ?? [];\n if (held.includes('grant.manage')) return [...ROLE_NAMES];\n const setting = holder.serviceSetup;\n // The setting names projects by slug here, so a place is matched by its slugs.\n const place = environment === null\n ? { projectId: project.slug }\n : { projectId: project.slug, environmentId: environment, environmentSlug: environment };\n if (setting === null || !inScope(setting, place)) return [];\n return ROLE_NAMES.filter((role) => ROLES[role].permissions.every((permission) => held.includes(permission)));\n}\n\n/** The projects where you may give a service account something: on the project, or on one of its environments. */\nexport function serviceProjects(holder: Holder): ProjectSummary[] {\n return holder.projects.filter((project) =>\n givable(holder, project, null).length > 0 ||\n project.environments.some((environment) => givable(holder, project, environment.slug).length > 0));\n}\n","import type { AccessValue } from '@coffre/client';\nimport type { Role } from '@coffre/core/access';\n\nimport type { GrantRow } from '../shared/models';\n\n/** Read or write on one environment, and when it ends: an ISO instant, or null for never. */\nexport type EnvironmentAccess = { role: Extract<Role, 'viewer' | 'developer'>; expiresAt: string | null };\n\n/**\n * What one project is set to in a principal's access editor: nothing, owner,\n * read or write everywhere, or read or write per environment. Every grant the\n * plan asks for carries its own expiry.\n *\n * `custom` is for grants that do not fit that shape -- an auditor grant, or\n * read everywhere plus write on one environment. The editor shows them and\n * leaves them alone unless another setting is picked.\n */\nexport type AccessPlan = {\n level: 'none' | Extract<Role, 'owner' | 'viewer' | 'developer'> | 'env' | 'custom';\n /** When the project-wide level ends. */\n expiresAt: string | null;\n /** Environments without an entry get no access. */\n environments: Record<string, EnvironmentAccess>;\n};\n\nexport type HeldGrant = Pick<\n GrantRow,\n 'id' | 'role' | 'roleName' | 'environmentSlug' | 'expiresAt'\n>;\n\nexport type AccessChange =\n | { kind: 'create'; role: string; environmentSlug: string | null; expiresAt: string | null }\n | { kind: 'expiry'; grant: HeldGrant; expiresAt: string | null }\n | { kind: 'revoke'; grant: HeldGrant };\n\n/** An environment's access in a plan; slugs like `constructor` are not inherited. */\nexport function environmentAccess(plan: AccessPlan, slug: string): EnvironmentAccess | null {\n return Object.hasOwn(plan.environments, slug) ? plan.environments[slug] : null;\n}\n\n/**\n * Read what a principal holds on a project back into the editor's terms.\n * `environments` are the ones the editor can set: live, and not archived.\n */\nexport function planFromGrants(\n grants: readonly HeldGrant[],\n environments: readonly string[],\n): AccessPlan {\n if (grants.length === 0) return { level: 'none', expiresAt: null, environments: {} };\n\n const [only] = grants;\n if (\n grants.length === 1 &&\n only.environmentSlug === null &&\n (only.role === 'owner' || only.role === 'viewer' || only.role === 'developer')\n ) {\n return { level: only.role, expiresAt: only.expiresAt, environments: {} };\n }\n\n const perEnvironment: Record<string, EnvironmentAccess> = {};\n for (const grant of grants) {\n const slug = grant.environmentSlug;\n if (\n slug === null ||\n !environments.includes(slug) ||\n Object.hasOwn(perEnvironment, slug) ||\n (grant.role !== 'viewer' && grant.role !== 'developer')\n ) {\n return { level: 'custom', expiresAt: null, environments: {} };\n }\n perEnvironment[slug] = { role: grant.role, expiresAt: grant.expiresAt };\n }\n return { level: 'env', expiresAt: null, environments: perEnvironment };\n}\n\n/**\n * Switch a plan's level. Going from read or write everywhere to per\n * environment starts every environment at that level and expiry, so the\n * switch alone keeps the same reach.\n */\nexport function withLevel(\n plan: AccessPlan,\n level: AccessPlan['level'],\n environments: readonly string[],\n): AccessPlan {\n if (\n level === 'env' &&\n (plan.level === 'viewer' || plan.level === 'developer') &&\n Object.keys(plan.environments).length === 0\n ) {\n const access = { role: plan.level, expiresAt: plan.expiresAt };\n return {\n ...plan,\n level,\n environments: Object.fromEntries(environments.map((slug) => [slug, access])),\n };\n }\n return { ...plan, level };\n}\n\n/** Set one environment's access, or take it away with `null`. */\nexport function withEnvironment(\n plan: AccessPlan,\n slug: string,\n access: EnvironmentAccess | null,\n): AccessPlan {\n const environments = { ...plan.environments };\n if (access === null) delete environments[slug];\n else environments[slug] = access;\n return { ...plan, environments };\n}\n\nfunction grantsFor(\n plan: AccessPlan,\n): { role: string; environmentSlug: string | null; expiresAt: string | null }[] {\n switch (plan.level) {\n case 'none':\n case 'custom':\n return [];\n case 'owner':\n case 'viewer':\n case 'developer':\n return [{ role: plan.level, environmentSlug: null, expiresAt: plan.expiresAt }];\n case 'env':\n return Object.entries(plan.environments).map(([environmentSlug, access]) => ({\n environmentSlug,\n ...access,\n }));\n }\n}\n\n/** The server and the date field spell the same instant differently. */\nfunction sameExpiry(a: string | null, b: string | null): boolean {\n return a === b || (a !== null && b !== null && Date.parse(a) === Date.parse(b));\n}\n\n/**\n * The changes that take what is held to the plan: grants to create, grants\n * whose expiry moves, and grants to revoke, in that order. Asking for what is\n * already held yields nothing, so applying the same plan twice is a no-op.\n */\nexport function accessChanges(grants: readonly HeldGrant[], plan: AccessPlan): AccessChange[] {\n if (plan.level === 'custom') return [];\n\n const key = (grant: { role: string; environmentSlug: string | null }) =>\n `${grant.role}@${grant.environmentSlug ?? ''}`;\n const wanted = new Map(grantsFor(plan).map((grant) => [key(grant), grant]));\n const held = new Map(grants.map((grant) => [key(grant), grant]));\n\n const changes: AccessChange[] = [];\n for (const [id, grant] of wanted) {\n if (!held.has(id)) changes.push({ kind: 'create', ...grant });\n }\n for (const [id, grant] of held) {\n const want = wanted.get(id);\n if (want !== undefined && !sameExpiry(grant.expiresAt, want.expiresAt)) {\n changes.push({ kind: 'expiry', grant, expiresAt: want.expiresAt });\n }\n }\n for (const [id, grant] of held) {\n if (!wanted.has(id)) changes.push({ kind: 'revoke', grant });\n }\n return changes;\n}\n\n/**\n * The changes as the API's access patch for one project: each place it\n * touches, and the role to hold there until when, or `null` for none.\n *\n * { \"market\": null, \"market/dev\": { \"role\": \"developer\", \"until\": \"2026-12-31T23:59:59.000Z\" } }\n *\n * A place holds one role, so where a level changes, the revoke of the old\n * role and the create of the new land on the same place, and the new role\n * wins: the server replaces one with the other, never passing through none.\n */\nexport function accessPatch(project: string, changes: readonly AccessChange[]): Record<string, AccessValue> {\n const place = (environmentSlug: string | null) =>\n environmentSlug === null ? project : `${project}/${environmentSlug}`;\n const holding = (role: string, expiresAt: string | null): AccessValue =>\n expiresAt === null ? (role as Role) : { role: role as Role, until: expiresAt };\n\n const patch: Record<string, AccessValue> = {};\n for (const change of changes) {\n if (change.kind === 'revoke') patch[place(change.grant.environmentSlug)] = null;\n }\n for (const change of changes) {\n if (change.kind === 'expiry') patch[place(change.grant.environmentSlug)] = holding(change.grant.role, change.expiresAt);\n if (change.kind === 'create') patch[place(change.environmentSlug)] = holding(change.role, change.expiresAt);\n }\n return patch;\n}\n\n/** A date field's value as the instant access ends: the close of that day, UTC. */\nexport function expiryFromDate(date: string): string | null {\n return date === '' ? null : new Date(`${date}T23:59:59Z`).toISOString();\n}\n\n/** A date field's value for an expiry. Expiries are shown as UTC dates everywhere. */\nexport function dateFromExpiry(expiresAt: string | null): string {\n return expiresAt === null ? '' : expiresAt.slice(0, 10);\n}\n","import { dateFromExpiry, expiryFromDate } from '../lib/access-plan';\nimport { X } from './icons';\n\n/**\n * When one grant ends, as a date: access lasts through that day, UTC. Blank\n * reads \"Never\" where the browser lets the empty field be restyled.\n */\nexport function ExpiryField({\n label,\n expiresAt,\n onChange,\n}: {\n label: string;\n expiresAt: string | null;\n onChange: (expiresAt: string | null) => void;\n}) {\n const date = dateFromExpiry(expiresAt);\n return (\n <span className={`expiry${date === '' ? ' is-never' : ''}`}>\n <input\n className=\"input select-sm\"\n type=\"date\"\n aria-label={label}\n min={new Date().toISOString().slice(0, 10)}\n value={date}\n onChange={(event) => onChange(expiryFromDate(event.target.value))}\n />\n <span className=\"expiry-never\" aria-hidden=\"true\">\n Never\n </span>\n <button\n className=\"btn btn-quiet btn-sm btn-icon\"\n type=\"button\"\n aria-label={`${label}: never`}\n title=\"Never expires\"\n onClick={() => onChange(null)}\n >\n <X size={12} />\n </button>\n </span>\n );\n}\n","import { useState } from 'react';\nimport { useQueryClient, useSuspenseQuery } from '@tanstack/react-query';\nimport { Link, Outlet } from '@tanstack/react-router';\nimport { INSTANCE_ROLES, ROLE_NAMES, ROLES, scopeInWords, unscoped, type Role } from '@coffre/core/access';\nimport { useShell } from '../lib/use-shell';\nimport { toast } from 'sonner';\nimport { memberRef, useCoffre } from '../lib/coffre';\nimport { directoryList, revokeMemberToken } from '../lib/changes';\nimport { affects, hasAppsTab, keys, listsAccess, managedProjects, queries, signInWays } from '../lib/queries';\nimport { useChangeStatus } from '../lib/use-change';\nimport { useMounted } from '../lib/mounted';\nimport { ItemFailure } from './row-state';\nimport { useAction } from '../lib/use-action';\nimport { accessRows, projectAccessLabel, type ProjectAccess } from '../lib/project-access';\nimport { givable, serviceProjects } from '../lib/service-setup';\nimport {\n accessChanges,\n accessPatch,\n dateFromExpiry,\n environmentAccess,\n expiryFromDate,\n planFromGrants,\n withEnvironment,\n withLevel,\n type AccessChange,\n type AccessPlan,\n} from '../lib/access-plan';\nimport type { MemberAccess, TokenRow } from '@coffre/client';\nimport type { DirectoryPrincipal, ProjectSummary } from '../shared/models';\nimport { ClosedDoor, PageHeader } from './page';\nimport { EmptyState, ErrorLine, Modal, Notice, Spinner } from './ui';\nimport { GrantRowView, GrantsTable } from './grants';\nimport { ExpiryField } from './expiry-field';\nimport { InstanceRole, KIND, PrincipalActions } from './directory';\nimport { PrincipalReportCards, RemovedNotice } from './offboarding';\nimport { PersonalTokensCard } from './personal-tokens';\nimport { PrincipalAvatar } from './principal';\nimport { Tile } from './tile';\nimport { Activity, Archive, Clock, Folder, Key, Link as LinkIcon, Pencil, Users, X } from './icons';\nimport { PageTabs } from './tabs';\n\ntype PrincipalType = DirectoryPrincipal['principalType'];\n\n/** The roles you may give at a project, or one of its environments: any where you manage access (`givable`). */\ntype Offers = (project: ProjectSummary, environment: string | null) => readonly Role[];\n\n/** Who a user or service account is to the instance, as an owner reads it; null for anyone else. */\nfunction useReport(principalType: PrincipalType, principalId: string) {\n const { capabilities } = useShell();\n return useSuspenseQuery(queries.report(useCoffre(), memberRef(principalType, principalId), capabilities.runsInstance)).data;\n}\n\n/**\n * What `loadAccess` read in one request: their role and scope, and, for each\n * project where you manage access, the grants they hold there. For a\n * service account you manage, each project where you may give it\n * something, and what (`offers`).\n */\nfunction useMemberAccess(principalType: PrincipalType, principalId: string): {\n access: MemberAccess | null;\n error: string | null;\n projects: ProjectAccess[];\n offers: Offers;\n} {\n const shell = useShell();\n const { data } = useSuspenseQuery(queries.memberAccess(useCoffre(), memberRef(principalType, principalId), listsAccess(shell)));\n const error = data !== null && !data.ok ? data.error : null;\n const access = data?.ok === true ? data : null;\n const yours = principalType === 'service' && access?.managed === true;\n const listed = yours ? serviceProjects(shell) : managedProjects(shell.projects);\n return {\n access,\n error,\n offers: yours ? (project, environment) => givable(shell, project, environment) : () => ROLE_NAMES,\n projects: listed.map((project) => ({\n project,\n grants: (access?.grants ?? []).filter((grant) => grant.project === project.slug).map((grant) => ({\n id: grant.id,\n principalType,\n principalId,\n role: grant.role,\n roleName: grant.roleName,\n permissions: grant.permissions,\n scope: grant.environment === null ? 'project' : 'environment',\n environmentSlug: grant.environment,\n expiresAt: grant.expiresAt,\n })),\n grantsError: error,\n })),\n };\n}\n\n/**\n * A user's or service account's page: who it is, its menu, and its tabs,\n * each a page of its own under this one. Access is a user's first tab; a\n * service account's is how it signs in, while it shows one. A tab the\n * deployment left out is not offered.\n */\nexport function PrincipalLayout({ principalType, principalId }: { principalType: PrincipalType; principalId: string }) {\n const shell = useShell();\n const mounted = useMounted();\n const { capabilities } = shell;\n const report = useReport(principalType, principalId);\n // A service account you manage, though you do not run the instance: what it holds, from its access.\n const { data: held } = useSuspenseQuery(queries.memberAccess(useCoffre(), memberRef(principalType, principalId), listsAccess(shell)));\n const yours = principalType === 'service' && held?.ok === true && held.managed;\n // A role change or removal made from this page's menu, refused.\n const { status, dismiss } = useChangeStatus(directoryList.queryKey);\n const change = status(memberRef(principalType, principalId));\n const kind = KIND[principalType];\n const people = principalType === 'user';\n const found = report?.ok === true ? report.report : null;\n const removed = found?.status === 'removed';\n const entry =\n found !== null && !removed\n ? {\n principalType,\n principalId,\n instanceRole: found.instanceRole,\n scope: found.scope,\n tampered: found.status === 'tampered',\n managed: principalType === 'service',\n declared: found.declared,\n }\n : yours\n ? { principalType, principalId, instanceRole: 'member' as const, scope: null, tampered: false, managed: true }\n : undefined;\n\n // Owners get a report about anyone ever registered, removed or not, so a\n // miss there means there is no such user. Everyone else only reaches this\n // page through projects they manage, or a service account they manage.\n const unknown = report?.ok === true && found === null;\n if (unknown || (report === null && managedProjects(shell.projects).length === 0 && !yours)) {\n return (\n <ClosedDoor\n icon={people ? <Users size={18} /> : <Key size={18} />}\n label={<span className=\"mono\">{people ? principalId : `service:${principalId}`}</span>}\n title={people ? 'No such user for you' : 'No such service account for you'}\n actions={\n <Link className=\"btn\" to={people ? '/users' : '/service-accounts'}>\n All {people ? 'users' : 'service accounts'}\n </Link>\n }\n >\n {report === null\n ? `A ${kind}'s page lists its access to the projects where you manage access, and you manage none.`\n : `No ${kind} by that name has ever been registered here.`}\n </ClosedDoor>\n );\n }\n\n const access = (\n <>\n {removed ? <Archive size={15} /> : <Folder size={15} />}\n {removed ? 'Offboarding' : 'Access'}\n </>\n );\n const activity = (\n <>\n <Activity size={15} />\n Activity\n </>\n );\n const tabs = people\n ? [\n <Link key=\"access\" to=\"/users/$user\" params={{ user: principalId }} activeOptions={{ exact: true, includeSearch: false }}>\n {access}\n </Link>,\n // Only an owner reads the report that lists them; removal disconnects them.\n hasAppsTab(shell, report) && mounted('/users/$user/apps') && (\n <Link key=\"apps\" to=\"/users/$user/apps\" params={{ user: principalId }}>\n <LinkIcon size={15} />\n Connected apps\n </Link>\n ),\n capabilities.canReadAudit && mounted('/users/$user/activity') && (\n <Link key=\"activity\" to=\"/users/$user/activity\" params={{ user: principalId }}>\n {activity}\n </Link>\n ),\n ]\n : [\n signInWays(shell, held) !== null && (\n <Link key=\"sign-in\" to=\"/service-accounts/$account\" params={{ account: principalId }} activeOptions={{ exact: true, includeSearch: false }}>\n <LinkIcon size={15} />\n Sign-in\n </Link>\n ),\n mounted('/service-accounts/$account/access') && (\n <Link key=\"access\" to=\"/service-accounts/$account/access\" params={{ account: principalId }}>\n {access}\n </Link>\n ),\n capabilities.canReadAudit && mounted('/service-accounts/$account/activity') && (\n <Link key=\"activity\" to=\"/service-accounts/$account/activity\" params={{ account: principalId }}>\n {activity}\n </Link>\n ),\n ];\n\n return (\n <>\n <PageHeader\n lead={<PrincipalAvatar type={principalType} id={principalId} size=\"lg\" />}\n title={principalType === 'service' ? `service:${principalId}` : principalId}\n description={\n principalType === 'service'\n ? 'A service account: an identity for CI and other automation.'\n : undefined\n }\n meta={\n removed ? (\n <span className=\"tag tag-red\">Removed</span>\n ) : (\n entry?.principalType === 'user' && <InstanceRole principal={entry} />\n )\n }\n actions={entry !== undefined && <PrincipalActions principal={entry} trigger=\"btn btn-icon\" />}\n />\n\n {change.state === 'failed' && (\n <div className=\"report-notice\">\n <ItemFailure status={change} onDismiss={() => dismiss(change.mutationId)} />\n </div>\n )}\n {report?.ok === false && (\n <div className=\"report-notice\">\n <Notice tone=\"bad\">{report.error}</Notice>\n </div>\n )}\n <PageTabs label={people ? 'User sections' : 'Service account sections'}>{tabs}</PageTabs>\n\n <Outlet />\n </>\n );\n}\n\n/**\n * A user's or service account's Access tab: its grants on every project\n * where you manage access, and on every project; once it is removed, what\n * its offboarding did instead.\n */\nexport function PrincipalAccess({ principalType, principalId }: { principalType: PrincipalType; principalId: string }) {\n const report = useReport(principalType, principalId);\n const { access: held, error, projects: access, offers } = useMemberAccess(principalType, principalId);\n const kind = KIND[principalType];\n const people = principalType === 'user';\n const found = report?.ok === true ? report.report : null;\n const removed = found?.status === 'removed';\n\n // One request, so one error, said once in place of the rows (`UnreadAccess`).\n const rows = accessRows(access).flatMap((row) => (row.grant === null ? [] : [row]));\n // Grants to someone removed are refused until they are added back.\n const editable = removed\n ? []\n : access.filter(\n ({ project, grantsError }) => project.archivedAt === null && grantsError === null,\n );\n\n return (\n <>\n {removed && found !== null && <RemovedNotice report={found} />}\n\n {/* Removal ends every grant, so there is no access left to show. */}\n {!removed && (\n <>\n {people && held !== null && <InstanceRoleNote access={held} />}\n\n <section className=\"card\" aria-label=\"Project access\">\n {error !== null ? (\n <UnreadAccess member={memberRef(principalType, principalId)} error={error} />\n ) : rows.length === 0 ? (\n <EmptyState title=\"No project access yet\">\n {editable.length > 0 ? undefined : `None of the projects where you manage access has a grant for this ${kind}.`}\n </EmptyState>\n ) : (\n <GrantsTable\n lead={\n <span className=\"th\">\n <Folder size={14} />\n Project\n </span>\n }\n >\n {rows.map(({ project, grant }, index) => (\n <GrantRowView\n key={grant.id}\n number={index + 1}\n project={project.slug}\n grant={grant}\n leadLabel=\"Project\"\n lead={\n <span className=\"cell-project\">\n <Tile name={project.slug} />\n <Link\n className=\"cell-link\"\n to={people ? '/projects/$project/users' : '/projects/$project/service-accounts'}\n params={{ project: project.slug }}\n >\n {project.slug}\n </Link>\n {project.archivedAt !== null && <span className=\"tag tag-red\">Archived</span>}\n </span>\n }\n />\n ))}\n </GrantsTable>\n )}\n </section>\n\n {editable.length > 0 && (\n <div className=\"table-actions\">\n <EditAccess principalType={principalType} principalId={principalId} access={editable} offers={offers} />\n </div>\n )}\n\n {!(held?.managed === true && principalType === 'service') && (\n <p className=\"hint section-foot\">Only projects where you manage access are listed.</p>\n )}\n\n </>\n )}\n\n {found !== null && <PrincipalReportCards report={found} />}\n {/* A report from an instance before 0.7, mid-deploy or rolled back, lists none. */}\n {found !== null && !removed && (found.personalTokens ?? []).length > 0 && (\n <MemberPersonalTokens member={memberRef(principalType, principalId)} tokens={found.personalTokens} />\n )}\n </>\n );\n}\n\n/** A person's personal tokens, for whoever runs the instance, who reads their report and may revoke any of them. */\nfunction MemberPersonalTokens({ member, tokens }: { member: string; tokens: TokenRow[] }) {\n return (\n <PersonalTokensCard\n tokens={tokens}\n change={revokeMemberToken(useCoffre(), member)}\n description=\"Tokens they made, each acting as them within what it reaches. Removing them from coffre revokes every one.\"\n />\n );\n}\n\n/** What a person's instance role gives them, above the grants that add to it: nothing for a Member. */\nfunction InstanceRoleNote({ access }: { access: MemberAccess }) {\n if (access.instanceRole === 'member') return null;\n const { name } = INSTANCE_ROLES[access.instanceRole];\n return (\n <div className=\"report-notice\">\n <Notice tone=\"info\">\n <strong>{name}</strong>\n {access.scope === null ? '' : unscoped(access.scope) ? ' in every project' : `: ${scopeInWords(access.scope)}`}, from their instance role. The\n grants below add to it.\n </Notice>\n </div>\n );\n}\n\n/** Their access could not be read: why, and another try, never an empty list that reads as no access. */\nfunction UnreadAccess({ member, error }: { member: string; error: string }) {\n const queryClient = useQueryClient();\n const [retrying, setRetrying] = useState(false);\n return (\n <div className=\"row-failure-line unread-access\">\n <ErrorLine error={`Their access could not be read. ${error}`} />\n <button\n type=\"button\"\n className=\"act\"\n disabled={retrying}\n onClick={() => {\n setRetrying(true);\n void queryClient.refetchQueries({ queryKey: keys.memberAccess(member) }).finally(() => setRetrying(false));\n }}\n >\n {retrying && <Spinner size={13} />}\n Retry\n </button>\n </div>\n );\n}\n\n/**\n * One principal's access to every project you manage, edited in one place.\n *\n * Each project opens set to what the principal holds: a project-wide level,\n * or read or write per environment, each with its own expiry. Saving sends\n * only the difference, every project in one `access.set`: the server applies\n * all of it in one transaction, or none of it.\n */\nfunction EditAccess({\n principalType,\n principalId,\n access,\n offers,\n}: {\n principalType: PrincipalType;\n principalId: string;\n access: ProjectAccess[];\n offers: Offers;\n}) {\n const coffre = useCoffre();\n const [open, setOpen] = useState(false);\n const [edits, setEdits] = useState<Record<string, AccessPlan>>({});\n const { pending, error, setError, run } = useAction();\n const kind = KIND[principalType];\n\n const rows = access.map(({ project, grants }) => {\n const environments = project.environments\n .filter(\n // Your personal config takes no grant: it is no place to give access to.\n (environment) => environment.details !== null && environment.details.archivedAt === null && !environment.personal,\n )\n .map((environment) => environment.slug);\n const held = planFromGrants(grants, environments);\n const plan = Object.hasOwn(edits, project.slug) ? edits[project.slug] : held;\n // What you may give here: every role where you manage access; a service account you manage, what you hold.\n const whole = offers(project, null);\n const each = Object.fromEntries(environments.map((slug) => [slug, offers(project, slug)]));\n return { project, grants, environments, held, plan, whole, each, changes: accessChanges(grants, plan) };\n });\n const changed = rows.filter((row) => row.changes.length > 0);\n\n function close() {\n setOpen(false);\n setEdits({});\n setError(null);\n }\n\n return (\n <>\n <button className=\"btn btn-primary\" onClick={() => setOpen(true)}>\n <Pencil size={14} />\n Edit access\n </button>\n\n <Modal\n open={open}\n onOpenChange={(next) => (next ? setOpen(true) : close())}\n title={\n <>\n Edit access for <span className=\"mono\">{principalId}</span>\n </>\n }\n description={`Set what this ${kind} can reach on each project you ${principalType === 'service' ? 'may give it access to' : 'manage'}, and until when.`}\n wide\n >\n <form\n className=\"form\"\n onSubmit={(event) => {\n event.preventDefault();\n run(\n () =>\n coffre.access.set(\n memberRef(principalType, principalId),\n Object.assign({}, ...changed.map(({ project, changes }) => accessPatch(project.slug, changes))),\n ),\n {\n affects: changed.flatMap(({ project }) =>\n affects.access(project.slug, memberRef(principalType, principalId)),\n ),\n onSuccess: () => {\n toast.success(\n `Updated ${principalId}’s access on ${changed.length} project${changed.length === 1 ? '' : 's'}`,\n );\n close();\n },\n },\n );\n }}\n >\n <ul className=\"plan-list\">\n <li className=\"plan-head\" aria-hidden=\"true\">\n <span>Project</span>\n <span>Access</span>\n <span>Expires</span>\n </li>\n {rows.map(({ project, grants, environments, held, plan, whole, each, changes }) => {\n const id = `plan-${project.slug}`;\n const edit = (next: AccessPlan) =>\n setEdits((current) => ({ ...current, [project.slug]: next }));\n return (\n <li\n key={project.slug}\n className={`plan-row${changes.length > 0 ? ' is-changed' : ''}`}\n >\n <label className=\"plan-project\" htmlFor={id}>\n <Tile name={project.slug} />\n <span className=\"plan-project-text\">\n <span className=\"plan-project-name\">{project.slug}</span>\n {held.level === 'custom' && (\n <span className=\"plan-project-held\">\n Holds {grants.map((grant) => projectAccessLabel(grant)).join(', ')}\n </span>\n )}\n </span>\n </label>\n <select\n id={id}\n className=\"select select-sm\"\n value={plan.level}\n onChange={(event) =>\n edit(\n withLevel(plan, event.target.value as AccessPlan['level'], environments),\n )\n }\n >\n {held.level === 'custom' && <option value=\"custom\">Keep as is</option>}\n <option value=\"none\">No access</option>\n {whole.includes('owner') && <option value=\"owner\">{ROLES.owner.name}</option>}\n {whole.includes('viewer') && <option value=\"viewer\">{ROLES.viewer.name}: all</option>}\n {whole.includes('developer') && <option value=\"developer\">{ROLES.developer.name}: all</option>}\n {environments.some((slug) => each[slug]!.length > 0) && <option value=\"env\">Per environment…</option>}\n </select>\n {(plan.level === 'owner' ||\n plan.level === 'viewer' ||\n plan.level === 'developer') && (\n <ExpiryField\n label={`${project.slug} expires`}\n expiresAt={plan.expiresAt}\n onChange={(expiresAt) => edit({ ...plan, expiresAt })}\n />\n )}\n\n {plan.level === 'env' && (\n <ul className=\"plan-envs\" aria-label={`Environments of ${project.slug}`}>\n {environments.map((slug) => {\n const current = environmentAccess(plan, slug);\n return (\n <li key={slug} className=\"plan-env\">\n <label className=\"mono\" htmlFor={`${id}-${slug}`}>\n {slug}\n </label>\n <select\n id={`${id}-${slug}`}\n className=\"select select-sm\"\n value={current?.role ?? ''}\n onChange={(event) => {\n const role = event.target.value;\n edit(\n withEnvironment(\n plan,\n slug,\n role === 'viewer' || role === 'developer'\n ? { role, expiresAt: current?.expiresAt ?? null }\n : null,\n ),\n );\n }}\n >\n <option value=\"\">No access</option>\n {each[slug]!.includes('viewer') && <option value=\"viewer\">{ROLES.viewer.name}</option>}\n {each[slug]!.includes('developer') && <option value=\"developer\">{ROLES.developer.name}</option>}\n </select>\n {current !== null && (\n <ExpiryField\n label={`${slug} of ${project.slug} expires`}\n expiresAt={current.expiresAt}\n onChange={(expiresAt) =>\n edit(withEnvironment(plan, slug, { ...current, expiresAt }))\n }\n />\n )}\n </li>\n );\n })}\n </ul>\n )}\n\n {changes.length > 0 && (\n <ul className=\"plan-changes\" aria-label={`Changes to ${project.slug}`}>\n {changes.map((change) => (\n <li\n key={\n change.kind === 'create'\n ? `+${change.role}@${change.environmentSlug ?? ''}`\n : change.grant.id\n }\n >\n <AccessChangeTag change={change} />\n </li>\n ))}\n </ul>\n )}\n </li>\n );\n })}\n </ul>\n\n <ErrorLine error={error} />\n\n <div className=\"dialog-actions\">\n <button className=\"btn\" type=\"button\" onClick={close}>\n Cancel\n </button>\n <button\n className=\"btn btn-primary\"\n type=\"submit\"\n disabled={pending || changed.length === 0}\n >\n {pending && <Spinner />}\n Save changes\n </button>\n </div>\n </form>\n </Modal>\n </>\n );\n}\n\nfunction AccessChangeTag({ change }: { change: AccessChange }) {\n const until = (expiresAt: string | null) =>\n expiresAt === null ? '' : ` until ${dateFromExpiry(expiresAt)}`;\n switch (change.kind) {\n case 'create':\n return (\n <span className=\"tag tag-green\">\n <span aria-hidden=\"true\">+</span>\n <span className=\"visually-hidden\">Adds</span>\n {projectAccessLabel({ ...change, roleName: change.role })}\n {until(change.expiresAt)}\n </span>\n );\n case 'expiry':\n return (\n <span className=\"tag tag-blue\">\n <Clock size={12} />\n <span className=\"visually-hidden\">Moves the expiry of</span>\n {projectAccessLabel(change.grant)}\n {change.expiresAt === null ? ', no expiry' : until(change.expiresAt)}\n </span>\n );\n case 'revoke':\n return (\n <span className=\"tag tag-red\">\n <span aria-hidden=\"true\">−</span>\n <span className=\"visually-hidden\">Removes</span>\n {projectAccessLabel(change.grant)}\n </span>\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAQA,IAAM,YAAY;;;;;;AAOlB,SAAgB,WAAW,EAAE,UAA8B;CACzD,MAAM,SAAS,UAAU;CACzB,MAAM,MAAM,iBAAiB;EAC3B,UAAU;GAAC,GAAG,KAAK;GAAO;GAAS;EAAM;EACzC,WAAW;EACX,kBAAkB,KAAA;EAClB,UAAU,EAAE,gBACV,eAAe,OAAO,MAAM,KAAK;GAAE,OAAO;GAAQ,OAAO;GAAW,QAAQ;EAAU,CAAC,CAAC;EAE1F,mBAAmB,SACjB,KAAK,MAAM,KAAK,QAAQ,KAAK,QAAQ,SAAS,IAAI,KAAK,QAAQ,GAAG,EAAE,CAAC,CAAE,MAAM,KAAA;CACjF,CAAC;CAED,IAAI,IAAI,WACN,OACE,qBAAC,KAAD;EAAG,WAAU;YAAb,CACE,oBAAC,SAAD,EAAS,MAAM,GAAK,CAAA,GAAC,mBACpB;;CAGP,MAAM,SAAS,IAAI,MAAM,MAAM,MAAM,SAAS,CAAC,KAAK,EAAE;CACtD,IAAI,WAAW,KAAA,KAAa,CAAC,OAAO,IAAI,OAAO,oBAAC,QAAD;EAAQ,MAAK;YAAO,OAAO;CAAc,CAAA;CAExF,MAAM,QAAQ,OADG,IAAI,MAAM,SAAS,CAAC,EAAA,CAAG,SAAS,SAAU,KAAK,KAAK,KAA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@ -2,7 +2,7 @@ import { v as queries } from "../chunks/queries-epz4MIuW.js";
|
|
|
2
2
|
import { c as Notice, f as Toggletip, i as EmptyState, l as Spinner, m as absolute, u as Timestamp } from "../chunks/ui-2kwXXfrX.js";
|
|
3
3
|
import { $ as SlashCircle, P as Ledger, S as Clock, X as ShieldCheck, b as ChevronRight, f as Activity, i as PageHeader, it as User, j as Info, m as AlertTriangle, n as ClosedDoor, st as X, u as useCoffre } from "../chunks/page-JTORvh-N.js";
|
|
4
4
|
import { t as pageRoute } from "../chunks/page-route-Drfw7lmn.js";
|
|
5
|
-
import { a as lines, c as who, i as describe, n as memberName, o as perSecret, r as decidedBy, s as runLabel, t as Sentence } from "../chunks/audit-sentence-
|
|
5
|
+
import { a as lines, c as who, i as describe, n as memberName, o as perSecret, r as decidedBy, s as runLabel, t as Sentence } from "../chunks/audit-sentence-C_wMpAqr.js";
|
|
6
6
|
import { useState } from "react";
|
|
7
7
|
import { Link } from "@tanstack/react-router";
|
|
8
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -7,7 +7,7 @@ import { A as revokeCredential, T as removeBinding, n as useChangeStatus, t as u
|
|
|
7
7
|
import { t as pageRoute } from "../chunks/page-route-Drfw7lmn.js";
|
|
8
8
|
import { t as useAction } from "../chunks/use-action-BB-RcHo1.js";
|
|
9
9
|
import { t as MultiCombobox } from "../chunks/multi-combobox-CsIXihuc.js";
|
|
10
|
-
import { n as PrincipalLayout, r as ActionsLog, t as PrincipalAccess } from "../chunks/principal-page-
|
|
10
|
+
import { n as PrincipalLayout, r as ActionsLog, t as PrincipalAccess } from "../chunks/principal-page-Cv5PheS9.js";
|
|
11
11
|
import { Fragment, useEffect, useId, useState } from "react";
|
|
12
12
|
import { ROLES, ROLE_NAMES, assignableToEnvironment, credentialScopeInWords } from "@coffre/core/access";
|
|
13
13
|
import { Autocomplete } from "@base-ui/react/autocomplete";
|
package/dist/pages/user.js
CHANGED
|
@@ -4,7 +4,7 @@ import { t as useShell } from "../chunks/use-shell-C_NmvCt_.js";
|
|
|
4
4
|
import { p as disconnectMemberApp } from "../chunks/use-change-CQyDpCqw.js";
|
|
5
5
|
import { t as ConnectedAppsCard } from "../chunks/connected-apps-Bn5rEoV2.js";
|
|
6
6
|
import { t as pageRoute } from "../chunks/page-route-Drfw7lmn.js";
|
|
7
|
-
import { n as PrincipalLayout, r as ActionsLog, t as PrincipalAccess } from "../chunks/principal-page-
|
|
7
|
+
import { n as PrincipalLayout, r as ActionsLog, t as PrincipalAccess } from "../chunks/principal-page-Cv5PheS9.js";
|
|
8
8
|
import { jsx } from "react/jsx-runtime";
|
|
9
9
|
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
10
10
|
//#region src/pages/user.tsx
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coffre/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "coffre's pages, for a deployment's own TanStack Start app: its router, and a Vite plugin for its build.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"@tanstack/router-core": "1.171.15",
|
|
45
45
|
"lucide-react": "1.47.0",
|
|
46
46
|
"sonner": "2.0.7",
|
|
47
|
-
"@coffre/client": "0.
|
|
48
|
-
"@coffre/core": "0.
|
|
47
|
+
"@coffre/client": "0.8.1",
|
|
48
|
+
"@coffre/core": "0.8.1"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@tanstack/react-query": "5.103.1",
|
|
@@ -194,6 +194,9 @@ const READ_VERBS: Record<string, [did: string, tried: string]> = {
|
|
|
194
194
|
run: ['ran', 'run'],
|
|
195
195
|
compare: ['compared', 'compare'],
|
|
196
196
|
copy: ['copied', 'copy'],
|
|
197
|
+
// The credential proxy's: a value injected into a request for its person, or one handed to their app.
|
|
198
|
+
use: ['used', 'use'],
|
|
199
|
+
expose: ['was given', 'be given'],
|
|
197
200
|
};
|
|
198
201
|
|
|
199
202
|
function readVerb({ entry }: Facts): [string, string] {
|
|
@@ -252,6 +255,12 @@ const TEMPLATES: Record<string, Template> = {
|
|
|
252
255
|
then: ({ entry, batch }) =>
|
|
253
256
|
batch.length > 1 || entry.version === null || entry.version === 1 ? [] : [`, now version ${entry.version}`],
|
|
254
257
|
},
|
|
258
|
+
// The credential proxy's own entry beside the vault's read: which credential the keys went into, and where.
|
|
259
|
+
'credential.use': {
|
|
260
|
+
did: ({ entry }) => (entry.metadata.purpose === 'expose' ? 'was given the values of' : 'used the credential'),
|
|
261
|
+
tried: ({ entry }) => (entry.metadata.purpose === 'expose' ? 'be given the values of' : 'use the credential'),
|
|
262
|
+
what: ({ entry }) => [text(entry.metadata.credential) ?? '', ...(text(entry.metadata.host) === null ? [] : [` on ${text(entry.metadata.host)}`])],
|
|
263
|
+
},
|
|
255
264
|
'secret.restore': {
|
|
256
265
|
did: 'restored',
|
|
257
266
|
tried: 'restore',
|
|
@@ -438,8 +447,8 @@ const TEMPLATES: Record<string, Template> = {
|
|
|
438
447
|
sign_out: { did: 'signed out', tried: 'sign out', what: () => [] },
|
|
439
448
|
// A personal token is its person's own, and named by its label; a bearer token is a service account's.
|
|
440
449
|
'token.create': {
|
|
441
|
-
did: ({ entry }) => (personal(entry) ? 'made a personal token' : 'issued a bearer token to'),
|
|
442
|
-
tried: ({ entry }) => (personal(entry) ? 'make a personal token' : 'issue a bearer token to'),
|
|
450
|
+
did: ({ entry }) => (entry.metadata.kind === 'handle' ? 'made a handle' : personal(entry) ? 'made a personal token' : 'issued a bearer token to'),
|
|
451
|
+
tried: ({ entry }) => (entry.metadata.kind === 'handle' ? 'make a handle' : personal(entry) ? 'make a personal token' : 'issue a bearer token to'),
|
|
443
452
|
what: ({ entry }) => (personal(entry) ? labelled(entry) : subject(entry)),
|
|
444
453
|
then: ({ entry }) => reaching(entry),
|
|
445
454
|
},
|
|
@@ -585,6 +594,7 @@ const TAMPERING: Record<string, string> = {
|
|
|
585
594
|
const REASONS: Record<string, string> = {
|
|
586
595
|
no_grant: 'no grant',
|
|
587
596
|
bulk_limit: 'bulk limit',
|
|
597
|
+
stand_ins: 'people get stand-ins',
|
|
588
598
|
expired: 'grant expired',
|
|
589
599
|
removed: 'removed from coffre',
|
|
590
600
|
not_a_member: 'not a member',
|
package/src/parity.ts
CHANGED
|
@@ -133,6 +133,7 @@ export const UI_PARITY: { [K in RouteKey]: Reach } = {
|
|
|
133
133
|
'DELETE /members/:member': { ui: [{ does: 'a user or service account › ⋯ › Remove…', in: 'components/directory.tsx', call: 'members.remove' }] },
|
|
134
134
|
'GET /members/:member/tokens': { ui: [{ does: 'a service account › Sign-in › Bearer tokens', in: 'components/service-tokens.tsx', call: 'tokens.list' }] },
|
|
135
135
|
'POST /members/:member/tokens': { ui: [{ does: 'a service account › Sign-in › Issue token', in: 'components/service-tokens.tsx', call: 'tokens.issue' }] },
|
|
136
|
+
'POST /handles': { not: "a handle is a stand-in for an app `coffre run` starts, which only the credential proxy takes: a page has no app to give one" },
|
|
136
137
|
'DELETE /members/:member/tokens/:id': { ui: [{ does: 'a bearer token › Revoke', in: 'components/service-tokens.tsx', call: 'tokens.revoke' }] },
|
|
137
138
|
'GET /members/:member/bindings': { ui: [{ does: 'a service account › Sign-in › Sign in with OIDC', in: 'components/trusted-workloads.tsx', call: 'bindings.list' }] },
|
|
138
139
|
'POST /members/:member/bindings': {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audit-sentence-C1_gRxWW.js","names":[],"sources":["../../src/lib/audit-sentences.ts","../../src/components/audit-sentence.tsx"],"sourcesContent":["/**\n * The audit log in sentences: who did what, to what. One entry is one\n * human action, named for it (`secret.read`, `access.grant`, …); a batch of\n * them, one reveal of twelve secrets, shares an operation and reads as one\n * line, \"ran market/prod: 12 secrets\".\n *\n * A sentence is parts rather than a string, so the page can make the people\n * and places in it links. `plain` flattens it, for tests and titles.\n */\nimport { shownMember, type AuditEntryView } from '@coffre/client';\nimport { INSTANCE_ROLES, isInstanceRole, isScope, scopeInWords, type Scope } from '@coffre/core/access';\n\n/** What a sentence is made from: an entry of the log, as `GET /api/audit` gives it. */\nexport type AuditEntry = Pick<\n AuditEntryView,\n | 'seq'\n | 'author'\n | 'actorType'\n | 'actorId'\n | 'action'\n | 'decision'\n | 'reason'\n | 'detail'\n | 'subject'\n | 'project'\n | 'environment'\n | 'key'\n | 'version'\n | 'secrets'\n | 'operationId'\n | 'metadata'\n>;\n\n/**\n * Text, a place (`market`, `market/prod`, `market/prod/KEY`), or a member,\n * as the log stores it (`user:…`, `token:…`): `shownMember` says it as people\n * read it, `service:…`, where it is shown.\n */\nexport type Part = string | { place: string } | { member: string };\n\nexport type Sentence = { parts: Part[]; refused: boolean };\n\n/** What one template needs: the line's leading entry, its batch, and how it was decided. */\ntype Facts = {\n entry: AuditEntry;\n /** Every entry of the batch, the lead included, a read of several once per secret (`perSecret`). */\n batch: AuditEntry[];\n /** Secrets the batch was about. */\n count: number;\n refused: boolean;\n};\n\ntype Template = {\n /** What they did: \"revealed\". */\n did: string | ((facts: Facts) => string);\n /** What they tried, after \"tried to\": \"reveal\". */\n tried: string | ((facts: Facts) => string);\n /** To what: \"market/prod/API_KEY\". */\n what: (facts: Facts) => Part[];\n /** Said only of what happened: \", now version 5\". */\n then?: (facts: Facts) => Part[];\n};\n\n// --- the pieces of a sentence ---------------------------------------------------\n\nconst text = (value: unknown): string | null => (typeof value === 'string' && value !== '' ? value : null);\nconst number = (value: unknown): number | null => (typeof value === 'number' ? value : null);\n\n/** The entry's place, as deep as it goes. */\nfunction place({ project, environment, key }: AuditEntry): Part[] {\n const path = [project, environment, key].filter((part): part is string => part !== null);\n return path.length === 0 ? ['coffre'] : [{ place: path.join('/') }];\n}\n\nfunction environmentOf({ project, environment }: AuditEntry): Part[] {\n return place({ project, environment, key: null } as AuditEntry);\n}\n\n/** The member an entry is about: its subject, or the principal a token entry names. */\nfunction subject(entry: AuditEntry): Part[] {\n if (entry.subject !== null) return [{ member: entry.subject }];\n const id = text(entry.metadata.principalId);\n if (id === null) return ['someone'];\n return [{ member: `${entry.metadata.principalType === 'service' ? 'token' : 'user'}:${id}` }];\n}\n\n/** Whether a token entry is about a personal token, which acts as its person, rather than a service account's. */\nfunction personal(entry: AuditEntry): boolean {\n return entry.metadata.kind === 'personal';\n}\n\n/** A personal token's label, as it was made: ` \"cursor-agent\"`. */\nfunction labelled(entry: AuditEntry): Part[] {\n const label = text(entry.metadata.label);\n return label === null ? [] : [` “${label}”`];\n}\n\n/** Why the vault made someone an Owner itself, said after it. */\nfunction owned(entry: AuditEntry): Part[] {\n return entry.metadata.reason === 'owners' ? [': the deployment names them one'] : [];\n}\n\n/** An MCP client, by the name it connected under. */\nfunction app(entry: AuditEntry): Part[] {\n return [text(entry.metadata.clientName) ?? 'an app'];\n}\n\n/** A tool's call: its name, and what it named. */\nfunction tool(entry: AuditEntry): Part[] {\n const names = Array.isArray(entry.metadata.names) ? entry.metadata.names.filter((name): name is string => typeof name === 'string') : [];\n return [text(entry.metadata.tool) ?? 'a tool', ...(names.length === 0 ? [] : [` on ${names.join(', ')}`])];\n}\n\n/** The client a request came through, said after what it did: \"via Claude\". */\nfunction via(entry: AuditEntry): Part[] {\n const client = (entry.metadata.via as { clientName?: unknown } | undefined)?.clientName;\n return typeof client === 'string' ? [` via ${client}`] : [];\n}\n\n/** Why coffre itself ended a connection, said after it. */\nconst DISCONNECTED: Record<string, string> = {\n code_reused: ': its sign-in code was used twice',\n refresh_reused: ': a refresh token it had replaced was used again',\n revocation_endpoint: ', at its own request',\n superseded: ': a connection with more scopes replaced it',\n};\n\nfunction plural(count: number, one: string, many = `${one}s`): string {\n return `${count} ${count === 1 ? one : many}`;\n}\n\n/** A batch reads as its environment and a count; one entry as its secret. */\n/**\n * The secrets a read or write was about. A read through a reference is a\n * read of its source, \"market/prod/DATABASE_URL through\n * billing/prod/DATABASE_URL\"; a run that read some that way is a run of\n * the environment that holds them. A value a fork inherits is its parent's,\n * read in the fork: \"market/prod/STRIPE_KEY in market/prod-eu\".\n */\nfunction secrets(facts: Facts): Part[] {\n const through = (entry: AuditEntry) => text((entry.metadata.via as { path?: unknown } | undefined)?.path);\n // The fork a value was inherited in, by path: in its parent's project, which holds the reference a read went through.\n const forkOf = (entry: AuditEntry) => {\n const slug = text((entry.metadata.through as { slug?: unknown } | undefined)?.slug);\n const project = through(entry)?.split('/')[0] ?? entry.project;\n return slug === null || project === null ? null : `${project}/${slug}`;\n };\n if (facts.batch.length === 1) {\n const [held, fork] = [through(facts.entry), forkOf(facts.entry)];\n return [...place(facts.entry), ...(held === null ? [] : [' through ', { place: held }]), ...(fork === null ? [] : [' in ', { place: fork }])];\n }\n const fork = facts.batch.map(forkOf).find((path) => path !== null);\n const own = facts.batch.find((entry) => through(entry) === null && forkOf(entry) === null);\n const held = facts.batch.map(through).filter((path): path is string => path !== null);\n const inherited = facts.batch.filter((entry) => forkOf(entry) !== null).length;\n const where = fork !== undefined && fork !== null\n ? [{ place: fork }]\n : own !== undefined ? environmentOf(own) : [{ place: held[0]!.split('/').slice(0, 2).join('/') }];\n return [\n ...where,\n facts.refused ? ', ' : ': ',\n plural(facts.count, 'secret'),\n ...(held.length === 0 ? [] : [`, ${held.length} through ${held.length === 1 ? 'a reference' : 'references'}`]),\n ...(inherited === 0 ? [] : [`, ${inherited} inherited`]),\n ];\n}\n\n/** \"market/prod/OLD\", or \"OLD and STALE in market/prod\" for an archive of several keys refused. */\nfunction archivedKeys(entry: AuditEntry): Part[] {\n const keys = Array.isArray(entry.metadata.keys) ? entry.metadata.keys.filter((key): key is string => text(key) !== null) : [];\n if (entry.key !== null || keys.length === 0) return place(entry);\n return [keys.length === 1 ? keys[0]! : `${keys.slice(0, -1).join(', ')} and ${keys.at(-1)!}`, ' in ', ...environmentOf(entry)];\n}\n\n/** \"SENTRY_DSN in market/dev\", or \"3 keys in market/dev\" for a Dismiss all. */\nfunction missingKeys(facts: Facts): Part[] {\n const key = text(facts.entry.metadata.key);\n return [facts.batch.length === 1 && key !== null ? key : plural(facts.count, 'key'), ' in ', ...environmentOf(facts.entry)];\n}\n\n/** \"billing/prod/DATABASE_URL a reference to market/prod/DATABASE_URL\", from either author's entry. */\nfunction referenceTo(entry: AuditEntry): Part[] {\n const holder = text(entry.metadata.subject);\n const key = text(entry.metadata.key);\n const source = text(entry.metadata.source) ?? text((entry.metadata.source as { path?: unknown } | undefined)?.path);\n return [\n ...(holder !== null ? [{ place: holder }] : key !== null ? place(entry) : environmentOf(entry)),\n ...(source === null ? [] : [' a reference to ', { place: source }]),\n ];\n}\n\nconst READ_VERBS: Record<string, [did: string, tried: string]> = {\n reveal: ['revealed', 'reveal'],\n run: ['ran', 'run'],\n compare: ['compared', 'compare'],\n copy: ['copied', 'copy'],\n};\n\nfunction readVerb({ entry }: Facts): [string, string] {\n return READ_VERBS[text(entry.metadata.purpose) ?? 'reveal'] ?? READ_VERBS.reveal!;\n}\n\nconst placeTemplates = (kind: 'project' | 'environment'): Record<string, Template> => {\n // A personal config by what it is a config of, `market/dev`: its own slug is generated, and shown nowhere else.\n const of = (entry: AuditEntry): string | null => {\n const parent = text(entry.metadata.personal) ?? text(entry.metadata.with);\n return parent === null || entry.project === null ? null : `${entry.project}/${parent}`;\n };\n const what = (facts: Facts): Part[] => {\n const personal = kind === 'environment' ? of(facts.entry) : null;\n if (personal !== null) return ['a personal config of ', { place: personal }];\n if (kind === 'environment' && facts.entry.metadata.personal === true) return [`a personal config, ${text(facts.entry.metadata.path) ?? ''}`];\n return [`${kind} `, ...(kind === 'project' ? place({ ...facts.entry, environment: null, key: null }) : environmentOf(facts.entry))];\n };\n return {\n [`${kind}.create`]: {\n did: 'created',\n tried: 'create',\n what,\n // A fork names the environment it copied.\n then: ({ entry }) =>\n text(entry.metadata.inherits) !== null\n ? [`, inheriting from ${text(entry.metadata.inherits)}`]\n : text(entry.metadata.from) === null\n ? []\n : [`, a fork of ${text(entry.metadata.from)}`],\n },\n [`${kind}.update`]: { did: 'changed', tried: 'change', what },\n [`${kind}.archive`]: { did: 'archived', tried: 'archive', what },\n [`${kind}.restore`]: { did: 'restored', tried: 'restore', what },\n // Named by its tombstone from then on, `market~deleted-2026-10-05`, as every entry about it is.\n [`${kind}.delete`]: { did: 'deleted', tried: 'delete', what },\n };\n};\n\n// --- one template per action ----------------------------------------------------\n\nconst TEMPLATES: Record<string, Template> = {\n 'secret.read': {\n did: (facts) => readVerb(facts)[0],\n tried: (facts) => readVerb(facts)[1],\n what: secrets,\n },\n 'secret.write': {\n // New secrets are added, others changed; a batch of both is written.\n did: ({ batch }) => {\n const firsts = batch.filter((entry) => entry.version === 1).length;\n return firsts === batch.length ? 'added' : firsts === 0 ? 'changed' : 'wrote';\n },\n tried: 'change',\n what: secrets,\n then: ({ entry, batch }) =>\n batch.length > 1 || entry.version === null || entry.version === 1 ? [] : [`, now version ${entry.version}`],\n },\n 'secret.restore': {\n did: 'restored',\n tried: 'restore',\n what: ({ entry }) => [...place(entry), ...(number(entry.metadata.from) === null ? [] : [` to version ${number(entry.metadata.from)}`])],\n then: ({ entry }) => (entry.version === null ? [] : [`, now ${entry.version}`]),\n },\n 'secret.rename': {\n did: 'renamed',\n tried: 'rename',\n what: ({ entry }) => [...place(entry), ...(text(entry.metadata.nextKey) === null ? [] : [` to ${text(entry.metadata.nextKey)}`])],\n // In a fork, carried down from a rename in its parent.\n then: ({ entry }) => (text(entry.metadata.parent) === null ? [] : [`, as ${text(entry.metadata.parent)} did`]),\n },\n 'secret.archive': { did: 'archived', tried: 'archive', what: ({ entry }) => archivedKeys(entry) },\n // In a fork: its own value set aside, kept, for its parent's.\n 'secret.reset': {\n did: 'reset',\n tried: 'reset',\n what: ({ entry }) => place(entry),\n then: ({ entry }) => (text(entry.metadata.from) === null ? [] : [` to ${text(entry.metadata.from)}'s value`]),\n },\n 'missing.dismiss': {\n did: 'dismissed',\n tried: 'dismiss',\n what: (facts) => missingKeys(facts),\n then: () => [' as not needed'],\n },\n 'missing.restore': { did: 'restored', tried: 'restore', what: (facts) => missingKeys(facts), then: () => [' to the missing keys'] },\n 'secret.reference': { did: 'made', tried: 'make', what: ({ entry }) => referenceTo(entry) },\n 'reference.create': { did: 'made', tried: 'make', what: ({ entry }) => referenceTo(entry) },\n 'reference.end': {\n did: ({ entry }) => (entry.metadata.reason === 'replaced' ? 'gave a value of its own to' : entry.metadata.reason === 'abandoned' ? 'abandoned' : 'broke'),\n tried: ({ entry }) => (entry.metadata.reason === 'replaced' ? 'replace' : entry.metadata.reason === 'abandoned' ? 'abandon' : 'break'),\n what: ({ entry }) => {\n const source = text((entry.metadata.source as { path?: unknown } | undefined)?.path);\n const holder = text(entry.metadata.subject);\n if (entry.metadata.reason === 'replaced') return [...(holder === null ? ['a reference'] : [{ place: holder }]), ...(source === null ? [] : [', no longer a reference to ', { place: source }])];\n return ['the reference ', ...(holder === null ? [] : [{ place: holder }]), ...(source === null ? [] : [' to ', { place: source }])];\n },\n then: ({ entry }) => (entry.metadata.reason === 'abandoned' ? [', which its write never stored'] : []),\n },\n 'secret.unarchive': { did: 'brought back', tried: 'bring back', what: (facts) => place(facts.entry) },\n 'secret.move': { did: 'moved', tried: 'move', what: (facts) => place(facts.entry), then: ({ entry }) => intoFolder(entry) },\n ...placeTemplates('project'),\n 'project.move': {\n did: 'moved',\n tried: 'move',\n what: ({ entry }) => ['project ', ...place({ ...entry, environment: null, key: null })],\n then: ({ entry }) => intoFolder(entry),\n },\n ...placeTemplates('environment'),\n 'environment.fork': {\n did: 'forked',\n tried: 'fork',\n what: ({ entry }) => [...environmentOf(entry), ...(text(entry.metadata.slug) === null ? [] : [` into ${text(entry.metadata.slug)}`])],\n },\n 'access.grant': {\n did: 'gave',\n tried: 'give',\n what: ({ entry }) => [...subject(entry), ` ${text(entry.metadata.role) ?? 'a role'} on `, ...placeOnly(entry)],\n then: ({ entry }) => [\n ...(text(entry.metadata.previousRole) === null ? [] : [`, was ${text(entry.metadata.previousRole)}`]),\n ...(text(entry.metadata.expiresAt) === null ? [] : [`, until ${text(entry.metadata.expiresAt)!.slice(0, 10)}`]),\n ...(entry.metadata.reason === 'every-project' ? [', for a grant on every project'] : []),\n ],\n },\n 'access.revoke': {\n did: 'took',\n tried: 'take',\n what: ({ entry }) => [\n ...(text(entry.metadata.previousRole ?? entry.metadata.role) === null ? ['access to '] : [`${text(entry.metadata.previousRole ?? entry.metadata.role)} on `]),\n ...placeOnly(entry),\n ' from ',\n ...subject(entry),\n ],\n // The vault replacing a grant on every project of 0.4: by what, an instance role or project grants.\n then: ({ entry }) => {\n const by = entry.metadata.replacedBy as { role?: unknown } | undefined;\n if (by === undefined) return [];\n const role = typeof by.role === 'string' ? roleName(by.role) : null;\n return [role === null || role === 'Member' ? ', replaced by project grants' : `, replaced by the instance role ${role}`];\n },\n },\n 'member.add': {\n did: 'added',\n tried: 'add',\n what: ({ entry }) => [\n ...subject(entry),\n ...(entry.metadata.rootAdmin === true ? [' as a root admin'] : entry.metadata.owner === true ? [' as an owner'] : asRole(entry)),\n ],\n then: ({ entry }) => owned(entry),\n },\n 'member.remove': {\n did: 'removed',\n tried: 'remove',\n what: (facts) => subject(facts.entry),\n then: ({ entry }) => (number(entry.metadata.revoked) === null ? [] : [`, who held ${plural(number(entry.metadata.revoked)!, 'grant')}`]),\n },\n 'member.restore': {\n did: 'brought back',\n tried: 'bring back',\n what: ({ entry }) => [...subject(entry), ...asRole(entry)],\n then: ({ entry }) => owned(entry),\n },\n 'member.role': {\n did: 'made',\n tried: 'make',\n what: ({ entry }) => [...subject(entry), ` ${article(roleName(text(entry.metadata.role) ?? 'member') ?? 'Member')}`, ...scoped(entry)],\n then: ({ entry }) => {\n const before = roleName(text(entry.metadata.previousRole) ?? '');\n return [\n ...(before === null ? [] : [`, was ${before}`]),\n ...(entry.metadata.reason === 'every-project' ? [', for their grants on every project'] : []),\n ...owned(entry),\n ];\n },\n },\n 'member.owner': {\n did: ({ entry }) => (entry.metadata.owner === false ? 'took owner from' : 'made'),\n tried: ({ entry }) => (entry.metadata.owner === false ? 'take owner from' : 'make'),\n what: ({ entry }) => [...subject(entry), ...(entry.metadata.owner === false ? [] : [' an owner'])],\n },\n // Where people set up service accounts themselves, which those who run the instance set.\n 'settings.change': {\n did: 'set',\n tried: 'set',\n what: ({ entry }) => ['where people set up service accounts', ...setting(entry.metadata.serviceAccounts).map((words) => `: ${words}`)],\n then: ({ entry }) => {\n const previous = (entry.metadata.previous as { serviceAccounts?: unknown } | undefined)?.serviceAccounts;\n return setting(previous).map((words) => `, was ${words}`);\n },\n },\n // A binding trusts CI runs to sign in as a service; removing one is its tombstone.\n 'token.bind': {\n did: 'trusted CI runs to sign in as',\n tried: 'trust CI runs to sign in as',\n what: (facts) => subject(facts.entry),\n then: ({ entry }) => [...inGitHubEnvironment(entry), ...reaching(entry)],\n },\n // The tokens and bindings 0.4 made, given their own scope when 0.5 first checked a credential: what their account held then.\n 'token.seal': {\n did: 'sealed',\n tried: 'seal',\n what: ({ entry }) => [`${sealedOf(entry)} of `, ...subject(entry)],\n then: ({ entry }) => reaching(entry, ', reaching nothing'),\n },\n 'token.unbind': {\n did: 'stopped trusting CI runs to sign in as',\n tried: 'stop trusting CI runs to sign in as',\n what: (facts) => subject(facts.entry),\n },\n 'vault.tampered': {\n did: 'found',\n tried: 'check',\n what: ({ entry }) => [\n ...(entry.subject === null ? ['an entry'] : [...subject(entry), \"'s record\"]),\n ` tampered with: ${TAMPERING[entry.reason ?? ''] ?? 'it fails its seal'}`,\n ],\n },\n 'key.rotate': { did: 'rotated its key', tried: 'rotate its key', what: () => [] },\n // An MCP client a person connected, such as Claude: named as the consent page showed it.\n 'mcp.connect': { did: 'connected', tried: 'connect', what: ({ entry }) => app(entry) },\n // A tool an MCP client called, by its name, and the places it named.\n 'mcp.call': { did: 'used', tried: 'use', what: ({ entry }) => tool(entry), then: ({ entry }) => via(entry) },\n // A person's decision, on coffre's page, on a change an MCP client asked for; the change's own entries follow, via the client.\n 'mcp.approve': { did: 'approved', tried: 'approve', what: ({ entry }) => tool(entry), then: ({ entry }) => [` for ${text(entry.metadata.clientName) ?? 'an app'}`] },\n 'mcp.deny': { did: 'turned down', tried: 'turn down', what: ({ entry }) => tool(entry), then: ({ entry }) => [` for ${text(entry.metadata.clientName) ?? 'an app'}`] },\n 'mcp.view': { did: 'opened an approval', tried: 'open an approval', what: () => [] },\n // The app's prompt declined, which cancels the approval it would have opened.\n 'mcp.cancel': { did: 'cancelled', tried: 'cancel', what: ({ entry }) => tool(entry), then: ({ entry }) => via(entry) },\n 'mcp.disconnect': {\n did: 'disconnected',\n tried: 'disconnect',\n what: ({ entry }) => [...app(entry), ...(entry.metadata.principalId === undefined ? [] : [' of ', ...subject(entry)])],\n then: ({ entry }) => [DISCONNECTED[text(entry.metadata.reason) ?? ''] ?? ''],\n },\n\n // Detail, hidden unless asked for.\n sign_in: {\n did: ({ entry }) => (entry.metadata.kind === 'cli' ? 'signed in to the CLI' : 'signed in'),\n tried: 'sign in',\n what: ({ entry }) => (text(entry.metadata.provider) === null ? [] : [`with ${text(entry.metadata.provider)}`]),\n },\n sign_out: { did: 'signed out', tried: 'sign out', what: () => [] },\n // A personal token is its person's own, and named by its label; a bearer token is a service account's.\n 'token.create': {\n did: ({ entry }) => (personal(entry) ? 'made a personal token' : 'issued a bearer token to'),\n tried: ({ entry }) => (personal(entry) ? 'make a personal token' : 'issue a bearer token to'),\n what: ({ entry }) => (personal(entry) ? labelled(entry) : subject(entry)),\n then: ({ entry }) => reaching(entry),\n },\n 'token.revoke': {\n did: ({ entry }) => (personal(entry) ? 'revoked a personal token of' : 'revoked a bearer token of'),\n tried: ({ entry }) => (personal(entry) ? 'revoke a personal token of' : 'revoke a bearer token of'),\n what: (facts) => subject(facts.entry),\n },\n // A personal token refused a route only its person reaches: the route, as the API names it.\n 'token.use': {\n did: 'used a personal token for',\n tried: 'use a personal token for',\n what: ({ entry }) => [text(entry.metadata.route) ?? 'something'],\n },\n 'device.approve': { did: 'approved a CLI sign-in', tried: 'approve a CLI sign-in', what: () => [] },\n 'device.deny': { did: 'turned down a CLI sign-in', tried: 'turn down a CLI sign-in', what: () => [] },\n 'mcp.read': { did: 'used', tried: 'use', what: ({ entry }) => tool(entry), then: ({ entry }) => via(entry) },\n 'mcp.token': {\n did: ({ entry }) => (entry.metadata.grant === 'refresh_token' ? 'refreshed the tokens of' : 'gave its first tokens to'),\n tried: 'give tokens to',\n what: ({ entry }) => app(entry),\n },\n 'account.link': {\n did: 'linked',\n tried: 'link',\n what: ({ entry }) => [`a ${text(entry.metadata.provider) ?? 'sign-in'} account`],\n },\n 'account.unlink': {\n did: 'unlinked',\n tried: 'unlink',\n what: ({ entry }) => [`a ${text(entry.metadata.provider) ?? 'sign-in'} account`],\n },\n 'key.wrap': { did: 'sealed the key of', tried: 'seal the key of', what: (facts) => versioned(facts.entry) },\n 'key.rewrap': { did: 'resealed the key of', tried: 'reseal the key of', what: (facts) => versioned(facts.entry) },\n 'key.intent': { did: 'asked KMS about', tried: 'ask KMS about', what: (facts) => secrets(facts) },\n 'key.check': {\n did: 'recorded the check value of',\n tried: 'check',\n what: ({ entry }) => [['the', text(entry.metadata.kekProvider) === 'local' ? null : text(entry.metadata.kekProvider), 'vault key', text(entry.metadata.kekId)].filter((word) => word !== null).join(' ')],\n },\n 'audit.heartbeat': { did: 'checked in', tried: 'check in', what: () => [] },\n 'audit.checkpoint': {\n did: 'signed the log',\n tried: 'sign the log',\n what: ({ entry }) => (number(entry.metadata.seq) === null ? [] : [`through entry ${number(entry.metadata.seq)}`]),\n },\n\n // Only ever refused: a read of a list, which is not logged when allowed.\n 'secret.list': { did: 'listed', tried: 'list', what: ({ entry }) => environmentOf(entry) },\n 'secret.history': { did: 'read the history of', tried: 'read the history of', what: (facts) => place(facts.entry) },\n 'secret.update': { did: 'changed', tried: 'change', what: (facts) => place(facts.entry) },\n};\n\n/** \" to the folder stripe\", or \" out of its folder\". */\nfunction intoFolder(entry: AuditEntry): Part[] {\n const folder = text(entry.metadata.to);\n return [folder === null ? ' out of its folder' : ` to the folder ${folder}`];\n}\n\n/** An instance role's name, from its slug; null for none it knows. */\nfunction roleName(role: string): string | null {\n return isInstanceRole(role) ? INSTANCE_ROLES[role].name : null;\n}\n\nfunction article(name: string): string {\n return `${/^[AEIOU]/.test(name) ? 'an' : 'a'} ${name}`;\n}\n\n/** Whether an entry's scope narrows the role; its projects are ids, which a sentence cannot name. */\nfunction scoped(entry: AuditEntry): Part[] {\n const scope = entry.metadata.scope as { projects?: unknown; environments?: unknown } | undefined;\n return scope === undefined || (scope.projects === 'all' && scope.environments === 'all') ? [] : [', with a scope'];\n}\n\n/**\n * What a token or binding reaches, its scope, each role with the places it\n * holds, counted, as the log names them by id: `, reaching developer on 2 places`.\n */\nfunction reaching(entry: AuditEntry, none = ''): Part[] {\n const scope = entry.metadata.scope;\n if (!Array.isArray(scope)) return [];\n if (scope.length === 0) return none === '' ? [] : [none];\n const byRole = new Map<string, number>();\n for (const grant of scope as { role?: unknown }[]) {\n const role = text(grant.role);\n if (role !== null) byRole.set(role, (byRole.get(role) ?? 0) + 1);\n }\n return [`, reaching ${[...byRole].map(([role, count]) => `${role} on ${plural(count, 'place')}`).join(', ')}`];\n}\n\n/** The GitHub environment a binding takes its runs from, when it names one. */\nfunction inGitHubEnvironment(entry: AuditEntry): Part[] {\n const environment = text((entry.metadata.claims as Record<string, unknown> | undefined)?.environment);\n return environment === null || !String(entry.metadata.profile).startsWith('github') ? [] : [`, in GitHub environment ${environment}`];\n}\n\n/** The tokens and trust bindings a `token.seal` names, counted: `2 tokens and a trust binding`. */\nfunction sealedOf(entry: AuditEntry): string {\n const count = (key: string) => (Array.isArray(entry.metadata[key]) ? (entry.metadata[key] as unknown[]).length : 0);\n const parts = [[count('tokens'), 'token'], [count('bindings'), 'trust binding']] as const;\n return parts.filter(([n]) => n > 0).map(([n, one]) => plural(n, one)).join(' and ') || 'nothing';\n}\n\n/**\n * The setting of where people set up service accounts, in words: its\n * projects counted, as the log names them by id, its environments by name.\n *\n * All projects · all but prod 2 projects · dev only\n */\nfunction setting(scope: unknown): string[] {\n if (!isScope(scope)) return [];\n const { projects } = scope;\n const counted: Scope = projects === 'all'\n ? scope\n : { ...scope, projects: 'only' in projects ? { only: [plural(projects.only.length, 'project')] } : { except: [plural(projects.except.length, 'project')] } };\n return [scopeInWords(counted)];\n}\n\n/** The role a member is added or brought back with, said when it is more than Member. */\nfunction asRole(entry: AuditEntry): Part[] {\n const role = roleName(text(entry.metadata.role) ?? '');\n return role === null || role === 'Member' ? [] : [` as ${article(role)}`, ...scoped(entry)];\n}\n\nfunction placeOnly(entry: AuditEntry): Part[] {\n // A grant on every project names no project: its place is a path in its payload, `*` or `*/dev`.\n const everywhere = entry.project === null ? text(entry.metadata.place) : null;\n if (everywhere !== null) return [everywhere === '*' ? 'every project' : `${everywhere.slice('*/'.length)} in every project`];\n return place({ ...entry, key: null });\n}\n\nfunction versioned(entry: AuditEntry): Part[] {\n return [...place(entry), ...(entry.version === null ? [] : [`, version ${entry.version}`])];\n}\n\nconst TAMPERING: Record<string, string> = {\n mac: \"it does not carry the vault's seal\",\n stale: 'an older copy was put back',\n forged_entry: 'the vault did not write it',\n};\n\n/** Why something was refused, in words. Codes from the vault and the app. */\nconst REASONS: Record<string, string> = {\n no_grant: 'no grant',\n bulk_limit: 'bulk limit',\n expired: 'grant expired',\n removed: 'removed from coffre',\n not_a_member: 'not a member',\n not_registered: 'not invited',\n tampered: 'their record was tampered with',\n bad_claim: 'the key did not match the secret',\n deleted: 'the place was deleted',\n not_allowed: 'not allowed',\n root_admin: 'root admins are set by the deployment',\n last_owner: 'they are the last Owner of the whole instance',\n requires_instance_admin: 'requires an admin or owner of the whole instance',\n requires_instance_owner: 'requires an instance owner',\n own_role: 'nobody changes their own role',\n own_grant: 'nobody grants themselves a role',\n service_cannot_hold_role: 'service accounts hold project grants only',\n not_service_manager: 'they hold less than the service account, or than they gave it',\n unknown_environment: 'no such environment',\n unknown_secret: 'no such secret',\n no_value: 'it holds no value',\n unknown_project: 'no such project',\n not_archived: 'it was not archived',\n referenced: 'references read it',\n kms_unavailable: 'KMS did not answer',\n wrong_kek: \"the vault's key is not the one that wrapped the data\",\n person_denied: 'they said no',\n too_many_connections: 'too many connected apps',\n unknown_connection: 'no such connected app',\n not_yours: \"it was someone else's\",\n too_many_approvals: 'too many changes waiting for approval',\n request_state: 'its retry did not match its call',\n changed: 'the change was not the one shown',\n replaced: 'what it replaces changed since it was shown',\n unconfirmed: 'what it replaces could not be read',\n disconnected: 'the app was disconnected',\n personal_token: 'only its person can, signed in as themselves',\n beyond_holder: 'more than they hold',\n};\n\n/** What a missing permission meant, from the app's `missing_<permission>`. */\nconst MISSING: Record<string, string> = {\n secret_read: 'no grant to read it',\n secret_write: 'no grant to write',\n secret_archive: 'no grant to archive',\n audit_read: 'no grant to read the audit log',\n environment_manage: 'no grant to manage environments',\n grant_manage: 'no grant to manage access',\n project_manage: 'no grant to manage the project',\n};\n\nexport function reasonInWords(reason: string | null): string {\n if (reason === null) return 'refused';\n if (reason.startsWith('missing_')) return MISSING[reason.slice('missing_'.length)] ?? 'no grant';\n return REASONS[reason] ?? reason.replace(/_/g, ' ');\n}\n\n// --- lines ----------------------------------------------------------------------\n\n/** In a batch of mixed actions, the one the line is named for: a write, not its reads. */\nconst LEAD = ['secret.write', 'secret.read'];\n\nexport function leadOf(batch: AuditEntry[]): AuditEntry {\n for (const action of LEAD) {\n const found = batch.find((entry) => entry.action === action);\n if (found !== undefined) return found;\n }\n return batch[0]!;\n}\n\n/**\n * A read of several secrets, logged once for its place, as the entries it\n * would be about one secret each: its key and version, and what its own\n * part of the metadata says, such as the reference it went through. Any\n * other entry as it is.\n */\nexport function perSecret<T extends AuditEntry>(entry: T): T[] {\n const listed = entry.metadata.secrets;\n // One whose list was emptied or mangled, which verification would flag, still reads as itself.\n if (entry.secrets === null || entry.secrets.length === 0 || !Array.isArray(listed)) return [entry];\n return entry.secrets.map(({ key, version }, i) => {\n const own = listed[i];\n return {\n ...entry,\n key,\n version,\n secrets: null,\n metadata: { ...entry.metadata, secrets: undefined, ...(typeof own === 'object' && own !== null && !Array.isArray(own) ? own : {}) },\n };\n });\n}\n\n/** What a line says: one entry, or a batch that shares an operation. */\nexport function describe(batch: AuditEntry[]): Sentence {\n const entry = perSecret(leadOf(batch))[0]!;\n const same = batch.filter((other) => other.action === entry.action).flatMap(perSecret);\n const denied = same.filter((other) => other.decision === 'deny');\n const refused = denied.length === same.length;\n const facts: Facts = {\n entry,\n batch: same,\n count: new Set(same.map((other) => `${other.project}/${other.environment}/${other.key}`)).size,\n refused,\n };\n const template = TEMPLATES[entry.action];\n if (template === undefined) return { parts: [entry.action, ' ', ...place(entry)], refused };\n const say = (verb: Template['did']) => (typeof verb === 'string' ? verb : verb(facts));\n const what = template.what(facts);\n const gap = what.length === 0 ? [] : [' '];\n if (refused) {\n const reason = reasonInWords((denied[0] ?? entry).reason);\n return { parts: ['tried to ', say(template.tried), ...gap, ...what, `: ${reason}`], refused };\n }\n const partly = denied.length === 0 ? [] : [`, ${denied.length} refused: ${reasonInWords(denied[0]!.reason)}`];\n return { parts: [say(template.did), ...gap, ...what, ...(template.then?.(facts) ?? []), ...partly], refused };\n}\n\n/** Who acted, as a part: a member links to their page; coffre itself is text. */\nexport function who(entry: Pick<AuditEntry, 'actorType' | 'actorId'>): string | { member: string } {\n if (entry.actorType === 'user') return { member: `user:${entry.actorId}` };\n if (entry.actorType === 'service') return { member: `token:${entry.actorId}` };\n return SYSTEM[entry.actorId] ?? entry.actorId;\n}\n\nconst SYSTEM: Record<string, string> = {\n scheduler: 'the scheduler',\n cron: 'the scheduler',\n vault: 'the vault',\n app: 'coffre',\n};\n\n/** Which components wrote the line, the vault first: \"vault\", \"app\", \"vault, app\". */\nexport function decidedBy(batch: Pick<AuditEntry, 'author'>[]): string {\n return (['vault', 'app'] as const).filter((author) => batch.some((entry) => entry.author === author)).join(', ');\n}\n\n/**\n * Entries in the order the page shows them, newest first, each batch as one\n * line at its newest entry. The server leaves detail out unless asked.\n */\nexport function lines<T extends AuditEntry>(entries: T[]): T[][] {\n const shown: T[][] = [];\n const batches = new Map<string, T[]>();\n for (const entry of entries) {\n const batch = entry.operationId === null ? undefined : batches.get(entry.operationId);\n if (batch !== undefined) {\n batch.push(entry);\n continue;\n }\n const fresh = [entry];\n if (entry.operationId !== null) batches.set(entry.operationId, fresh);\n shown.push(fresh);\n }\n return shown;\n}\n\n/** A sentence as text. */\nexport function plain(parts: Part[]): string {\n return parts\n .map((part) =>\n typeof part === 'string' ? part : 'place' in part ? part.place : part.member.startsWith('user:') ? part.member.slice(5) : shownMember(part.member),\n )\n .join('');\n}\n\n/**\n * The CI run an entry was written for, as its issuer stated it at the\n * exchange: `acme/api run 7001 at 3f2a9c1`, a GitLab pipeline, or the\n * token's subject. Null for an entry no trust binding's credential wrote.\n */\nexport function runLabel(run: { claims: Record<string, string | number> } | null): string | null {\n if (run === null) return null;\n const { claims } = run;\n const text = (name: string) => (typeof claims[name] === 'string' || typeof claims[name] === 'number' ? String(claims[name]) : null);\n const at = text('sha') === null ? '' : ` at ${text('sha')!.slice(0, 7)}`;\n if (text('repository') !== null && text('run_id') !== null) return `${text('repository')} run ${text('run_id')}${at}`;\n if (text('project_path') !== null && text('pipeline_id') !== null) return `${text('project_path')} pipeline ${text('pipeline_id')}${at}`;\n return text('sub') === null ? 'a CI run' : `CI run ${text('sub')}`;\n}\n","import { serviceName, shownMember } from '@coffre/client';\nimport { Fragment } from 'react';\nimport { Link } from '@tanstack/react-router';\nimport type { Part } from '../lib/audit-sentences';\nimport { breakAfterUnderscores } from './ui';\n\n/** A sentence, its people and places links to their pages. */\nexport function Sentence({ parts }: { parts: Part[] }) {\n return (\n <>\n {parts.map((part, index) => (\n <Fragment key={index}>\n {typeof part === 'string' ? (\n part\n ) : 'place' in part ? (\n <PlaceLink path={part.place} />\n ) : (\n <MemberLink member={part.member} />\n )}\n </Fragment>\n ))}\n </>\n );\n}\n\nfunction PlaceLink({ path }: { path: string }) {\n const [project, environment] = path.split('/') as [string, string | undefined];\n const text = <span className=\"mono\">{breakAfterUnderscores(path)}</span>;\n return environment === undefined ? (\n <Link to=\"/projects/$project\" params={{ project }}>\n {text}\n </Link>\n ) : (\n <Link to=\"/projects/$project/$environment\" params={{ project, environment }}>\n {text}\n </Link>\n );\n}\n\n/** A member from the log, which keeps `token:<name>`, shown as people read it: `service:<name>`, to its page. */\nfunction MemberLink({ member }: { member: string }) {\n return member.startsWith('token:') ? (\n <Link to=\"/service-accounts/$account\" params={{ account: serviceName(member) }}>\n {shownMember(member)}\n </Link>\n ) : (\n <Link to=\"/users/$user\" params={{ user: memberName(member) }}>\n {memberName(member)}\n </Link>\n );\n}\n\nexport function memberName(member: string): string {\n return member.startsWith('user:') ? member.slice('user:'.length) : shownMember(member);\n}\n"],"mappings":";;;;;;;AAiEA,IAAM,QAAQ,UAAmC,OAAO,UAAU,YAAY,UAAU,KAAK,QAAQ;AACrG,IAAM,UAAU,UAAmC,OAAO,UAAU,WAAW,QAAQ;;AAGvF,SAAS,MAAM,EAAE,SAAS,aAAa,OAA2B;CAChE,MAAM,OAAO;EAAC;EAAS;EAAa;CAAG,CAAC,CAAC,QAAQ,SAAyB,SAAS,IAAI;CACvF,OAAO,KAAK,WAAW,IAAI,CAAC,QAAQ,IAAI,CAAC,EAAE,OAAO,KAAK,KAAK,GAAG,EAAE,CAAC;AACpE;AAEA,SAAS,cAAc,EAAE,SAAS,eAAmC;CACnE,OAAO,MAAM;EAAE;EAAS;EAAa,KAAK;CAAK,CAAe;AAChE;;AAGA,SAAS,QAAQ,OAA2B;CAC1C,IAAI,MAAM,YAAY,MAAM,OAAO,CAAC,EAAE,QAAQ,MAAM,QAAQ,CAAC;CAC7D,MAAM,KAAK,KAAK,MAAM,SAAS,WAAW;CAC1C,IAAI,OAAO,MAAM,OAAO,CAAC,SAAS;CAClC,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,SAAS,kBAAkB,YAAY,UAAU,OAA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