@coffre/ui 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/audit-sentences.d.ts +56 -0
- package/dist/audit-sentences.js +886 -0
- package/dist/audit-sentences.js.map +1 -0
- package/dist/chunks/audit-sentence-C8NnAdjF.js +48 -0
- package/dist/chunks/audit-sentence-C8NnAdjF.js.map +1 -0
- package/dist/chunks/{connected-apps-CGUQlFMx.js → connected-apps-6sMSgQ9U.js} +5 -5
- package/dist/chunks/{connected-apps-CGUQlFMx.js.map → connected-apps-6sMSgQ9U.js.map} +1 -1
- package/dist/chunks/{delete-place-CswZ-meh.js → delete-place-T469tSN9.js} +5 -5
- package/dist/chunks/{delete-place-CswZ-meh.js.map → delete-place-T469tSN9.js.map} +1 -1
- package/dist/chunks/{directory-DrswWQLT.js → directory-B_gVf7UL.js} +18 -17
- package/dist/chunks/directory-B_gVf7UL.js.map +1 -0
- package/dist/chunks/{folders-A6sbR_PG.js → folders-CVYauIDz.js} +3 -3
- package/dist/chunks/{folders-A6sbR_PG.js.map → folders-CVYauIDz.js.map} +1 -1
- package/dist/chunks/{grants-C0cb2oii.js → grants-Dn_EW2XW.js} +8 -8
- package/dist/chunks/grants-Dn_EW2XW.js.map +1 -0
- package/dist/chunks/{multi-combobox-B3SEv1gq.js → multi-combobox-fbBRzi9z.js} +3 -3
- package/dist/chunks/{multi-combobox-B3SEv1gq.js.map → multi-combobox-fbBRzi9z.js.map} +1 -1
- package/dist/chunks/{offboarding-C1jbG_dk.js → offboarding-CXM464J_.js} +81 -80
- package/dist/chunks/offboarding-CXM464J_.js.map +1 -0
- package/dist/chunks/{page-CfhC9Hp1.js → page-Cb0ZjGda.js} +7 -12
- package/dist/chunks/page-Cb0ZjGda.js.map +1 -0
- package/dist/chunks/{personal-tokens-xC9wulhg.js → personal-tokens-CSHMlRHy.js} +7 -7
- package/dist/chunks/personal-tokens-CSHMlRHy.js.map +1 -0
- package/dist/chunks/{principal-CI17XK13.js → principal-BKJxbAtE.js} +2 -2
- package/dist/chunks/{principal-CI17XK13.js.map → principal-BKJxbAtE.js.map} +1 -1
- package/dist/chunks/{principal-page-CdSeftGD.js → principal-page-COPmTDVW.js} +132 -19
- package/dist/chunks/principal-page-COPmTDVW.js.map +1 -0
- package/dist/chunks/{project-page-CHxjBE97.js → project-page-g5_n46Nz.js} +3 -3
- package/dist/chunks/{project-page-CHxjBE97.js.map → project-page-g5_n46Nz.js.map} +1 -1
- package/dist/chunks/protected-DEWeOrmI.js +77 -0
- package/dist/chunks/protected-DEWeOrmI.js.map +1 -0
- package/dist/chunks/{queries-D1JuimTu.js → queries-D4_o-bz3.js} +22 -155
- package/dist/chunks/queries-D4_o-bz3.js.map +1 -0
- package/dist/chunks/{references-D5llUGQL.js → references-wTh_DT0M.js} +27 -23
- package/dist/chunks/references-wTh_DT0M.js.map +1 -0
- package/dist/chunks/{role-field-CoCv8wse.js → role-field-BiP09qfN.js} +5 -5
- package/dist/chunks/role-field-BiP09qfN.js.map +1 -0
- package/dist/chunks/{row-state-CYH7kZHl.js → row-state-CYhtmUkc.js} +3 -3
- package/dist/chunks/{row-state-CYH7kZHl.js.map → row-state-CYhtmUkc.js.map} +1 -1
- package/dist/chunks/{signin-errors-TlQmQe0t.js → signin-errors-BMnox7XD.js} +5 -19
- package/dist/chunks/signin-errors-BMnox7XD.js.map +1 -0
- package/dist/chunks/{theme-rF44Wbmm.js → theme-imSolE1q.js} +3 -3
- package/dist/chunks/{theme-rF44Wbmm.js.map → theme-imSolE1q.js.map} +1 -1
- package/dist/chunks/{ui-CGdORVzW.js → ui-Q_Eczt7m.js} +7 -3
- package/dist/chunks/{ui-CGdORVzW.js.map → ui-Q_Eczt7m.js.map} +1 -1
- package/dist/chunks/{use-action-BxrHTBZw.js → use-action-BfnN-De2.js} +3 -3
- package/dist/chunks/{use-action-BxrHTBZw.js.map → use-action-BfnN-De2.js.map} +1 -1
- package/dist/chunks/{use-change-BorW2R6C.js → use-change-Cc0X4sF3.js} +6 -4
- package/dist/chunks/use-change-Cc0X4sF3.js.map +1 -0
- package/dist/chunks/{use-roles-BZnJ9Cq0.js → use-roles-stcv2QFj.js} +13 -56
- package/dist/chunks/use-roles-stcv2QFj.js.map +1 -0
- package/dist/chunks/{use-shell-CPskgi1k.js → use-shell-DMhLa2sh.js} +3 -3
- package/dist/chunks/{use-shell-CPskgi1k.js.map → use-shell-DMhLa2sh.js.map} +1 -1
- package/dist/index.d.ts +23 -55
- package/dist/index.js +12 -31
- package/dist/index.js.map +1 -1
- package/dist/pages/account.js +12 -12
- package/dist/pages/account.js.map +1 -1
- package/dist/pages/approval.js +2 -2
- package/dist/pages/audit.js +173 -196
- package/dist/pages/audit.js.map +1 -1
- package/dist/pages/device-login.js +2 -2
- package/dist/pages/environment.js +445 -252
- package/dist/pages/environment.js.map +1 -1
- package/dist/pages/login.js +6 -15
- package/dist/pages/login.js.map +1 -1
- package/dist/pages/oauth-authorize.js +2 -2
- package/dist/pages/project-access.js +11 -11
- package/dist/pages/project-environments.js +359 -28
- package/dist/pages/project-environments.js.map +1 -1
- package/dist/pages/project-settings.js +8 -8
- package/dist/pages/project.js +3 -3
- package/dist/pages/projects.js +8 -8
- package/dist/pages/service-account.js +19 -16
- package/dist/pages/service-account.js.map +1 -1
- package/dist/pages/service-accounts.js +6 -7
- package/dist/pages/service-accounts.js.map +1 -1
- package/dist/pages/settings.d.ts +1 -6
- package/dist/pages/settings.js +155 -286
- package/dist/pages/settings.js.map +1 -1
- package/dist/pages/unregistered.js +2 -2
- package/dist/pages/user.js +7 -8
- package/dist/pages/user.js.map +1 -1
- package/dist/pages/users.js +6 -7
- package/dist/pages/users.js.map +1 -1
- package/package.json +8 -3
- package/src/components/actions-log.tsx +8 -61
- package/src/components/directory.tsx +10 -9
- package/src/components/grants.tsx +2 -2
- package/src/components/icons.tsx +0 -2
- package/src/components/offboarding.tsx +9 -16
- package/src/components/page.tsx +2 -3
- package/src/components/personal-tokens.tsx +5 -2
- package/src/components/principal-page.tsx +5 -4
- package/src/components/protected.tsx +39 -52
- package/src/components/references.tsx +18 -7
- package/src/components/role-editor.tsx +68 -99
- package/src/components/role-field.tsx +1 -1
- package/src/components/trusted-workloads.tsx +6 -5
- package/src/components/ui.tsx +5 -0
- package/src/lib/audit-proofs.ts +51 -0
- package/src/lib/audit-sentences.ts +490 -529
- package/src/lib/bindings.ts +6 -0
- package/src/lib/changes.ts +3 -1
- package/src/lib/coffre.ts +2 -2
- package/src/lib/queries.ts +19 -168
- package/src/lib/reveal.ts +32 -5
- package/src/lib/roles.ts +10 -36
- package/src/lib/row-reads.ts +2 -2
- package/src/lib/signin-errors.ts +5 -33
- package/src/options.ts +3 -19
- package/src/pages/account.tsx +1 -1
- package/src/pages/audit.tsx +151 -228
- package/src/pages/environment.tsx +373 -247
- package/src/pages/login.tsx +2 -4
- package/src/pages/project-environments.tsx +322 -20
- package/src/pages/service-accounts.tsx +1 -1
- package/src/pages/settings.tsx +49 -134
- package/src/pages/user.tsx +2 -2
- package/src/pages/users.tsx +1 -1
- package/src/parity.ts +11 -20
- package/src/styles/globals.css +107 -273
- package/dist/chunks/actions-log-DupYCEyV.js +0 -1134
- package/dist/chunks/actions-log-DupYCEyV.js.map +0 -1
- package/dist/chunks/directory-DrswWQLT.js.map +0 -1
- package/dist/chunks/environment-actions-8rL9Cw6X.js +0 -576
- package/dist/chunks/environment-actions-8rL9Cw6X.js.map +0 -1
- package/dist/chunks/grants-C0cb2oii.js.map +0 -1
- package/dist/chunks/offboarding-C1jbG_dk.js.map +0 -1
- package/dist/chunks/page-CfhC9Hp1.js.map +0 -1
- package/dist/chunks/personal-tokens-xC9wulhg.js.map +0 -1
- package/dist/chunks/principal-page-CdSeftGD.js.map +0 -1
- package/dist/chunks/queries-D1JuimTu.js.map +0 -1
- package/dist/chunks/references-D5llUGQL.js.map +0 -1
- package/dist/chunks/role-field-CoCv8wse.js.map +0 -1
- package/dist/chunks/signin-errors-TlQmQe0t.js.map +0 -1
- package/dist/chunks/use-change-BorW2R6C.js.map +0 -1
- package/dist/chunks/use-roles-BZnJ9Cq0.js.map +0 -1
- package/src/components/environment-actions.tsx +0 -508
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"grants-C0cb2oii.js","names":[],"sources":["../../src/components/grants.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { grantId, revokeGrant, type GrantVars } from '../lib/changes';\nimport type { FailedAdd } from '../lib/optimistic';\nimport { useCoffre } from '../lib/coffre';\nimport { projectAccessLabel } from '../lib/project-access';\nimport { keys } from '../lib/queries';\nimport { useChange, useChangeStatus } from '../lib/use-change';\nimport type { GrantRow } from '../shared/models';\nimport { RowFailure, RowPending, rowClass } from './row-state';\nimport { ConfirmButton } from './ui';\nimport { Clock, ShieldCheck } from './icons';\n\n/**\n * Grants as a table: who or where in the first column, then the access, when\n * it lapses, and a revoke.\n *\n * A project's page leads each row with the principal; a user's page leads with\n * the project. Everything after the first column is the same grant either way.\n */\nexport function GrantsTable({ lead, children }: { lead: ReactNode; children: ReactNode }) {\n return (\n <div className=\"dt-wrap\">\n <table className=\"dt grants stacks\">\n <thead>\n <tr>\n <th className=\"n\">#</th>\n <th className=\"col-principal\">{lead}</th>\n <th>\n <span className=\"th\">\n <ShieldCheck size={14} />\n Permissions\n </span>\n </th>\n <th className=\"col-expires\">\n <span className=\"th\">\n <Clock size={14} />\n Expires\n </span>\n </th>\n <th className=\"col-actions\">\n <span className=\"visually-hidden\">Actions</span>\n </th>\n </tr>\n </thead>\n <tbody>{children}</tbody>\n </table>\n </div>\n );\n}\n\nexport function GrantRowView({\n number,\n project,\n grant,\n lead,\n leadLabel,\n}: {\n number: number;\n project: string;\n grant: GrantRow;\n lead: ReactNode;\n leadLabel: string;\n}) {\n const revoke = useChange(revokeGrant(useCoffre(), project));\n const { status, dismiss } = useChangeStatus(keys.grants(project));\n const state = status(grantId(grant));\n // Someone's instance role reaching the project is shown here, and changed on their page in Users.\n const byRole = grant.scope === 'instance-role';\n const label = byRole ? grant.roleName : projectAccessLabel(grant);\n const expired = grant.expiresAt !== null && new Date(grant.expiresAt).getTime() < Date.now();\n\n return (\n <>\n <tr className={rowClass(state)}>\n <td className=\"n\">{number}</td>\n <td className=\"col-lead\" data-label={leadLabel}>\n {lead}\n </td>\n <td className=\"col-access\" data-label=\"Permissions\">\n <span className={`tag${grant.role === 'owner' ? ' tag-violet' : ''}`}>{label}</span>\n {byRole && (\n <span className=\"role-scope\" title=\"Their global role reaches this project. Change it on their page in Users.\">\n global role\n </span>\n )}\n </td>\n <td\n className={`col-expires cell-mono cell-muted${grant.expiresAt === null ? ' is-never' : ''}`}\n data-label=\"Expires\"\n >\n {grant.expiresAt === null ? (\n 'Never'\n ) : (\n <>\n <span className=\"narrow-only\">Expires </span>\n {grant.expiresAt.slice(0, 10)}\n {expired && (\n <>\n {' '}\n <span className=\"tag tag-red\">Expired</span>\n </>\n )}\n </>\n )}\n </td>\n <td className=\"col-actions\">\n {state.state === 'pending' ? (\n <RowPending status={state} />\n ) : byRole ? null : (\n <ConfirmButton\n trigger={<button className=\"act act-danger\">Revoke</button>}\n title={\n <>\n Revoke {label} from <span className=\"mono\">{grant.principalId}</span>?\n </>\n }\n body={\n <>\n They lose <strong>{label}</strong> on <span className=\"mono\">{project}</span>{' '}\n immediately, including any process using it right now. Other grants they hold\n still apply.\n </>\n }\n confirmLabel=\"Revoke access\"\n onConfirm={() => revoke(grant)}\n />\n )}\n </td>\n </tr>\n <RowFailure\n status={state}\n columns={5}\n onDismiss={() => state.state === 'failed' && dismiss(state.mutationId)}\n />\n </>\n );\n}\n\n/**\n * Grants the server refused to give: rolled back, so no row of theirs is\n * left, and listed here, after the table's rows, saying why.\n */\nexport function RefusedGrants({ refused }: { refused: RefusedGrant[] }) {\n return refused.map(({ mutationId, vars, status, dismiss }) => (\n <RowFailure key={mutationId} status={status} columns={5} onDismiss={dismiss}>\n {vars.principalId} was not given {projectAccessLabel(vars)}.\n </RowFailure>\n ));\n}\n\ntype RefusedGrant = FailedAdd<GrantVars> & { dismiss: () => void };\n\n/** The grants of one kind the server refused to give in a project, still to be said. */\nexport function useRefusedGrants(project: string, grants: GrantRow[], principalType?: GrantRow['principalType']): RefusedGrant[] {\n const { failedAdds, dismiss } = useChangeStatus(keys.grants(project));\n return failedAdds<GrantVars>(grants.map(grantId))\n .filter(({ vars }) => principalType === undefined || vars.principalType === principalType)\n .map((refused) => ({ ...refused, dismiss: () => dismiss(refused.mutationId) }));\n}\n"],"mappings":";;;;;;;;;;;;;;AAmBA,SAAgB,YAAY,EAAE,MAAM,YAAsD;CACxF,OACE,oBAAC,OAAD;EAAK,WAAU;YACb,qBAAC,SAAD;GAAO,WAAU;aAAjB,CACE,oBAAC,SAAD,EAAA,UACE,qBAAC,MAAD,EAAA,UAAA;IACE,oBAAC,MAAD;KAAI,WAAU;eAAI;IAAK,CAAA;IACvB,oBAAC,MAAD;KAAI,WAAU;eAAiB;IAAS,CAAA;IACxC,oBAAC,MAAD,EAAA,UACE,qBAAC,QAAD;KAAM,WAAU;eAAhB,CACE,oBAAC,aAAD,EAAa,MAAM,GAAK,CAAA,GAAC,aAErB;OACJ,CAAA;IACJ,oBAAC,MAAD;KAAI,WAAU;eACZ,qBAAC,QAAD;MAAM,WAAU;gBAAhB,CACE,oBAAC,OAAD,EAAO,MAAM,GAAK,CAAA,GAAC,SAEf;;IACJ,CAAA;IACJ,oBAAC,MAAD;KAAI,WAAU;eACZ,oBAAC,QAAD;MAAM,WAAU;gBAAkB;KAAa,CAAA;IAC7C,CAAA;GACF,EAAA,CAAA,EACC,CAAA,GACP,oBAAC,SAAD,EAAQ,SAAgB,CAAA,CACnB;;CACJ,CAAA;AAET;AAEA,SAAgB,aAAa,EAC3B,QACA,SACA,OACA,MACA,aAOC;CACD,MAAM,SAAS,UAAU,YAAY,UAAU,GAAG,OAAO,CAAC;CAC1D,MAAM,EAAE,QAAQ,YAAY,gBAAgB,KAAK,OAAO,OAAO,CAAC;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oBAAC,QAAD;OAAM,WAAU;iBAAQ,MAAM;MAAkB,CAAA;MAAC;KACrE,EAAA,CAAA;KAEJ,MACE,qBAAA,UAAA,EAAA,UAAA;MAAE;MACU,oBAAC,UAAD,EAAA,UAAS,MAAc,CAAA;MAAC;MAAI,oBAAC,QAAD;OAAM,WAAU;iBAAQ;MAAc,CAAA;MAAE;MAAI;KAGlF,EAAA,CAAA;KAEJ,cAAa;KACb,iBAAiB,OAAO,KAAK;IAC9B,CAAA;GAED,CAAA;EACF;KACJ,oBAAC,YAAD;EACE,QAAQ;EACR,SAAS;EACT,iBAAiB,MAAM,UAAU,YAAY,QAAQ,MAAM,UAAU;CACtE,CAAA,CACD,EAAA,CAAA;AAEN;;;;;AAMA,SAAgB,cAAc,EAAE,WAAwC;CACtE,OAAO,QAAQ,KAAK,EAAE,YAAY,MAAM,QAAQ,cAC9C,qBAAC,YAAD;EAAqC;EAAQ,SAAS;EAAG,WAAW;YAApE;GACG,KAAK;GAAY;GAAgB,mBAAmB,IAAI;GAAE;EACjD;IAFK,UAEL,CACb;AACH;;AAKA,SAAgB,iBAAiB,SAAiB,QAAoB,eAA2D;CAC/H,MAAM,EAAE,YAAY,YAAY,gBAAgB,KAAK,OAAO,OAAO,CAAC;CACpE,OAAO,WAAsB,OAAO,IAAI,OAAO,CAAC,CAAC,CAC9C,QAAQ,EAAE,WAAW,kBAAkB,KAAA,KAAa,KAAK,kBAAkB,aAAa,CAAC,CACzF,KAAK,aAAa;EAAE,GAAG;EAAS,eAAe,QAAQ,QAAQ,UAAU;CAAE,EAAE;AAClF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"offboarding-C1jbG_dk.js","names":[],"sources":["../../src/components/offboarding.tsx"],"sourcesContent":["import { Link } from '@tanstack/react-router';\nimport { credentialScopeInWords } from '@coffre/core/access';\nimport type { PrincipalReport, RemovedPrincipal } from '../shared/models';\nimport { Card } from './page';\nimport { EmptyState, Notice, Timestamp } from './ui';\nimport { PrincipalLink } from './principal';\nimport { ReadsLag } from './actions-log';\nimport { referenceProblem } from './references';\nimport { ChevronRight, Key, User } from './icons';\nimport { serviceName } from '@coffre/client';\n\n/**\n * The part of a user's or token's page that answers \"what do we change now\n * they have left?\". Owners only. Once someone is removed everything that let\n * them in is gone, but what they saw is not, nor tokens they issued.\n */\nexport function PrincipalReportCards({ report }: { report: PrincipalReport }) {\n const person = report.principalType === 'user';\n return (\n <>\n {report.status === 'removed' && <ConsiderRotating report={report} person={person} />}\n {report.issuedTokens.length > 0 && <IssuedTokens report={report} />}\n {report.references.length > 0 && <MadeReferences report={report} />}\n </>\n );\n}\n\nexport function RemovedNotice({ report }: { report: PrincipalReport }) {\n const person = report.principalType === 'user';\n return (\n <div className=\"report-notice\">\n <Notice>\n Removed\n {report.removedBy !== null && (\n <>\n {' '}by <span className=\"mono\">{report.removedBy}</span>\n </>\n )}\n {report.removedAt !== null && (\n <>\n {' '}on <Timestamp iso={report.removedAt} />\n </>\n )}\n .{' '}\n {person\n ? 'Their project access, sessions, CLI logins, personal tokens, linked sign-in accounts and connected apps were revoked, so adding them again starts from nothing.'\n : 'Its project access and every token issued to it were revoked, so adding it again starts from nothing.'}\n </Notice>\n </div>\n );\n}\n\n/**\n * The people or service accounts removed from the directory, under the live ones.\n * Removal ends their access but not the work it leaves, so they stay one click\n * away until every value they saw has been rotated.\n */\nexport function RemovedList({\n principalType,\n removed,\n reads,\n}: {\n principalType: RemovedPrincipal['principalType'];\n removed: RemovedPrincipal[];\n /** How far reads are listed, which the counts to rotate are as of (0.15's log). */\n reads?: Parameters<typeof ReadsLag>[0]['reads'];\n}) {\n const users = principalType === 'user';\n const rows = removed.filter((principal) => principal.principalType === principalType);\n if (rows.length === 0) return null;\n return (\n <>\n <h2 className=\"section-title\">Removed</h2>\n <ReadsLag reads={reads} />\n <section className=\"card\" aria-label={users ? 'Removed users' : 'Removed service accounts'}>\n <div className=\"dt-wrap\">\n <table className=\"dt directory stacks\">\n <thead>\n <tr>\n <th className=\"n\">#</th>\n <th className=\"col-principal\">\n <span className=\"th\">\n {users ? <User size={14} /> : <Key size={14} />}\n {users ? 'Email' : 'Name'}\n </span>\n </th>\n <th className=\"col-role\">Consider rotating</th>\n <th className=\"col-actions\">\n <span className=\"visually-hidden\">Report</span>\n </th>\n </tr>\n </thead>\n <tbody>\n {rows.map((principal, index) => (\n <tr key={principal.principalId} className=\"row-link\">\n <td className=\"n\">{index + 1}</td>\n <td className=\"col-lead\" data-label={users ? 'Email' : 'Name'}>\n <PrincipalLink type={principal.principalType} id={principal.principalId} stretch />\n </td>\n <td className=\"col-role\" data-label=\"Consider rotating\">\n {principal.toRotate === 0 ? (\n <span className=\"cell-muted\">Nothing</span>\n ) : (\n `${principal.toRotate} ${principal.toRotate === 1 ? 'value' : 'values'}`\n )}\n </td>\n {/* The row opens the report; the chevron says it does. */}\n <td className=\"col-actions col-open cell-muted\" aria-hidden=\"true\">\n <ChevronRight size={16} />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </section>\n </>\n );\n}\n\n/** Values a removed member saw that nobody has changed since. */\nfunction ConsiderRotating({ report, person }: { report: PrincipalReport; person: boolean }) {\n const they = person ? 'they' : 'it';\n return (\n <Card\n labelledBy=\"seen-values\"\n title=\"Consider rotating\"\n description={`Values ${they} read or wrote that nobody has changed since. Rotate each at its source, such as a new API key or database password, then save the new value here.`}\n actions={\n report.rotated > 0 && (\n <span className=\"card-aside\">{report.rotated} already rotated</span>\n )\n }\n >\n {/* Reads sealed since may yet be listed, and named here. */}\n <ReadsLag reads={report.reads} />\n {report.exposed.length === 0 ? (\n <EmptyState title=\"Nothing left to rotate\">\n {report.rotated > 0\n ? `Every value ${they} saw has had a new version since.`\n : `${person ? 'They have' : 'It has'} not read or written a value that is still current.`}\n </EmptyState>\n ) : (\n <div className=\"dt-wrap\">\n <table className=\"dt report-values\">\n <thead>\n <tr>\n <th>Secret</th>\n <th className=\"col-shrink\">Version</th>\n <th className=\"col-shrink\">Last seen</th>\n </tr>\n </thead>\n <tbody>\n {report.exposed.map((secret) => (\n <tr key={`${secret.project}/${secret.environment}/${secret.key}`}>\n <td>\n <Link\n className=\"cell-link mono\"\n to=\"/projects/$project/$environment\"\n params={{ project: secret.project, environment: secret.environment }}\n search={{ filter: secret.key }}\n >\n <span className=\"report-path\">\n {secret.project}/{secret.environment}/\n </span>\n {secret.key}\n </Link>\n </td>\n <td className=\"col-shrink cell-mono cell-muted\">v{secret.version}</td>\n <td className=\"col-shrink nowrap\">\n {secret.how === 'wrote' ? 'Wrote' : 'Read'}{' '}\n <Timestamp iso={secret.at} display=\"relative\" />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )}\n </Card>\n );\n}\n\n/**\n * References they made, as the log names them: each belongs to the\n * environment that holds it, like a value, not to them (D46), so their\n * leaving ends none. Listed to review.\n */\nfunction MadeReferences({ report }: { report: PrincipalReport }) {\n return (\n <Card\n labelledBy=\"made-references\"\n title=\"References they made\"\n description=\"These stay after they leave, and whoever reads a reference's environment reads its source through it. Review them: the source's access managers, or whoever writes where one is held, can break it.\"\n >\n <div className=\"dt-wrap\">\n <table className=\"dt stacks\">\n <thead>\n <tr>\n <th>Reference</th>\n <th>Reads</th>\n <th className=\"col-shrink\">Made</th>\n </tr>\n </thead>\n <tbody>\n {report.references.map((reference) => (\n <tr key={reference.id}>\n <td className=\"mono\" data-label=\"Reference\">{reference.holder}</td>\n <td data-label=\"Reads\">\n <span className=\"mono\">{reference.source}</span>\n {reference.state !== 'live' && <span className=\"cell-muted\"> · {referenceProblem(reference.state)}</span>}\n </td>\n <td className=\"col-shrink nowrap\" data-label=\"Made\">\n <Timestamp iso={reference.createdAt} display=\"relative\" />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </Card>\n );\n}\n\nfunction IssuedTokens({ report }: { report: PrincipalReport }) {\n return (\n <Card\n labelledBy=\"issued-tokens\"\n title=\"Bearer tokens they issued\"\n description=\"These still work, and they saw each one when it was issued. Revoke any they may have kept.\"\n >\n <div className=\"dt-wrap\">\n <table className=\"dt report-tokens\">\n <thead>\n <tr>\n <th>Token</th>\n <th className=\"col-shrink\">Expires</th>\n <th className=\"col-shrink col-hide-narrow\">Last used</th>\n </tr>\n </thead>\n <tbody>\n {report.issuedTokens.map((token) => (\n <tr key={token.id}>\n <td>\n <span className=\"cell-stack\">\n <Link className=\"cell-link mono\" to=\"/service-accounts/$account\" params={{ account: serviceName(token.service) }}>\n service:{serviceName(token.service)}\n </Link>\n <small>\n {token.label ?? 'No label'} · <span className=\"mono\">{token.hint}</span> · reaches{' '}\n {token.scope === null ? 'all its account holds' : credentialScopeInWords(token.scope)}\n </small>\n </span>\n </td>\n <td className=\"col-shrink nowrap\">\n <Timestamp iso={token.expiresAt} display=\"relative\" />\n </td>\n <td className=\"col-shrink col-hide-narrow nowrap\">\n {token.lastUsedAt === null ? (\n <span className=\"cell-muted\">Never</span>\n ) : (\n <Timestamp iso={token.lastUsedAt} display=\"relative\" />\n )}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </Card>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,SAAgB,qBAAqB,EAAE,UAAuC;CAC5E,MAAM,SAAS,OAAO,kBAAkB;CACxC,OACE,qBAAA,UAAA,EAAA,UAAA;EACG,OAAO,WAAW,aAAa,oBAAC,kBAAD;GAA0B;GAAgB;EAAS,CAAA;EAClF,OAAO,aAAa,SAAS,KAAK,oBAAC,cAAD,EAAsB,OAAS,CAAA;EACjE,OAAO,WAAW,SAAS,KAAK,oBAAC,gBAAD,EAAwB,OAAS,CAAA;CAClE,EAAA,CAAA;AAEN;AAEA,SAAgB,cAAc,EAAE,UAAuC;CACrE,MAAM,SAAS,OAAO,kBAAkB;CACxC,OACE,oBAAC,OAAD;EAAK,WAAU;YACb,qBAAC,QAAD,EAAA,UAAA;GAAQ;GAEL,OAAO,cAAc,QACpB,qBAAA,UAAA,EAAA,UAAA;IACG;IAAI;IAAG,oBAAC,QAAD;KAA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OAAW,CAAA;OAAC;OAAW;OAClF,MAAM,UAAU,OAAO,0BAA0B,uBAAuB,MAAM,KAAK;MAC/E,EAAA,CAAA,CACH;QACJ,CAAA;KACJ,oBAAC,MAAD;MAAI,WAAU;gBACZ,oBAAC,WAAD;OAAW,KAAK,MAAM;OAAW,SAAQ;MAAY,CAAA;KACnD,CAAA;KACJ,oBAAC,MAAD;MAAI,WAAU;gBACX,MAAM,eAAe,OACpB,oBAAC,QAAD;OAAM,WAAU;iBAAa;MAAW,CAAA,IAExC,oBAAC,WAAD;OAAW,KAAK,MAAM;OAAY,SAAQ;MAAY,CAAA;KAEtD,CAAA;IACF,EAAA,GAtBK,MAAM,EAsBX,CACL,EACI,CAAA,CACF;;EACJ,CAAA;CACD,CAAA;AAEV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"page-CfhC9Hp1.js","names":[],"sources":["../../src/components/mark.ts","../../src/components/icons.tsx","../../src/components/tile.tsx","../../src/lib/coffre.ts","../../src/components/page.tsx"],"sourcesContent":["/**\n * coffre's mark: a keyhole cut from a disc, which leaves a lowercase c, its\n * slot tilted up 14°. Drawn on a 32-unit grid, where 2 units are a pixel at\n * 16px.\n *\n * Everything that draws it reads this file: `Mark` in the app, the favicon,\n * and `scripts/icons.ts`, which renders the PNGs and the README's mark from\n * it. The colours stand in until the brand has its own: change them here,\n * then run `pnpm --filter @coffre/ui icons`.\n */\n\n/** 64px and up. */\nexport const MARK_PATH = 'M24.17 12.23A9 9 0 1 0 24.93 14.91L18.39 16.27A3.6 3.6 0 1 1 17.84 14.07Z';\n\n/** 48px and below: a larger disc, the hole on the pixel grid, a thicker slot, so both stay open at 16px. */\nexport const MARK_PATH_SMALL = 'M25.77 10.94A11 11 0 1 0 26.95 14.9L17.92 16.81A4 4 0 1 1 17.08 13.45Z';\n\n/** The tile behind the mark wherever it stands alone: the favicon, app icons, the README. */\nexport const TILE = '#000';\n\n/** The mark on its tile. */\nexport const INK = '#fff';\n\n/** The tile's corner radius, on the 32-unit grid. */\nexport const TILE_RADIUS = 7;\n\nexport function markPath(size: number): string {\n return size <= 48 ? MARK_PATH_SMALL : MARK_PATH;\n}\n\n/**\n * The mark on its tile, as an SVG document, drawn for `size` pixels.\n * `square` leaves the corners for the platform to round (iOS, GitHub);\n * `adaptive` swaps the colours in a dark browser, for the favicon.\n */\nexport function markSvg(size: number, { square = false, adaptive = false } = {}): string {\n const dark = adaptive ? `<style>@media (prefers-color-scheme:dark){rect{fill:${INK}}path{fill:${TILE}}}</style>` : '';\n const radius = square ? '' : ` rx=\"${TILE_RADIUS}\"`;\n return (\n `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\">${dark}` +\n `<rect width=\"32\" height=\"32\"${radius} fill=\"${TILE}\"/>` +\n `<path d=\"${markPath(size)}\" fill=\"${INK}\"/></svg>`\n );\n}\n","import type { LucideIcon } from 'lucide-react';\nimport {\n Activity as ActivityGlyph,\n ArrowRight as ArrowRightGlyph,\n Archive as ArchiveGlyph,\n Ban,\n Check as CheckGlyph,\n ChevronDown as ChevronDownGlyph,\n ChevronRight as ChevronRightGlyph,\n ChevronsUpDown as ChevronsUpDownGlyph,\n CircleAlert,\n CircleCheck,\n Clock as ClockGlyph,\n Copy as CopyGlyph,\n Ellipsis,\n Eye as EyeGlyph,\n EyeOff as EyeOffGlyph,\n Folder as FolderGlyph,\n GitFork,\n Hash as HashGlyph,\n History as HistoryGlyph,\n Inbox as InboxGlyph,\n Info as InfoGlyph,\n KeyRound,\n Layers as LayersGlyph,\n Link as LinkGlyph,\n LoaderCircle,\n Lock as LockGlyph,\n LogOut,\n Menu as MenuGlyph,\n Monitor as MonitorGlyph,\n Moon as MoonGlyph,\n PanelLeft as PanelLeftGlyph,\n Pause as PauseGlyph,\n Pencil as PencilGlyph,\n Play as PlayGlyph,\n Plus as PlusGlyph,\n RotateCcw,\n ScrollText,\n Search as SearchGlyph,\n Settings as SettingsGlyph,\n ShieldCheck as ShieldCheckGlyph,\n Shuffle as ShuffleGlyph,\n Sun as SunGlyph,\n Terminal as TerminalGlyph,\n Trash2,\n TriangleAlert,\n Upload as UploadGlyph,\n User as UserGlyph,\n UserRoundCog,\n Users as UsersGlyph,\n WandSparkles,\n X as XGlyph,\n} from 'lucide-react';\nimport { markPath } from './mark';\n\n/**\n * One icon vocabulary for the whole app: Lucide, at one stroke weight.\n *\n * Mixing icon families is the fastest way to make a product UI feel assembled\n * rather than designed, so every glyph comes through here and call sites never\n * import Lucide themselves: changing one is a line in this file. The\n * exceptions are marks that are not ours to redraw: coffre's mark and the\n * sign-in providers' logos.\n */\n\ntype IconProps = {\n size?: number;\n className?: string;\n style?: React.CSSProperties;\n /** Icons are decorative by default; pass a label when one carries meaning. */\n label?: string;\n};\n\nfunction Svg({\n size = 16,\n className,\n style,\n label,\n children,\n}: IconProps & { children: React.ReactNode }) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={1.6}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n style={style}\n aria-hidden={label === undefined}\n aria-label={label}\n role={label === undefined ? undefined : 'img'}\n >\n {children}\n </svg>\n );\n}\n\n/**\n * The mark, bare, in the text's colour, so it follows the theme. The tiled\n * favicon and app icons are drawn from the same paths, in `./mark`.\n */\nexport function Mark({ size = 16, className, style, label }: IconProps) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 32 32\"\n className={className}\n style={style}\n aria-hidden={label === undefined}\n aria-label={label}\n role={label === undefined ? undefined : 'img'}\n >\n <path d={markPath(size)} fill=\"currentColor\" />\n </svg>\n );\n}\n\n/**\n * Lucide draws on a 24-unit grid with a 2-unit stroke. At the 14-16px these\n * are shown, 1.75 sits closer to Inter's weight beside them.\n */\nconst STROKE = 1.75;\n\nfunction lucide(Glyph: LucideIcon) {\n // Lucide hides a glyph from assistive technology unless it is labelled.\n return function Icon({ size = 16, className, style, label }: IconProps) {\n return (\n <Glyph\n size={size}\n strokeWidth={STROKE}\n className={className}\n style={style}\n {...(label === undefined ? {} : { 'aria-label': label, role: 'img' })}\n />\n );\n };\n}\n\n// Places\nexport const Folder = lucide(FolderGlyph);\nexport const Fork = lucide(GitFork);\nexport const Layers = lucide(LayersGlyph);\nexport const Users = lucide(UsersGlyph);\nexport const User = lucide(UserGlyph);\n/** Your own settings, so they never share the instance's gear. */\nexport const UserCog = lucide(UserRoundCog);\nexport const Key = lucide(KeyRound);\nexport const Ledger = lucide(ScrollText);\nexport const Settings = lucide(SettingsGlyph);\n\n// Secrets\nexport const Eye = lucide(EyeGlyph);\nexport const EyeOff = lucide(EyeOffGlyph);\nexport const Copy = lucide(CopyGlyph);\nexport const Generate = lucide(WandSparkles);\nexport const Shuffle = lucide(ShuffleGlyph);\nexport const Pencil = lucide(PencilGlyph);\nexport const Archive = lucide(ArchiveGlyph);\nexport const Trash = lucide(Trash2);\nexport const History = lucide(HistoryGlyph);\nexport const RotateBack = lucide(RotateCcw);\nexport const Upload = lucide(UploadGlyph);\nexport const Pause = lucide(PauseGlyph);\nexport const Play = lucide(PlayGlyph);\nexport const Lock = lucide(LockGlyph);\nexport const Terminal = lucide(TerminalGlyph);\nexport const Hash = lucide(HashGlyph);\nexport const Clock = lucide(ClockGlyph);\n\n// Outcomes\nexport const Check = lucide(CheckGlyph);\nexport const CheckCircle = lucide(CircleCheck);\nexport const SlashCircle = lucide(Ban);\nexport const ShieldCheck = lucide(ShieldCheckGlyph);\nexport const AlertTriangle = lucide(TriangleAlert);\nexport const AlertCircle = lucide(CircleAlert);\nexport const Info = lucide(InfoGlyph);\nexport const Activity = lucide(ActivityGlyph);\nexport const Inbox = lucide(InboxGlyph);\nexport const Loader = lucide(LoaderCircle);\n\n// Controls\nexport const X = lucide(XGlyph);\nexport const Plus = lucide(PlusGlyph);\nexport const Search = lucide(SearchGlyph);\nexport const Menu = lucide(MenuGlyph);\nexport const PanelLeft = lucide(PanelLeftGlyph);\nexport const MoreHorizontal = lucide(Ellipsis);\nexport const ChevronRight = lucide(ChevronRightGlyph);\nexport const ChevronDown = lucide(ChevronDownGlyph);\nexport const ChevronsUpDown = lucide(ChevronsUpDownGlyph);\nexport const ArrowRight = lucide(ArrowRightGlyph);\nexport const Link = lucide(LinkGlyph);\nexport const SignOut = lucide(LogOut);\n\n// Theme\nexport const Sun = lucide(SunGlyph);\nexport const Moon = lucide(MoonGlyph);\nexport const Monitor = lucide(MonitorGlyph);\n\n/**\n * GitHub's mark, drawn as GitHub publishes it: a filled shape on its own\n * 16-unit grid, since a brand is not ours to redraw in the stroke style.\n */\nexport function GitHub({ size = 16, className, style }: IconProps) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 16 16\"\n fill=\"currentColor\"\n className={className}\n style={style}\n aria-hidden\n >\n <path d=\"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z\" />\n </svg>\n );\n}\n\n/** Google's \"G\", in its four colours, as Google's sign-in guidelines require. */\nexport function Google({ size = 16, className, style }: IconProps) {\n return (\n <svg width={size} height={size} viewBox=\"0 0 48 48\" className={className} style={style} aria-hidden>\n <path fill=\"#EA4335\" d=\"M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z\" />\n <path fill=\"#4285F4\" d=\"M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z\" />\n <path fill=\"#FBBC05\" d=\"M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z\" />\n <path fill=\"#34A853\" d=\"M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z\" />\n </svg>\n );\n}\n\n/** Microsoft's four squares. */\nexport function Microsoft({ size = 16, className, style }: IconProps) {\n return (\n <svg width={size} height={size} viewBox=\"0 0 21 21\" className={className} style={style} aria-hidden>\n <rect x=\"0\" y=\"0\" width=\"10\" height=\"10\" fill=\"#F25022\" />\n <rect x=\"11\" y=\"0\" width=\"10\" height=\"10\" fill=\"#7FBA00\" />\n <rect x=\"0\" y=\"11\" width=\"10\" height=\"10\" fill=\"#00A4EF\" />\n <rect x=\"11\" y=\"11\" width=\"10\" height=\"10\" fill=\"#FFB900\" />\n </svg>\n );\n}\n\n/** The mark on a provider's button; any other OpenID Connect issuer gets a key. */\nexport function ProviderMark({ brand, size = 16 }: { brand: string; size?: number }) {\n switch (brand) {\n case 'github':\n return <GitHub size={size} />;\n case 'google':\n return <Google size={size} />;\n case 'microsoft':\n return <Microsoft size={size} />;\n default:\n return <Key size={size} />;\n }\n}\n","const HUES = ['blue', 'green', 'amber', 'violet'] as const;\n\n/** The same name always lands on the same tint, on every screen (FNV-1a). */\nexport function tileHue(name: string): (typeof HUES)[number] {\n let hash = 0x811c9dc5;\n for (const char of name) hash = Math.imul(hash ^ char.charCodeAt(0), 0x01000193) >>> 0;\n return HUES[hash % HUES.length];\n}\n\n/**\n * A letter on a tint, standing in for a project wherever its name appears.\n *\n * It is a recognition aid, not information: the name is always beside it, so\n * the tile is hidden from assistive technology.\n */\nexport function Tile({ name, size = 'sm' }: { name: string; size?: 'sm' | 'lg' }) {\n return (\n <span className={`tile tile-${tileHue(name)}${size === 'lg' ? ' tile-lg' : ''}`} aria-hidden>\n {name.slice(0, 1)}\n </span>\n );\n}\n","import { CoffreError, type CoffreClient } from '@coffre/client';\nimport { useRouter } from '@tanstack/react-router';\n\nimport type { CoffreContext } from '../options';\n\n/**\n * The API as whoever is looking at the page, with their permissions: what\n * coffre's pages call, and a deployment's own may too. In the browser this\n * is plain `fetch` to `/api`, carrying the session cookie; on the server,\n * the API in process. Components call it from event handlers; loaders read\n * the same client as `context.coffre`.\n */\nexport function useCoffre(): CoffreClient {\n return (useRouter().options.context as CoffreContext).coffre;\n}\n\n/** A refusal the page words itself, shown as it is. */\nexport class Refusal extends Error {}\n\n/** A call that failed: what to say, and whether signing in again would help, which it does only for an ended session. */\ntype Failure = { ok: false; error: string; signedOut: boolean };\n\n/** The HTTP status of an API error; undefined when the request never got an answer. */\nexport function statusOf(error: unknown): number | undefined {\n return error instanceof CoffreError ? error.status : undefined;\n}\n\n/** What to tell the person when a call fails. */\nexport function failureMessage(error: unknown): string {\n if (error instanceof Refusal) return error.message;\n if (!(error instanceof CoffreError)) return 'The request could not be sent. Nothing was changed.';\n if (error.status === 401) return 'Your session has ended. Sign in again, then retry.';\n if (error.code === 'cross_origin') return 'coffre refused a change that did not come from this page. Reload, then retry.';\n // The vault's own rule, which the app could not foresee (one removed by someone else, say), in its words.\n if (error.code === 'vault_refused' && error.reason === 'not_allowed') return error.message.replace(/^the vault refused: /, '');\n if (error.status === 403) {\n return 'You hold no grant that covers this. Someone with grant.manage on the project can add one.';\n }\n if (error.status === 404) return 'Not found. It may have been renamed or archived.';\n // A 400 or 409 carries a sentence written for the person, such as which\n // field of a request is wrong, which names a service account as people\n // do, service:<name>. Anything unexpected stays generic.\n if (error.status === 400 || error.status === 409) return error.message;\n return 'coffre is unavailable. Nothing was read or written.';\n}\n\nexport function uiFailure(error: unknown): Failure {\n return { ok: false, error: failureMessage(error), signedOut: statusOf(error) === 401 };\n}\n\n/** A loader's answer: what it read, or what to say instead. */\nexport async function uiResult<T extends object>(\n operation: () => Promise<T>,\n): Promise<({ ok: true } & T) | Failure> {\n try {\n return { ok: true, ...(await operation()) };\n } catch (error) {\n return uiFailure(error);\n }\n}\n\n/** How the API names a member: `user:ada@acme.example`, `token:ci-deploy` (which people read as `service:ci-deploy`). */\nexport function memberRef(principalType: 'user' | 'service', principalId: string): string {\n return `${principalType === 'user' ? 'user' : 'token'}:${principalId}`;\n}\n","import type { ReactNode } from 'react';\nimport { Tile } from './tile';\n\n/**\n * The head of every page: an optional project tile, the title with a muted\n * aside, one line of description or facts, and the page's own actions.\n *\n * Where you are is already in the top bar's path, so the head does not repeat\n * it; it says what this page is.\n */\nexport function PageHeader({\n tile,\n lead,\n title,\n aside,\n description,\n meta,\n actions,\n}: {\n tile?: string;\n /** Stands where the tile would, for pages that are not about a project. */\n lead?: ReactNode;\n title: ReactNode;\n aside?: ReactNode;\n description?: ReactNode;\n meta?: ReactNode;\n actions?: ReactNode;\n}) {\n return (\n <header className=\"page-head\">\n <div className=\"page-head-text\">\n {tile !== undefined && <Tile name={tile} size=\"lg\" />}\n {lead}\n <div style={{ minWidth: 0 }}>\n <h1 className=\"page-title\">\n <span>{title}</span>\n {aside !== undefined && aside !== null && (\n <span className=\"page-title-aside\">{aside}</span>\n )}\n </h1>\n {description !== undefined && <p className=\"page-desc\">{description}</p>}\n {meta !== undefined && <div className=\"page-meta\">{meta}</div>}\n </div>\n </div>\n {actions !== undefined && actions !== false && (\n <div className=\"page-actions\">{actions}</div>\n )}\n </header>\n );\n}\n\n/** A bordered panel with a titled head; tables inside it run edge to edge. */\nexport function Card({\n title,\n description,\n actions,\n children,\n labelledBy,\n tone,\n wide = false,\n}: {\n title: ReactNode;\n description?: ReactNode;\n actions?: ReactNode;\n children: ReactNode;\n labelledBy: string;\n tone?: 'danger';\n /** Takes the content column whole, for a table of many or long columns. */\n wide?: boolean;\n}) {\n return (\n <section\n className={`card${tone === 'danger' ? ' card-danger' : ''}${wide ? ' card-wide' : ''}`}\n aria-labelledby={labelledBy}\n >\n <div className=\"card-head\">\n <div>\n <h2 className=\"card-title\" id={labelledBy}>\n {title}\n </h2>\n {description !== undefined && <p className=\"card-desc\">{description}</p>}\n </div>\n {actions}\n </div>\n {children}\n </section>\n );\n}\n\n/** One labelled fact in a card's `dl.facts`. */\nexport function Fact({ label, children, action }: { label: string; children: ReactNode; /** What changes it, beside it. */ action?: ReactNode }) {\n return (\n <div className={action === undefined ? 'fact' : 'fact fact-with-action'}>\n <dt>{label}</dt>\n <dd>{children}</dd>\n {action}\n </div>\n );\n}\n\n/**\n * A page that cannot be shown: no access, no such thing, or no session.\n *\n * It says which page, why in a sentence, and offers the one useful way out.\n */\nexport function ClosedDoor({\n icon,\n label,\n title,\n children,\n actions,\n}: {\n icon?: ReactNode;\n label?: ReactNode;\n title: ReactNode;\n children: ReactNode;\n actions?: ReactNode;\n}) {\n return (\n <div className=\"closed\" role=\"status\">\n {icon !== undefined && (\n <div className=\"closed-icon\" aria-hidden>\n {icon}\n </div>\n )}\n {label !== undefined && <p className=\"closed-label\">{label}</p>}\n <h1 className=\"closed-title\">{title}</h1>\n <div className=\"closed-body\">{children}</div>\n {actions !== undefined && <div className=\"closed-actions\">{actions}</div>}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAYA,IAAa,YAAY;;AAGzB,IAAa,kBAAkB;AAW/B,SAAgB,SAAS,MAAsB;CAC7C,OAAO,QAAQ,KAAK,kBAAkB;AACxC;;;;;;;AC8EA,SAAgB,KAAK,EAAE,OAAO,IAAI,WAAW,OAAO,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,EACzB,MACA,OACA,OACA,UACA,WAOC;CACD,OACE,qBAAC,OAAD;EAAK,WAAU;EAAS,MAAK;YAA7B;GACG,SAAS,KAAA,KACR,oBAAC,OAAD;IAAK,WAAU;IAAc,eAAA;cAC1B;GACE,CAAA;GAEN,UAAU,KAAA,KAAa,oBAAC,KAAD;IAAG,WAAU;cAAgB;GAAS,CAAA;GAC9D,oBAAC,MAAD;IAAI,WAAU;cAAgB;GAAU,CAAA;GACxC,oBAAC,OAAD;IAAK,WAAU;IAAe;GAAc,CAAA;GAC3C,YAAY,KAAA,KAAa,oBAAC,OAAD;IAAK,WAAU;cAAkB;GAAa,CAAA;EACrE;;AAET"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"personal-tokens-xC9wulhg.js","names":[],"sources":["../../src/components/personal-tokens.tsx"],"sourcesContent":["import type { TokenRow } from '@coffre/client';\nimport { credentialScopeInWords } from '@coffre/core/access';\nimport { Fragment, type ReactNode } from 'react';\n\nimport type { Change } from '../lib/optimistic';\nimport { useChange, useChangeStatus } from '../lib/use-change';\nimport { Key, X } from './icons';\nimport { Card } from './page';\nimport { RowFailure, RowPending, rowClass } from './row-state';\nimport { ConfirmButton, EmptyState, ErrorLine, Timestamp } from './ui';\n\n/**\n * Personal tokens, which act as their person within what each reaches:\n * your own on your account page, or a person's on theirs, for whoever runs\n * the instance. Each row says what it is called, what it reaches and when\n * it ends; Revoke stops it at its next request.\n */\nexport function PersonalTokensCard<TData>({\n tokens,\n change,\n description,\n empty,\n emptyActions,\n}: {\n tokens: TokenRow[] | { error: string };\n change: Change<TData, TokenRow, TokenRow, unknown>;\n description: ReactNode;\n /** Said when there is none: phrasing, inside the empty state's paragraph. */\n empty?: ReactNode;\n /** Beneath it, what to do about it. */\n emptyActions?: ReactNode;\n}) {\n const revoke = useChange(change);\n const { status, dismiss } = useChangeStatus(change.list.queryKey);\n return (\n <Card labelledBy=\"personal-tokens\" title=\"Personal tokens\" description={description}>\n {'error' in tokens ? (\n <div className=\"card-body\">\n <ErrorLine error={tokens.error} />\n </div>\n ) : tokens.length === 0 ? (\n <EmptyState title=\"No personal tokens\" actions={emptyActions}>\n {empty}\n </EmptyState>\n ) : (\n <div className=\"dt-wrap\">\n <table className=\"dt stacks stacks-inline\">\n <thead>\n <tr>\n <th>Token</th>\n <th>Reaches</th>\n <th className=\"col-shrink\">Last used</th>\n <th className=\"col-shrink\">Expires</th>\n <th className=\"col-actions\">\n <span className=\"visually-hidden\">Actions</span>\n </th>\n </tr>\n </thead>\n <tbody>\n {tokens.map((token) => {\n const state = status(token.id);\n return (\n <Fragment key={token.id}>\n <tr className={rowClass(state)}>\n <td>\n <span className=\"cell-account\">\n <Key size={15} />\n <span className=\"cell-stack\">\n <span>{token.label}</span>\n <small>\n <span className=\"mono\">{token.hint}</span>\n {' · made '}\n <Timestamp iso={token.createdAt} display=\"relative\" />\n </small>\n </span>\n </span>\n </td>\n <td data-label=\"Reaches\">{credentialScopeInWords(token.scope ?? {})}</td>\n <td className=\"nowrap cell-muted\" data-label=\"Last used\">\n {token.lastUsedAt === null ? (\n 'Never'\n ) : (\n <span className=\"cell-stack\">\n <Timestamp iso={token.lastUsedAt} display=\"relative\" />\n {token.lastUsedIp !== null && <small className=\"mono\">{token.lastUsedIp}</small>}\n </span>\n )}\n </td>\n <td className=\"nowrap cell-muted\" data-label=\"Expires\">\n <Timestamp iso={token.expiresAt} display=\"relative\" />\n </td>\n <td className=\"col-actions\">\n {state.state === 'pending' ? (\n <RowPending status={state} />\n ) : (\n <ConfirmButton\n trigger={\n <button className=\"act\">\n <X size={13} />\n Revoke\n </button>\n }\n title={`Revoke “${token.label}”?`}\n body={\n <>\n <span className=\"mono\">{token.hint}</span>, last used{' '}\n {token.lastUsedAt === null ? 'never' : <Timestamp iso={token.lastUsedAt} display=\"relative\" />}.\n Whatever uses it is refused at once.\n </>\n }\n confirmLabel=\"Revoke token\"\n onConfirm={() => revoke(token)}\n />\n )}\n </td>\n </tr>\n <RowFailure\n status={state}\n columns={5}\n onDismiss={() => state.state === 'failed' && dismiss(state.mutationId)}\n />\n </Fragment>\n );\n })}\n </tbody>\n </table>\n </div>\n )}\n </Card>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBA,SAAgB,mBAA0B,EACxC,QACA,QACA,aACA,OACA,gBASC;CACD,MAAM,SAAS,UAAU,MAAM;CAC/B,MAAM,EAAE,QAAQ,YAAY,gBAAgB,OAAO,KAAK,QAAQ;CAChE,OACE,oBAAC,MAAD;EAAM,YAAW;EAAkB,OAAM;EAA+B;YACrE,WAAW,SACV,oBAAC,OAAD;GAAK,WAAU;aACb,oBAAC,WAAD,EAAW,OAAO,OAAO,MAAQ,CAAA;EAC9B,CAAA,IACH,OAAO,WAAW,IACpB,oBAAC,YAAD;GAAY,OAAM;GAAqB,SAAS;aAC7C;EACS,CAAA,IAEZ,oBAAC,OAAD;GAAK,WAAU;aACb,qBAAC,SAAD;IAAO,WAAU;cAAjB,CACE,oBAAC,SAAD,EAAA,UACE,qBAAC,MAAD,EAAA,UAAA;KACE,oBAAC,MAAD,EAAA,UAAI,QAAS,CAAA;KACb,oBAAC,MAAD,EAAA,UAAI,UAAW,CAAA;KACf,oBAAC,MAAD;MAAI,WAAU;gBAAa;KAAa,CAAA;KACxC,oBAAC,MAAD;MAAI,WAAU;gBAAa;KAAW,CAAA;KACtC,oBAAC,MAAD;MAAI,WAAU;gBACZ,oBAAC,QAAD;OAAM,WAAU;iBAAkB;MAAa,CAAA;KAC7C,CAAA;IACF,EAAA,CAAA,EACC,CAAA,GACP,oBAAC,SAAD,EAAA,UACG,OAAO,KAAK,UAAU;KACrB,MAAM,QAAQ,OAAO,MAAM,EAAE;KAC7B,OACE,qBAAC,UAAD,EAAA,UAAA,CACE,qBAAC,MAAD;MAAI,WAAW,SAAS,KAAK;gBAA7B;OACE,oBAAC,MAAD,EAAA,UACE,qBAAC,QAAD;QAAM,WAAU;kBAAhB,CACE,oBAAC,KAAD,EAAK,MAAM,GAAK,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cAAa;SACb,iBAAiB,OAAO,KAAK;QAC9B,CAAA;OAED,CAAA;MACF;SACJ,oBAAC,YAAD;MACE,QAAQ;MACR,SAAS;MACT,iBAAiB,MAAM,UAAU,YAAY,QAAQ,MAAM,UAAU;KACtE,CAAA,CACO,EAAA,GA3DK,MAAM,EA2DX;IAEd,CAAC,EACI,CAAA,CACF;;EACJ,CAAA;CAEH,CAAA;AAEV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"principal-page-CdSeftGD.js","names":[],"sources":["../../src/lib/service-setup.ts","../../src/lib/access-plan.ts","../../src/components/expiry-field.tsx","../../src/components/principal-page.tsx"],"sourcesContent":["import { inScope, PROJECT_ONLY_PERMISSIONS, type Permission, type Role, type Scope } from '@coffre/core/access';\nimport type { RoleView } from '@coffre/client';\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 /** The instance's roles, as the policy defines them (`useRoles`). */\n roles: readonly Pick<RoleView, 'id' | 'permissions' | 'assignableToEnvironment'>[];\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. An\n * environment takes only the roles that hold nothing project-wide. A\n * project's role reaches its protected environments too, where the service\n * holds the role's normal column and you your protected one: you hold that\n * normal column there as well, or give none.\n *\n * a Developer of every dev, at market/dev viewer, contributor, developer\n * the same, at market none: a project takes holding all of it\n * a Developer of market, prod protected contributor: viewer and developer read prod, which you only use\n */\nexport function givable(holder: Holder, project: ProjectSummary, environment: string | null): Role[] {\n const heldIn = (slug: string) => holder.environments.find((entry) => entry.project === project.slug && entry.environment === slug)?.permissions ?? [];\n const held = environment === null ? project.permissions : heldIn(environment);\n const roles = holder.roles.filter((role) => environment === null || role.assignableToEnvironment);\n if (held.includes('grant.manage')) return roles.map((role) => role.id);\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 const reached = environment === null ? project.environments.filter((candidate) => candidate.protected && !candidate.personal).map((candidate) => heldIn(candidate.slug)) : [];\n const gives = (permission: Permission) =>\n held.includes(permission) && (PROJECT_ONLY_PERMISSIONS.includes(permission) || reached.every((there) => there.includes(permission)));\n // A role that holds nothing is given where its giver manages access alone, as the server decides (`givesService`).\n return roles.filter((role) => role.permissions.length > 0 && role.permissions.every(gives)).map((role) => role.id);\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\n/**\n * What a service's new token or binding will not read, as the server said\n * (`withheld`), in a sentence: the sensitive values of these places, which\n * only one an Owner of their project issues reads (R32). Null for none.\n *\n * ['backend/dev'] It will not read the sensitive values of backend/dev: only one an Owner of backend issues does.\n */\nexport function withheldInWords(withheld: readonly string[] | undefined, what: 'token' | 'binding'): string | null {\n if (withheld === undefined || withheld.length === 0) return null;\n const projects = [...new Set(withheld.map((path) => path.split('/')[0]!))];\n const by = projects.length === 1 ? `an Owner of ${projects[0]}` : 'an Owner of their project';\n return `This ${what} will not read the sensitive values of ${withheld.join(', ')}: only one ${by} ${what === 'token' ? 'issues' : 'saves'} does.`;\n}\n","import type { AccessValue } from '@coffre/client';\nimport { assignableToEnvironment, type Role } from '@coffre/core/access';\n\nimport type { GrantRow } from '../shared/models';\n\n/** A role on one environment, and when it ends: an ISO instant, or null for never. */\nexport type EnvironmentAccess = { role: Role; expiresAt: string | null };\n\n/**\n * What one project is set to in a principal's access editor: nothing, one\n * role on the whole project, or a role 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 -- read everywhere plus\n * write on one environment, or a grant on an environment the editor does not\n * list. The editor shows them and leaves them alone unless another setting\n * is picked.\n */\nexport type AccessPlan = {\n level: 'none' | 'project' | 'env' | 'custom';\n /** The role on the whole project, at level `project`. */\n role: Role | null;\n /** When the project-wide role 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\nconst NONE: AccessPlan = { level: 'none', role: null, expiresAt: null, environments: {} };\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 NONE;\n\n const [only] = grants;\n if (grants.length === 1 && only.environmentSlug === null) {\n return { level: 'project', role: 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 (slug === null || !environments.includes(slug) || Object.hasOwn(perEnvironment, slug)) {\n return { ...NONE, level: 'custom' };\n }\n perEnvironment[slug] = { role: grant.role, expiresAt: grant.expiresAt };\n }\n return { level: 'env', role: null, expiresAt: null, environments: perEnvironment };\n}\n\n/**\n * Switch a plan's level, with its role for `project`. Going from one role\n * on the whole project to per environment starts every environment at that\n * role and expiry, where an environment takes it, so the switch alone keeps\n * the same reach.\n */\nexport function withLevel(\n plan: AccessPlan,\n level: AccessPlan['level'],\n environments: readonly string[],\n { role = null, assignable = (each) => assignableToEnvironment(each) }: { role?: Role | null; assignable?: (role: Role) => boolean } = {},\n): AccessPlan {\n if (\n level === 'env' &&\n plan.level === 'project' &&\n plan.role !== null &&\n assignable(plan.role) &&\n Object.keys(plan.environments).length === 0\n ) {\n const access = { role: plan.role, expiresAt: plan.expiresAt };\n return {\n ...plan,\n level,\n role: null,\n environments: Object.fromEntries(environments.map((slug) => [slug, access])),\n };\n }\n return { ...plan, level, role: level === 'project' ? role : null };\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 'project':\n return plan.role === null ? [] : [{ role: plan.role, 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 : { 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 { 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 { roleNameOf } from '../lib/roles';\nimport { useRoles } from '../lib/use-roles';\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 { roles } = useRoles();\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 holder = { ...shell, roles };\n const listed = yours ? serviceProjects(holder) : managedProjects(shell.projects);\n return {\n access,\n error,\n offers: yours\n ? (project, environment) => givable(holder, project, environment)\n : (_project, environment) => roles.filter((role) => environment === null || role.assignableToEnvironment).map((role) => role.id),\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 const { instanceRoles } = useRoles();\n if (access.instanceRole === 'member') return null;\n const name = roleNameOf(instanceRoles, 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 global 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 { roles } = useRoles();\n const kind = KIND[principalType];\n const nameOf = (role: Role) => roleNameOf(roles, role);\n const assignable = (role: Role) => roles.some((each) => each.id === role && each.assignableToEnvironment);\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 === 'project' ? `role:${plan.role}` : plan.level}\n onChange={(event) => {\n const value = event.target.value;\n edit(\n value.startsWith('role:')\n ? withLevel(plan, 'project', environments, { role: value.slice('role:'.length), assignable })\n : withLevel(plan, value as AccessPlan['level'], environments, { assignable }),\n );\n }}\n >\n {held.level === 'custom' && <option value=\"custom\">Keep as is</option>}\n <option value=\"none\">No access</option>\n {/* What you may give on the whole project, and what they hold there already, given or not. */}\n {[...new Set([...whole, ...(plan.level === 'project' && plan.role !== null ? [plan.role] : [])])].map((role) => (\n <option key={role} value={`role:${role}`}>\n {role === 'owner' ? nameOf(role) : `${nameOf(role)}: all`}\n </option>\n ))}\n {environments.some((slug) => each[slug]!.length > 0) && <option value=\"env\">Per environment…</option>}\n </select>\n {plan.level === 'project' && (\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 === '' ? null : { role, expiresAt: current?.expiresAt ?? null },\n ),\n );\n }}\n >\n <option value=\"\">No access</option>\n {[...new Set([...each[slug]!, ...(current === null ? [] : [current.role])])].map((role) => (\n <option key={role} value={role}>\n {nameOf(role)}\n </option>\n ))}\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} roleName={nameOf} />\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, roleName }: { change: AccessChange; roleName: (role: Role) => string }) {\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: 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,QAAQ,QAAgB,SAAyB,aAAoC;CACnG,MAAM,UAAU,SAAiB,OAAO,aAAa,MAAM,UAAU,MAAM,YAAY,QAAQ,QAAQ,MAAM,gBAAgB,IAAI,CAAC,EAAE,eAAe,CAAC;CACpJ,MAAM,OAAO,gBAAgB,OAAO,QAAQ,cAAc,OAAO,WAAW;CAC5E,MAAM,QAAQ,OAAO,MAAM,QAAQ,SAAS,gBAAgB,QAAQ,KAAK,uBAAuB;CAChG,IAAI,KAAK,SAAS,cAAc,GAAG,OAAO,MAAM,KAAK,SAAS,KAAK,EAAE;CACrE,MAAM,UAAU,OAAO;CAEvB,MAAM,QAAQ,gBAAgB,OAC1B,EAAE,WAAW,QAAQ,KAAK,IAC1B;EAAE,WAAW,QAAQ;EAAM,eAAe;EAAa,iBAAiB;CAAY;CACxF,IAAI,YAAY,QAAQ,CAAC,QAAQ,SAAS,KAAK,GAAG,OAAO,CAAC;CAC1D,MAAM,UAAU,gBAAgB,OAAO,QAAQ,aAAa,QAAQ,cAAc,UAA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/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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queries-D1JuimTu.js","names":[],"sources":["../../src/lib/project-environments.ts","../../src/lib/capabilities.ts","../../src/lib/queries.ts"],"sourcesContent":["import type { ProjectSummary } from '../shared/models';\n\nexport type ProjectEnvironment = ProjectSummary['environments'][number];\nexport type DetailedProjectEnvironment = ProjectEnvironment & {\n details: NonNullable<ProjectEnvironment['details']>;\n};\n\nexport function hasEnvironmentDetails(\n environment: ProjectEnvironment,\n): environment is DetailedProjectEnvironment {\n return environment.details !== null;\n}\n\nexport function isActiveAccessibleEnvironment(\n environment: ProjectEnvironment,\n): environment is ProjectEnvironment & {\n accessible: true;\n details: { archivedAt: null; secretCount: number };\n} {\n return environment.accessible\n && environment.details !== null\n && environment.details.archivedAt === null;\n}\n","import { administers, makesProjects, ownsInstance } from '@coffre/core/access';\n\nimport type { Me, Permission, ProjectSummary } from '../shared/models';\n\n/**\n * The small set of instance-wide decisions the shell has to make.\n *\n * Resource-specific controls still use the permissions returned for that\n * project or environment. These are only the capabilities whose affordances\n * live outside one resource page.\n */\nexport type UiCapabilities = {\n /** Admins and owners, scoped or not: the Users and Service accounts pages. */\n canManageGrants: boolean;\n /**\n * Admins and owners whose scope narrows nothing: adding and removing\n * people and service accounts, instance roles, tokens and trust bindings,\n * offboarding reports, the instance's keys.\n */\n runsInstance: boolean;\n /**\n * Owners whose scope narrows nothing: they alone make someone an Owner,\n * and change or remove one, their own role included.\n */\n ownsInstance: boolean;\n /**\n * Who sets up service accounts: those who run the instance, and a person\n * who holds access somewhere the instance's setting takes in. The Service\n * accounts page lists them the ones they manage.\n */\n setsUpServices: boolean;\n canReadAudit: boolean;\n canCreateProject: boolean;\n};\n\nconst NONE: UiCapabilities = {\n canManageGrants: false,\n runsInstance: false,\n ownsInstance: false,\n setsUpServices: false,\n canReadAudit: false,\n canCreateProject: false,\n};\n\nexport function deriveUiCapabilities(\n me: Me | null,\n projects: readonly ProjectSummary[],\n): UiCapabilities {\n if (me === null) return NONE;\n\n const role = me.instanceRole;\n\n return {\n // Users and Service accounts list the instance's directory, for those\n // who manage access across projects. Project access managers keep their\n // grant controls on each project page.\n canManageGrants: administers(role),\n runsInstance: me.runsInstance,\n ownsInstance: ownsInstance({ role, scope: me.scope }),\n setsUpServices: me.setsUpServices,\n canReadAudit: me.canReadAudit,\n // A new project is one no `only` list names: as the server decides,\n // from the role and the scope, projects by slug.\n canCreateProject: makesProjects({ role, scope: me.scope, grants: [] }),\n };\n}\n\n/** Secret values are available only where the API reports secret.read. */\nexport function canRevealSecrets(permissions: readonly Permission[]): boolean {\n return permissions.includes('secret.read');\n}\n","import type { AuthInfo, CoffreClient, Member } from '@coffre/client';\nimport { EVERYWHERE, INSTANCE_ROLES } from '@coffre/core/access';\nimport { QueryClient, queryOptions, type FetchQueryOptions, type QueryKey } from '@tanstack/react-query';\n\nimport { deriveUiCapabilities } from './capabilities.ts';\nimport { memberRef, statusOf, uiResult } from './coffre.ts';\nimport { isActiveAccessibleEnvironment } from './project-environments.ts';\nimport type { DirectoryPrincipal, GrantRow, Me, ProjectSummary } from '../shared/models';\n\n/**\n * Every read the pages make, cached by TanStack Query: one cache per request\n * on the server, whose reads the page carries to the browser's, and one in the\n * browser for the whole visit.\n *\n * How fresh a page is. A read is reused for `FRESH_MS`, refetched when the\n * window regains focus, and refetched at once by any change made here, which\n * names what it touches (`affects`), so your own changes always show.\n * Someone else's change shows within that window. Nothing is decided on a\n * cached read: the server authorizes every call, so a stale screen can offer\n * an action the server then refuses, never grant one. The audit log is the\n * exception, read fresh on every visit: its whole point is to be current.\n * The chain's verification is read once a visit like the rest, and again\n * after any change made here.\n */\nexport const FRESH_MS = 10_000;\n\nexport function createQueryClient(): QueryClient {\n return new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: FRESH_MS,\n refetchOnWindowFocus: true,\n // A read either answers or says why it cannot (`uiResult`), so a\n // throw is a fault, and asking again would only repeat it.\n retry: false,\n },\n },\n });\n}\n\ntype Place = { project: string; environment: string };\n\n/**\n * The keys, which `affects` names too. A project's keys start with it, so\n * one invalidation covers everything read under it.\n */\nexport const keys = {\n me: ['me'],\n auth: ['auth'],\n projects: ['projects'],\n grants: (project: string) => ['grants', project],\n secrets: ({ project, environment }: Place) => ['secrets', project, environment],\n references: (path: string) => ['references', path],\n missing: ({ project, environment }: Place) => ['missing', project, environment],\n personal: (project: string) => ['personal', project],\n directory: ['directory'],\n report: (member: string) => ['report', member],\n memberAccess: (member: string) => ['member-access', member],\n credentials: (member: string) => ['credentials', member],\n bindings: (member: string) => ['bindings', member],\n githubRepositories: ['github-repositories'],\n tokenPlan: (member: string, scope: Record<string, string>) => ['token-plan', member, scope],\n identities: ['identities'],\n sessions: ['sessions'],\n apps: ['apps'],\n audit: ['audit'],\n auditKeys: ['audit', 'keys'],\n settings: ['settings'],\n roles: ['roles'],\n} satisfies Record<string, QueryKey | ((...args: never[]) => QueryKey)>;\n\n/** Members' grants, as rows, and a row for each one whose instance role reaches the place listed. */\nfunction grantRows(members: Member[]): GrantRow[] {\n return members.flatMap((member): GrantRow[] => [\n ...(member.reachesByRole\n ? [{\n id: `${member.member}/instance-role`,\n principalType: member.principalType,\n principalId: member.principalId,\n role: member.instanceRole,\n roleName: INSTANCE_ROLES[member.instanceRole].name,\n permissions: [...INSTANCE_ROLES[member.instanceRole].permissions],\n scope: 'instance-role' as const,\n environmentSlug: null,\n expiresAt: null,\n }]\n : []),\n ...member.grants.map((grant) => ({\n id: grant.id,\n principalType: member.principalType,\n principalId: member.principalId,\n role: grant.role,\n roleName: grant.roleName,\n permissions: grant.permissions,\n scope: grant.environment === null ? ('project' as const) : ('environment' as const),\n environmentSlug: grant.environment,\n expiresAt: grant.expiresAt,\n })),\n ]);\n}\n\nfunction listDirectory(client: CoffreClient) {\n return uiResult(async () => {\n const { members, removed, reads } = await client.members.list();\n const principals: DirectoryPrincipal[] = members.map(\n ({ principalType, principalId, instanceRole, scope, tampered, managed, declared, grants }) => ({\n principalType,\n principalId,\n instanceRole,\n scope,\n tampered,\n managed,\n declared,\n grants: grants.map(({ project, environment }) => ({ project, environment })),\n }),\n );\n // How far reads are listed, under 0.15's log, which the counts of what the removed saw are as of (T166).\n return { principals, removed, ...(reads === undefined ? {} : { reads }) };\n });\n}\n\nconst readProjects = (client: CoffreClient) => uiResult(() => client.projects.list());\n\n/** The projects you can see, or why they could not be listed. */\nexport type ProjectsResult = Awaited<ReturnType<typeof readProjects>>;\n\nexport type AuditSearch = { decision?: 'deny'; actorId?: string; detail?: '1' };\n\n/** Settings' tabs past the first, General, by their `?tab=`. */\nexport const SETTINGS_TABS = ['roles', 'keys'] as const;\nexport type SettingsTab = (typeof SETTINGS_TABS)[number];\n/** Settings' search: its tab, and on Roles, `roles=global` for the global roles rather than the project roles. */\nexport type SettingsSearch = { tab?: SettingsTab; roles?: 'global' };\n\nexport const AUDIT_PAGE_SIZE = 200;\n\nexport const queries = {\n /** Who is looking; null when nobody is signed in. */\n me: (client: CoffreClient) =>\n queryOptions({\n queryKey: keys.me,\n queryFn: async (): Promise<Me | null> => {\n try {\n return await client.me();\n } catch (error) {\n if (statusOf(error) === 401) return null;\n throw error;\n }\n },\n }),\n\n /** How this instance signs people in. */\n auth: (client: CoffreClient) => queryOptions({ queryKey: keys.auth, queryFn: (): Promise<AuthInfo> => client.auth() }),\n\n /** The projects you can see, each with its distinct secret count. */\n projects: (client: CoffreClient) =>\n queryOptions({ queryKey: keys.projects, queryFn: () => readProjects(client) }),\n\n /**\n * The repositories the deployment's GitHub App is installed on, for the\n * Trust dialog's picker; `{ app: null }` without one. Each listing asks\n * GitHub, so it is kept a minute, and not asked again on focus.\n */\n githubRepositories: (client: CoffreClient) =>\n queryOptions({\n queryKey: keys.githubRepositories,\n queryFn: () => client.bindings.repositories(),\n staleTime: 60_000,\n refetchOnWindowFocus: false,\n }),\n\n /**\n * What a service's token would reach, as the server would issue it now,\n * and the sensitive values it would not read (`withheld`); issues\n * nothing. A scope the server refuses plans nothing: issuing says why.\n * Any other failure is one, asked once.\n */\n tokenPlan: (client: CoffreClient, member: string, scope: Record<string, string>) =>\n queryOptions({\n queryKey: keys.tokenPlan(member, scope),\n queryFn: () => client.tokens.preview(member, { label: null, expiresInDays: 1, scope }).catch((failure: unknown) => {\n const status = statusOf(failure);\n if (status !== undefined && status >= 400 && status < 500) return null;\n throw failure;\n }),\n staleTime: 60_000,\n refetchOnWindowFocus: false,\n retry: false,\n }),\n\n /** Who holds what in a project, for those who manage its access. */\n grants: (client: CoffreClient, project: string) =>\n queryOptions({\n queryKey: keys.grants(project),\n queryFn: () => uiResult(async () => ({ grants: grantRows((await client.members.list(project)).members) })),\n }),\n\n secrets: (client: CoffreClient, place: Place) =>\n queryOptions({\n queryKey: keys.secrets(place),\n queryFn: () => uiResult(() => client.secrets.list(`${place.project}/${place.environment}`)),\n }),\n\n /** What an environment lacks of its siblings' keys, read or not, and what its team dismissed. */\n missing: (client: CoffreClient, place: Place) =>\n queryOptions({\n queryKey: keys.missing(place),\n queryFn: () => uiResult(() => client.environments.missing(`${place.project}/${place.environment}`)),\n }),\n\n /** A project's personal configs, for whoever manages its environments: whose, of what, and their key names. */\n personal: (client: CoffreClient, project: string) =>\n queryOptions({\n queryKey: keys.personal(project),\n queryFn: () => uiResult(() => client.environments.personal(project)),\n }),\n\n /** The live references into and out of a place, and who reads through them, for whoever manages its access. */\n references: (client: CoffreClient, path: string) =>\n queryOptions({\n queryKey: keys.references(path),\n queryFn: () => uiResult(() => client.references.list(path)),\n }),\n\n /**\n * Everyone in the directory, and who was removed. The API shows grant\n * managers the members of their projects; the directory pages are admins'\n * and owners', and asking for anyone else would only log a refusal, so\n * nobody else is asked.\n */\n directory: (client: CoffreClient, owner: boolean) =>\n queryOptions({\n queryKey: [...keys.directory, { owner }],\n queryFn: () =>\n owner\n ? listDirectory(client)\n : Promise.resolve({\n ok: false as const,\n error: 'Only admins and owners manage users, and service accounts are set up by those who hold access where the instance lets them.',\n signedOut: false,\n }),\n }),\n\n /**\n * One member's instance role and scope, and the grants you manage, in one\n * read: their page's Access tab. Null for whoever may list nobody, which\n * asking would only log as a refusal.\n */\n memberAccess: (client: CoffreClient, member: string, allowed: boolean) =>\n queryOptions({\n queryKey: [...keys.memberAccess(member), { allowed }],\n queryFn: () => (allowed ? uiResult(() => client.members.access(member)) : Promise.resolve(null)),\n }),\n\n /** What one member can reach and has seen; null for anyone but owners, who alone may ask. */\n report: (client: CoffreClient, member: string, owner: boolean) =>\n queryOptions({\n queryKey: [...keys.report(member), { owner }],\n queryFn: () =>\n owner\n ? uiResult(async () => {\n try {\n return { report: await client.members.get(member) };\n } catch (error) {\n // No such member is an answer, not a failure.\n if (statusOf(error) === 404) return { report: null };\n throw error;\n }\n })\n : Promise.resolve(null),\n }),\n\n /**\n * A token's credentials; null where they cannot be listed. Only owners\n * issue and see them, and only coffre's own sign-in issues any.\n */\n credentials: (client: CoffreClient, member: string, allowed: boolean) =>\n queryOptions({\n queryKey: [...keys.credentials(member), { allowed }],\n queryFn: () => (allowed ? uiResult(() => client.tokens.list(member)) : Promise.resolve(null)),\n }),\n\n /**\n * A token's trust bindings: the CI runs that may sign in as it. Null for\n * anyone but an owner, and where the deployment trusts no workloads\n * (`features.workloads`), so there is nothing to ask.\n */\n bindings: (client: CoffreClient, member: string, allowed: boolean) =>\n queryOptions({\n queryKey: [...keys.bindings(member), { allowed }],\n queryFn: () => (allowed ? uiResult(() => client.bindings.list(member)) : Promise.resolve(null)),\n }),\n\n /** The accounts you sign in with, under coffre's own sign-in. */\n identities: (client: CoffreClient) =>\n queryOptions({ queryKey: keys.identities, queryFn: () => uiResult(() => client.identities.list()) }),\n\n /** Where you are signed in, under coffre's own sign-in. */\n sessions: (client: CoffreClient) =>\n queryOptions({ queryKey: keys.sessions, queryFn: () => uiResult(() => client.sessions.list()) }),\n /** The MCP clients I connected, where the deployment serves MCP (`features.mcp`). */\n apps: (client: CoffreClient) =>\n queryOptions({ queryKey: keys.apps, queryFn: () => uiResult(() => client.apps.list()) }),\n\n /**\n * What the keys an operator keeps are checked against: the vault's ID and\n * the app key's fingerprint, no secret. Null for anyone but owners and root\n * admins, who alone may ask.\n */\n auditKeys: (client: CoffreClient, allowed: boolean) =>\n queryOptions({\n queryKey: [...keys.auditKeys, { allowed }],\n queryFn: () => (allowed ? uiResult(() => client.audit.keys()) : Promise.resolve(null)),\n }),\n\n /** The instance's settings: null for anyone but those who run it, who alone may ask. */\n settings: (client: CoffreClient, allowed: boolean) =>\n queryOptions({\n queryKey: [...keys.settings, { allowed }],\n queryFn: () => (allowed ? uiResult(() => client.settings.get()) : Promise.resolve(null)),\n }),\n\n /**\n * The instance's roles and instance roles, as an Owner edited and made\n * them (docs/design/roles.md), and whether the caller edits them. Any\n * member reads them: they are what every grant picker offers.\n */\n roles: (client: CoffreClient) =>\n queryOptions({ queryKey: keys.roles, queryFn: () => uiResult(() => client.roles.list()) }),\n\n /** A page of the log, as filtered: always read fresh. */\n auditEntries: (client: CoffreClient, search: AuditSearch) =>\n queryOptions({\n queryKey: [...keys.audit, 'entries', search],\n staleTime: 0,\n // Detail is left out by the server unless asked for, and counted.\n queryFn: () =>\n uiResult(() =>\n client.audit.list({\n limit: AUDIT_PAGE_SIZE,\n decision: search.decision,\n actor: search.actorId,\n detail: search.detail,\n // What 0.15's sealed log alone records too: sign-ins through trust bindings, tokens' issues, revokes and sign-outs.\n sealed: '1',\n }),\n ),\n }),\n\n /**\n * Whether the log holds: verified with each visit, and rendered with the\n * page, the loader's read to carry to the browser: it is not asked again on\n * mount, and not for a filter change or a hover, which `FRESH_MS` covers.\n * It reads what was written since the newest checkpoint, so it takes as\n * long as five minutes of the log, however long the log. It never rejects:\n * a check that could not run is its verdict (`unknown`).\n */\n auditChain: (client: CoffreClient) =>\n queryOptions({ queryKey: [...keys.audit, 'chain'], refetchOnMount: false, queryFn: () => verifyChain(client) }),\n /** What deleting `market` or `market/prod` would take, asked afresh each time it is shown. */\n deletion: (client: CoffreClient, path: string) =>\n queryOptions({\n queryKey: ['deletion', path],\n staleTime: 0,\n gcTime: 0,\n queryFn: () =>\n uiResult(async () => {\n const { deletion } = path.includes('/')\n ? await client.environments.previewDelete(path)\n : await client.projects.previewDelete(path);\n return { deletion };\n }),\n }),\n};\n\n/**\n * Whether the log holds, or why that is not known. Verifying is for those\n * who read the whole log (an Auditor, Admin or Owner whose scope narrows\n * nothing): anyone else reads their projects' part of it, and a part cannot be\n * checked as a chain, so for them it is a fact about the page, not a fault.\n */\nasync function verifyChain(client: CoffreClient) {\n const [chain, trees] = await Promise.allSettled([client.audit.verify(), client.audit.verifyTrees()]);\n if (chain.status === 'rejected') return chainUnknown(chain.reason);\n return withTrees(chain.value, false, trees);\n}\n\n/**\n * 0.14's verdict with 0.15's check beside it, each settled apart: a check\n * of 0.15's log that could not run says so beside 0.14's verdict, never in\n * its place, on a visit and after a walk alike.\n */\nexport function withTrees(chain: Awaited<ReturnType<CoffreClient['audit']['verify']>>, whole: boolean, trees: PromiseSettledResult<TreesResult>) {\n if (trees.status === 'fulfilled') return chainResult(chain, whole, trees.value);\n // Whatever turned it away, a refusal included (access narrowed between the two, review r11): not checked, never \"Verified\".\n const failed = chainUnknown(trees.reason);\n const problem = failed.integrity === 'unknown' ? failed.problem : 'the request was refused (HTTP 403)';\n return { ...chainResult(chain, whole), ...(chain.ok ? { treesFailed: `coffre could not check the sealed log: ${problem}` } : {}) };\n}\n\n/** 0.15's log as its check found it (`audit.verifyTrees`): `kept` false where the instance keeps 0.14's alone. */\nexport type TreesResult = Awaited<ReturnType<CoffreClient['audit']['verifyTrees']>>;\n\n/**\n * 0.15's log checked whole, as a walk from the first entry has it: its trees\n * from the newest checkpoint, and the reads the pages list held to the uses\n * it sealed (`audit.verifyReads`, T166), whose problems are the log's.\n */\nexport async function wholeTrees(client: CoffreClient): Promise<TreesResult> {\n const [trees, reads] = await Promise.all([client.audit.verifyTrees(), client.audit.verifyReads()]);\n if (!trees.kept || !reads.kept || reads.ok) return trees;\n return { ...trees, ok: false, problems: [...trees.problems, ...reads.problems.map((problem) => `the reads' listing: ${problem}`)] };\n}\n\n/**\n * A verdict as the page shows it: `whole` when it comes from the walk\n * from the first entry, which someone asked for, not from the newest\n * checkpoint's. Where the instance keeps 0.15's log too, its check\n * (`trees`) is part of it: what it finds breaks the log as 0.14's would.\n */\nexport function chainResult(result: Awaited<ReturnType<CoffreClient['audit']['verify']>>, whole: boolean, trees: TreesResult = { kept: false }) {\n // More entries above the newest checkpoint than a check reads: a checkpointer behind, not a break (review r4 of W240).\n const behind = trees.kept && trees.capped;\n if (result.ok && trees.kept && trees.problems.length > 0) {\n const more = trees.problems.length - 1;\n return {\n integrity: 'broken' as const,\n through: result.through,\n failedAtSeq: null,\n author: 'vault' as const,\n reason: `the sealed log: ${trees.problems[0]}${more > 0 ? ` (and ${more} more)` : ''}`,\n };\n }\n return result.ok\n ? {\n integrity: 'intact' as const,\n whole,\n through: result.through,\n entries: result.entries,\n // A server older than 0.10.1 checked from the first entry, and reached the head.\n from: result.from ?? 0,\n remaining: result.remaining ?? 0,\n checkpoint: result.checkpoint,\n pending: result.pending ?? 0,\n /**\n * Why the check of 0.15's log could not run, or stopped short of its head (`treesBehind`): the chain's verdict\n * stands, the sealed log's is not known.\n */\n treesFailed: behind\n ? `coffre checked the sealed log's first ${trees.unsealed.toLocaleString('en')} entries above its newest checkpoint, not the rest: the checkpointer is behind`\n : (null as string | null),\n /** The sealed log checked, but not to its head: more entries wait above its newest checkpoint than a check reads. */\n treesBehind: behind,\n /** 0.15's log, where it is kept: the newest pair its check reached. */\n trees: trees.kept ? { checkpoint: trees.checkpoint, pending: trees.capped ? trees.unsealed : 0 } : null,\n }\n : {\n integrity: 'broken' as const,\n through: result.through,\n failedAtSeq: result.failedAtSeq,\n author: result.author,\n reason: result.reason,\n };\n}\n\n/**\n * What the page shows, of the check from the newest checkpoint (`quick`)\n * and the walk from the first entry, once someone ran it (`whole`). A break\n * the walk found stands; otherwise the newer check says how the log is now,\n * broken, partly checked or not checked at all; and only while it found the\n * log whole too does the walk's verdict, which read further back, stand\n * over it.\n *\n * whole broken → whole\n * whole intact, quick intact, 0 remaining, sealed log checked → whole\n * whole intact, quick anything else → quick\n *\n * A newer check that could not check the sealed log (review r10) is\n * \"anything else\": the walk's seal would stand over a log nobody can now\n * say holds.\n */\nexport function shownChain(quick: ChainResult, whole: ChainResult | null): ChainResult {\n if (whole === null || whole.integrity === 'broken') return whole ?? quick;\n return quick.integrity === 'intact' && quick.remaining === 0 && quick.treesFailed === null && whole.integrity === 'intact' ? whole : quick;\n}\n\n/** Why the log's verdict is not known: closed to the caller, or no answer. */\nexport function chainUnknown(error: unknown) {\n const status = statusOf(error);\n if (status === 403) return { integrity: 'owners-only' as const };\n return {\n integrity: 'unknown' as const,\n problem: status === undefined ? 'the request never got an answer' : `the request failed with HTTP ${status}`,\n };\n}\n\nexport type ChainResult = Awaited<ReturnType<typeof verifyChain>>;\n\n/**\n * Who is looking, how this instance signs people in, and the projects they\n * can see: what the shell needs on every screen. For someone signed out or\n * not yet a member the project list is refused, and they get the sign-in or\n * closed-door page.\n */\nexport function shellOf(\n auth: AuthInfo,\n me: Me | null,\n projects: ProjectsResult,\n) {\n const listed = projects.ok ? projects.projects : [];\n const member: Me | null = me?.registered === true ? me : null;\n return {\n auth,\n principal: me === null ? null : me.principal,\n instanceRole: member?.instanceRole ?? null,\n /** Where their instance role applies, projects by slug. */\n scope: member?.scope ?? EVERYWHERE,\n projects: listed,\n capabilities: deriveUiCapabilities(member, listed),\n registrationRequired: me !== null && !me.registered,\n /** A member the vault refuses: their record failed its integrity check. */\n accessTampered: me?.tampered === true,\n /** What the deployment's configuration turns on: MCP clients, as their endpoint's URL, and CI runs signing in by their ID tokens. */\n features: member?.features ?? { mcp: null, workloads: false },\n /** Every environment you hold something in, and what: what you may give a service account there (`givable`). */\n environments: member?.environments ?? [],\n /** Where you set up service accounts yourself, the instance's setting, projects by slug. */\n serviceSetup: member?.serviceSetup ?? null,\n };\n}\n\nexport type Shell = ReturnType<typeof shellOf>;\n\n/**\n * How a loader reads. `fresh`, a page's own reads: the cached answer within\n * `FRESH_MS`, else the network's, waited for. `cached`, a tab's: its page's\n * layout has read the same, so it takes the cached answer at once, however\n * old, and refetches behind it, and switching tabs never waits on the\n * network. A read the cache lacks is waited for either way.\n */\nexport type Freshness = 'fresh' | 'cached';\n\nfunction read<T, TKey extends QueryKey>(queryClient: QueryClient, options: FetchQueryOptions<T, Error, T, TKey>, freshness: Freshness): Promise<T> {\n return freshness === 'fresh' ? queryClient.fetchQuery(options) : queryClient.ensureQueryData({ ...options, revalidateIfStale: true });\n}\n\n/**\n * Whether a tab may open: from the cache, and where the cache says no, from\n * the network, which a no needs before the tab sends anyone away. A stale\n * no could be an account since added back, or a role since given.\n */\nexport async function tabOpens(opens: (freshness: Freshness) => Promise<boolean>): Promise<boolean> {\n return (await opens('cached')) || opens('fresh');\n}\n\n/**\n * The shell, as every loader reads it: from the cache while fresh, so a\n * child route never asks again for what the root has.\n */\nexport async function loadShell(queryClient: QueryClient, client: CoffreClient, freshness: Freshness = 'fresh'): Promise<Shell> {\n const [auth, me, projects] = await Promise.all([\n read(queryClient, queries.auth(client), freshness),\n read(queryClient, queries.me(client), freshness),\n read(queryClient, queries.projects(client), freshness),\n ]);\n return shellOf(auth, me, projects);\n}\n\n/**\n * One project and, when you manage its access, its grants. A project that is\n * not there for you fails with no message: the page words that itself.\n */\nexport function projectOf(projects: ProjectsResult, slug: string) {\n if (!projects.ok) return projects;\n const project = projects.projects.find((entry) => entry.slug === slug);\n if (project === undefined) return { ok: false as const, error: null };\n return { ok: true as const, project, managesAccess: project.permissions.includes('grant.manage') };\n}\n\n/** What a project page reads: the project list, and its grants when you manage them. */\nexport async function loadProject(queryClient: QueryClient, client: CoffreClient, slug: string) {\n const found = projectOf(await queryClient.fetchQuery(queries.projects(client)), slug);\n if (found.ok && found.managesAccess) await queryClient.fetchQuery(queries.grants(client, slug));\n}\n\n/**\n * What an environment's page reads: its secrets and, for whoever reads them,\n * the references that read them from elsewhere and the keys it lacks,\n * rendered with them. Where the project tree the shell holds says you read\n * it, all three are asked at once, one round trip; elsewhere the others wait\n * for the secrets, so a refused visit is one refusal in the log, not three.\n */\nexport async function loadEnvironment(queryClient: QueryClient, client: CoffreClient, place: Place) {\n const others = () =>\n Promise.all([\n queryClient.fetchQuery(queries.references(client, `${place.project}/${place.environment}`)),\n queryClient.fetchQuery(queries.missing(client, place)),\n ]);\n const found = projectOf(await queryClient.ensureQueryData(queries.projects(client)), place.project);\n // Neither in an archived project nor archived itself: the API serves neither.\n const here = found.ok && found.project.archivedAt === null\n ? found.project.environments.find((environment) => environment.slug === place.environment)\n : undefined;\n if (here !== undefined && isActiveAccessibleEnvironment(here)) {\n const [secrets] = await Promise.all([queryClient.fetchQuery(queries.secrets(client, place)), others()]);\n return secrets;\n }\n const secrets = await queryClient.fetchQuery(queries.secrets(client, place));\n if (secrets.ok) await others();\n return secrets;\n}\n\n/**\n * What the audit page reads: a page of the log and the verification from\n * the newest checkpoint, asked together and rendered together, so the badge\n * arrives with the page. The verification never fails the load: a check that\n * could not run is its verdict.\n */\nexport async function loadAudit(queryClient: QueryClient, client: CoffreClient, search: AuditSearch) {\n const [entries] = await Promise.all([\n queryClient.fetchQuery(queries.auditEntries(client, search)),\n queryClient.fetchQuery(queries.auditChain(client)),\n ]);\n return entries;\n}\n\n/** The directory pages' read: the directory, for owners. */\nexport async function loadDirectory(queryClient: QueryClient, client: CoffreClient) {\n const shell = await loadShell(queryClient, client);\n return queryClient.fetchQuery(queries.directory(client, shell.capabilities.canManageGrants));\n}\n\n/** The instance's settings: the directory's counts, where people set up service accounts, and what its keys are checked against. */\n/** What a tab of Settings reads, its own alone: General the directory and the instance's settings, Roles the roles, project and global alike, Keys the key checks. */\nexport async function loadSettings(queryClient: QueryClient, client: CoffreClient, tab: SettingsTab | undefined) {\n const { capabilities } = await loadShell(queryClient, client);\n if (tab === undefined) {\n await Promise.all([loadDirectory(queryClient, client), queryClient.fetchQuery(queries.settings(client, capabilities.runsInstance))]);\n } else if (tab === 'keys') {\n await queryClient.fetchQuery(queries.auditKeys(client, capabilities.runsInstance));\n } else {\n await queryClient.fetchQuery(queries.roles(client));\n }\n}\n\n/** Whether the Service accounts page lists anyone: to admins and owners, and to whoever sets one up, those they manage. */\nexport function listsServices(shell: Shell): boolean {\n return shell.capabilities.canManageGrants || shell.capabilities.setsUpServices;\n}\n\n/**\n * How the caller may have a service account sign in, from its list entry\n * or its access: bearer tokens under coffre's own sign-in, trusted\n * workloads where the deployment trusts them, each only for an account they\n * manage.\n */\nexport function waysFor(shell: Shell, managed: boolean): { tokens: boolean; workloads: boolean } {\n return { tokens: managed && shell.auth.signin !== null, workloads: managed && shell.features.workloads };\n}\n\n/**\n * The service accounts page: the directory, and each account's bindings and\n * tokens, read here as its own page reads them, so the list shows how each\n * signs in from the first paint and the browser asks for nothing that may be\n * refused (a deployment that trusts no workloads answers bindings with one).\n */\nexport async function loadServiceDirectory(queryClient: QueryClient, client: CoffreClient) {\n const shell = await loadShell(queryClient, client);\n const directory = await queryClient.fetchQuery(queries.directory(client, listsServices(shell)));\n if (!directory.ok) return directory;\n await Promise.all(\n directory.principals\n .filter((principal) => principal.principalType === 'service')\n .flatMap((principal) => {\n const member = memberRef('service', principal.principalId);\n const ways = waysFor(shell, principal.managed === true);\n return [\n queryClient.fetchQuery(queries.credentials(client, member, ways.tokens)),\n queryClient.fetchQuery(queries.bindings(client, member, ways.workloads)),\n ];\n }),\n );\n return directory;\n}\n\n/** Who a user or service account is to the instance, its pages' header: null to anyone who does not run it. */\nexport async function loadMember(queryClient: QueryClient, client: CoffreClient, member: string, freshness: Freshness = 'fresh') {\n const shell = await loadShell(queryClient, client, freshness);\n return read(queryClient, queries.report(client, member, shell.capabilities.runsInstance), freshness);\n}\n\nexport type MemberReport = Awaited<ReturnType<typeof loadMember>>;\n\n/**\n * What a user's or service account's Access tab reads: their role, scope\n * and the grants you manage, in one request, which the server answers in\n * one query, however many projects they hold grants in.\n */\nexport async function loadAccess(queryClient: QueryClient, client: CoffreClient, member: string, freshness: Freshness = 'fresh') {\n const shell = await loadShell(queryClient, client, freshness);\n return read(queryClient, queries.memberAccess(client, member, listsAccess(shell)), freshness);\n}\n\n/**\n * A user's or service account's page: what every tab but Activity shows,\n * read once by its layout, so its tabs open at once. Who they are, what they\n * hold and, for a service account, how it signs in.\n */\nexport async function loadPrincipal(queryClient: QueryClient, client: CoffreClient, principalType: 'user' | 'service', principalId: string) {\n const member = memberRef(principalType, principalId);\n await Promise.all([\n loadMember(queryClient, client, member),\n principalType === 'service' ? loadSignIn(queryClient, client, member) : loadAccess(queryClient, client, member),\n ]);\n}\n\n/**\n * A service account's Sign-in tab: its bearer tokens and trust bindings, as\n * far as its page shows them (`signInWays`), which it returns: null where it\n * shows neither.\n */\nexport async function loadSignIn(queryClient: QueryClient, client: CoffreClient, member: string, freshness: Freshness = 'fresh') {\n const [shell, access] = await Promise.all([\n loadShell(queryClient, client, freshness),\n loadAccess(queryClient, client, member, freshness),\n ]);\n const ways = signInWays(shell, access);\n if (ways !== null) {\n await Promise.all([\n read(queryClient, queries.credentials(client, member, ways.tokens), freshness),\n read(queryClient, queries.bindings(client, member, ways.workloads), freshness),\n ]);\n }\n return ways;\n}\n\n/**\n * Whether the caller may ask what someone holds: admins and owners,\n * whoever manages a project's access, and whoever sets up service accounts,\n * of those they manage.\n */\nexport function listsAccess(shell: Shell): boolean {\n return shell.capabilities.canManageGrants || shell.capabilities.setsUpServices || managedProjects(shell.projects).length > 0;\n}\n\nexport type MemberAccessResult = Awaited<ReturnType<typeof loadAccess>>;\n\n/**\n * How a service account's page lets it sign in: bearer tokens under\n * coffre's own sign-in, trusted workloads where the deployment trusts them.\n * Null where it shows neither: to anyone who does not manage it (its access\n * says, `managed`), and for an account that is not active, which can be\n * issued nothing.\n */\nexport function signInWays(shell: Shell, access: MemberAccessResult): { tokens: boolean; workloads: boolean } | null {\n const managed = access?.ok === true && access.managed && access.status === 'active';\n const ways = waysFor(shell, managed);\n return ways.tokens || ways.workloads ? ways : null;\n}\n\n/**\n * Whether a user has a Connected apps tab: for an owner, where the\n * deployment serves MCP, and while the user is registered and not removed,\n * since removal disconnects every app. The tab, and the route under it,\n * both ask.\n */\nexport function hasAppsTab(shell: Shell, report: MemberReport): boolean {\n const found = report?.ok === true ? report.report : null;\n return Boolean(shell.features.mcp) && shell.capabilities.runsInstance && found !== null && found.status !== 'removed';\n}\n\nexport function managedProjects(projects: ProjectSummary[]): ProjectSummary[] {\n return projects.filter((project) => project.permissions.includes('grant.manage'));\n}\n\n/**\n * What each change touches, which `useAction` refetches when it lands. Every\n * change also lands in the audit log, which is always read fresh.\n */\nexport const affects = {\n /**\n * A project or environment made, renamed or archived: the tree, where you\n * hold access, and the personal configs listed of it, which go with it.\n */\n places: (): QueryKey[] => [keys.projects, keys.me, ['personal']],\n /** Secrets written, renamed, restored or archived: the environment, the counts, and the personal configs' key names. */\n secrets: (place: Place): QueryKey[] => [keys.secrets(place), keys.projects, ['references'], ['missing'], ['personal']],\n /**\n * Someone's access in a project changed: its grants, their report, and, as\n * it may be your own, what you can see.\n */\n access: (project: string, member: string): QueryKey[] => [\n keys.grants(project),\n keys.memberAccess(member),\n keys.report(member),\n keys.projects,\n keys.me,\n ],\n /**\n * Someone let in: the directory, and whatever was read of them before\n * they were there, which said there was no such member: a new service\n * account's row asks how it signs in as soon as it shows.\n */\n admission: (member: string): QueryKey[] => [\n keys.directory,\n keys.report(member),\n keys.memberAccess(member),\n keys.credentials(member),\n keys.bindings(member),\n ],\n /**\n * An instance role changed: the directory, their report, and, as it may be\n * your own, what you can see and do.\n */\n role: (member: string): QueryKey[] => [keys.directory, keys.report(member), keys.memberAccess(member), keys.me, keys.projects],\n /** Someone removed: the directory, their report, and every grant, which removal ends, those on every project too. */\n removal: (member: string): QueryKey[] => [keys.directory, keys.report(member), keys.memberAccess(member), ['grants'], keys.projects],\n /**\n * Where people set up service accounts changed: the setting, and what you\n * may do, which the directory and `/me` say.\n */\n settings: (): QueryKey[] => [keys.settings, keys.me, keys.directory],\n /**\n * A role edited, made, reset or deleted, or an environment protected:\n * what everyone holds may change, so the roles, what you hold, and every\n * grant and environment read with what it holds.\n */\n roles: (): QueryKey[] => [keys.roles, keys.me, keys.projects, ['grants'], ['member-access'], ['secrets']],\n credentials: (member: string): QueryKey[] => [keys.credentials(member)],\n bindings: (member: string): QueryKey[] => [keys.bindings(member)],\n /** Unlinking an account also ends the sessions it signed in. */\n identities: (): QueryKey[] => [keys.identities, keys.sessions],\n sessions: (): QueryKey[] => [keys.sessions],\n apps: (): QueryKey[] => [keys.apps],\n};\n\n/**\n * Refetch what a change touched: at once where it is on screen, on next use\n * elsewhere. Every change lands in the audit log, so the log and its\n * verification are always among them.\n */\nexport async function refresh(queryClient: QueryClient, touched: QueryKey[]): Promise<void> {\n await Promise.all([...touched, keys.audit].map((queryKey) => queryClient.invalidateQueries({ queryKey })));\n}\n"],"mappings":";;;;AAOA,SAAgB,sBACd,aAC2C;CAC3C,OAAO,YAAY,YAAY;AACjC;AAEA,SAAgB,8BACd,aAIA;CACA,OAAO,YAAY,cACd,YAAY,YAAY,QACxB,YAAY,QAAQ,eAAe;AAC1C;;;ACaA,IAAM,OAAuB;CAC3B,iBAAiB;CACjB,cAAc;CACd,cAAc;CACd,gBAAgB;CAChB,cAAc;CACd,kBAAkB;AACpB;AAEA,SAAgB,qBACd,IACA,UACgB;CAChB,IAAI,OAAO,MAAM,OAAO;CAExB,MAAM,OAAO,GAAG;CAEhB,OAAO;EAIL,iBAAiB,YAAY,IAAI;EACjC,cAAc,GAAG;EACj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yB;EAAC,KAAK;EAAO,KAAK;EAAI,KAAK;EAAU,CAAC,QAAQ;EAAG,CAAC,eAAe;EAAG,CAAC,SAAS;CAAC;CACxG,cAAc,WAA+B,CAAC,KAAK,YAAY,MAAM,CAAC;CACtE,WAAW,WAA+B,CAAC,KAAK,SAAS,MAAM,CAAC;;CAEhE,kBAA8B,CAAC,KAAK,YAAY,KAAK,QAAQ;CAC7D,gBAA4B,CAAC,KAAK,QAAQ;CAC1C,YAAwB,CAAC,KAAK,IAAI;AACpC;;;;;;AAOA,eAAsB,QAAQ,aAA0B,SAAoC;CAC1F,MAAM,QAAQ,IAAI,CAAC,GAAG,SAAS,KAAK,KAAK,CAAC,CAAC,KAAK,aAAa,YAAY,kBAAkB,EAAE,SAAS,CAAC,CAAC,CAAC;AAC3G"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"references-D5llUGQL.js","names":[],"sources":["../../src/components/references.tsx"],"sourcesContent":["import { useEffect, useId, useState } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { Link } from '@tanstack/react-router';\nimport type { ListedReference, ReferenceView, SecretKey } from '@coffre/client';\n\nimport { useCoffre } from '../lib/coffre';\nimport { queries } from '../lib/queries';\nimport { useAction } from '../lib/use-action';\nimport { secretKeyProblem } from '../lib/validation';\nimport { ArrowRight } from './icons';\nimport { Card } from './page';\nimport { ConfirmDialog, ErrorLine, Modal, Notice, Timestamp } from './ui';\n\n/**\n * References: a secret read live through another (docs/design/environments.md).\n * The vault makes and checks each one; these only show them.\n */\n\n/** Why a reference does not read, in a few words; null while it does. */\nexport function referenceProblem(state: ReferenceView['state']): string | null {\n switch (state) {\n case 'live':\n return null;\n case 'broken':\n return 'Broken';\n case 'replaced':\n return 'No value';\n case 'source_archived':\n return 'Source archived';\n case 'source_deleted':\n return 'Source deleted';\n case 'source_is_reference':\n return 'Source is a reference';\n case 'source_empty':\n return 'Source has no value';\n }\n}\n\n/** A secret's path as a link to it, when you can open it there. */\nfunction SecretPath({ path, open }: { path: string; open: boolean }) {\n const [project, environment, key] = path.split('/') as [string, string, string];\n if (!open) {\n return (\n <span className=\"mono\" title=\"You can't open the source\">\n {path}\n </span>\n );\n }\n return (\n <Link className=\"mono\" to=\"/projects/$project/$environment\" params={{ project, environment }} search={{ filter: key }}>\n {path}\n </Link>\n );\n}\n\n/**\n * What a key that is a reference shows where its value would be: what it\n * reads, and, when it does not read, why. Reading it is a reveal like any\n * other, logged as a read of the source.\n */\nexport function ReferenceValue({ reference }: { reference: NonNullable<SecretKey['reference']> }) {\n const problem = referenceProblem(reference.state);\n return (\n <span className=\"reference-value\">\n <ArrowRight size={13} aria-label=\"A reference to\" />\n <SecretPath path={reference.source} open={reference.canOpenSource} />\n {problem !== null && (\n <span className=\"tag tag-red\" title={reference.endedBy === null ? undefined : `By ${reference.endedBy}`}>\n {problem}\n </span>\n )}\n </span>\n );\n}\n\n/**\n * The references that read a secret from elsewhere, under its row: where\n * each is held, who made it, who reads through it, and Break for those who\n * may.\n */\nexport function LentReferences({ references, onBreak }: { references: ListedReference[]; onBreak: (reference: ListedReference) => void }) {\n return (\n <ul className=\"lent-references\" aria-label=\"Read through references\">\n {references.map((reference) => (\n <li key={reference.id}>\n <span>\n Read through <SecretPath path={reference.holder} open={false} />, made by {reference.createdBy.replace(/^user:/, '')}{' '}\n <Timestamp iso={reference.createdAt} display=\"relative\" />\n {reference.readers !== null && (\n <span className=\"cell-muted\">\n {' '}\n · {reference.readers.length === 0 ? 'no one reads it by a grant' : `${reference.readers.length} ${reference.readers.length === 1 ? 'person reads' : 'people read'} it: ${reference.readers.map((reader) => reader.replace(/^user:/, '').replace(/^token:/, 'service:')).join(', ')}`}\n </span>\n )}\n </span>\n {reference.canBreak && (\n <button type=\"button\" className=\"btn btn-sm btn-danger-outline\" onClick={() => onBreak(reference)}>\n Break\n </button>\n )}\n </li>\n ))}\n </ul>\n );\n}\n\n/**\n * Make a key a reference to a secret you read, by path: whoever reads its\n * environment reads that secret through it, as it changes. Paths you can\n * read are offered as you type.\n */\nexport function MakeReference({\n open,\n onOpenChange,\n holder,\n environments,\n onMake,\n}: {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** `billing/prod/DATABASE_URL`. */\n holder: string;\n /** `market/prod`, each environment you read. */\n environments: readonly string[];\n onMake: (source: string) => void;\n}) {\n const [source, setSource] = useState('');\n const listId = useId();\n useEffect(() => {\n if (open) setSource('');\n }, [open]);\n const [project, environment, key] = source.split('/');\n const problem =\n source === '' ? null\n : source.split('/').length !== 3 || project === '' || environment === '' ? 'A secret, as project/environment/KEY.'\n : secretKeyProblem(key!);\n const holderEnvironment = holder.split('/').slice(0, 2).join('/');\n\n return (\n <Modal\n open={open}\n onOpenChange={onOpenChange}\n title={`Make ${holder.split('/')[2]} a reference`}\n description={`Whoever can read ${holderEnvironment} will read the secret you name, as it changes, even without access to its project. You need read access to that secret.`}\n >\n <form\n className=\"form\"\n onSubmit={(event) => {\n event.preventDefault();\n if (problem !== null || source === '') return;\n onMake(source);\n onOpenChange(false);\n }}\n >\n <label className=\"field\">\n <span className=\"label\">Secret to read</span>\n <input\n className=\"input input-mono\"\n autoFocus\n spellCheck={false}\n autoComplete=\"off\"\n list={listId}\n placeholder=\"market/prod/DATABASE_URL\"\n value={source}\n aria-invalid={problem !== null}\n onChange={(event) => setSource(event.target.value)}\n />\n <datalist id={listId}>\n {environments.map((each) => (\n <option key={each} value={`${each}/`} />\n ))}\n </datalist>\n <span className={`hint${problem !== null ? ' edit-note-error' : ''}`}>\n {problem ?? 'A reference cannot point at a reference: name the secret it reads.'}\n </span>\n </label>\n <div className=\"dialog-actions\">\n <button className=\"btn\" type=\"button\" onClick={() => onOpenChange(false)}>\n Cancel\n </button>\n <button className=\"btn btn-primary\" type=\"submit\" disabled={source === '' || problem !== null}>\n Make reference\n </button>\n </div>\n </form>\n </Modal>\n );\n}\n\n/**\n * A project's secrets that others read through references held elsewhere,\n * and who: on its access tab, beside the grants, since \"who can read this\"\n * includes them. Those who may break one, its source's access managers or\n * whoever writes where it is held, do it here.\n */\nexport function ReferencesInto({ project }: { project: string }) {\n const coffre = useCoffre();\n const { data } = useQuery(queries.references(coffre, project));\n const { run, error } = useAction();\n const [breaking, setBreaking] = useState<ListedReference | null>(null);\n const into = data?.ok === true ? data.references.filter((reference) => reference.source.startsWith(`${project}/`)) : [];\n if (into.length === 0) return null;\n return (\n <Card\n labelledBy=\"references-into\"\n title=\"Also readable through references\"\n description={`Secrets of ${project} that references elsewhere read. Whoever reads a reference's environment reads its source, with no grant here.`}\n >\n <div className=\"dt-wrap\">\n <table className=\"dt stacks\">\n <thead>\n <tr>\n <th>Secret</th>\n <th>Read through</th>\n <th>Readers</th>\n <th className=\"col-actions\">\n <span className=\"visually-hidden\">Actions</span>\n </th>\n </tr>\n </thead>\n <tbody>\n {into.map((reference) => (\n <tr key={reference.id}>\n <td className=\"mono\" data-label=\"Secret\">{reference.source}</td>\n <td data-label=\"Read through\">\n <span className=\"cell-stack\">\n <span className=\"mono\">{reference.holder}</span>\n <small className=\"cell-muted\">\n Made by {reference.createdBy.replace(/^user:/, '')} <Timestamp iso={reference.createdAt} display=\"relative\" />\n </small>\n </span>\n </td>\n <td data-label=\"Readers\">\n {reference.readers === null\n ? '—'\n : reference.readers.length === 0\n ? <span className=\"cell-muted\">No one, by a grant</span>\n : reference.readers.map((reader) => reader.replace(/^user:/, '').replace(/^token:/, 'service:')).join(', ')}\n </td>\n <td className=\"col-actions\">\n {reference.canBreak && (\n <button type=\"button\" className=\"btn btn-sm btn-danger-outline\" onClick={() => setBreaking(reference)}>\n Break\n </button>\n )}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n {error !== null && <ErrorLine error={error} />}\n <ConfirmDialog\n open={breaking !== null}\n onOpenChange={(open) => !open && setBreaking(null)}\n title=\"Break this reference?\"\n body={breaking === null ? '' : `Whoever reads ${breaking.holder.split('/').slice(0, 2).join('/')} stops reading ${breaking.source} through it, and a run there refuses until ${breaking.holder.split('/')[2]} gets a value.`}\n confirmLabel=\"Break\"\n onConfirm={() => {\n const path = breaking!.holder;\n void run(() => coffre.references.break(path), { affects: [['references']] });\n }}\n />\n </Card>\n );\n}\n\n/**\n * The references that archiving `path` would stop, a project, an\n * environment or a key: those reading a secret in it, held outside it in a\n * place not archived itself (D58). Archiving is refused while any read\n * (D41); the server decides, and this shows the dialog what it will say.\n */\nexport function archiveBlockers(path: string, references: readonly ListedReference[]): ListedReference[] {\n const within = (secret: string) => secret === path || secret.startsWith(`${path}/`);\n return references.filter((reference) => reference.state === 'live' && !reference.holderArchived && within(reference.source) && !within(reference.holder));\n}\n\n/**\n * What an archive dialog shows while references read what it would\n * archive: each, and Break for those who may break it. Archive waits until\n * none is left.\n */\nexport function ArchiveBlocked({ references }: { references: readonly ListedReference[] }) {\n const coffre = useCoffre();\n const { run, error, pending } = useAction();\n if (references.length === 0) return null;\n const many = references.length > 1;\n return (\n <div className=\"archive-blocked\">\n <Notice tone=\"bad\">\n {many ? `${references.length} references read it` : 'A reference reads it'} from elsewhere. Break{' '}\n {many ? 'them' : 'it'} first: archiving would stop {many ? 'those reads' : 'that read'}.\n </Notice>\n <ul className=\"archive-blockers\" aria-label=\"References that read it\">\n {references.map((reference) => (\n <li key={reference.id}>\n <span className=\"cell-stack\">\n <span className=\"mono\">{reference.holder}</span>\n <small>\n reads <span className=\"mono\">{reference.source}</span>\n </small>\n </span>\n {reference.canBreak ? (\n <button\n type=\"button\"\n className=\"btn btn-sm btn-danger-outline\"\n disabled={pending}\n onClick={() => void run(() => coffre.references.break(reference.holder), { affects: [['references'], ['secrets']] })}\n >\n Break\n </button>\n ) : (\n <small className=\"cell-muted\">{`${reference.source.split('/')[0]}'s access managers, or whoever writes ${reference.holder.split('/').slice(0, 2).join('/')}, can break it`}</small>\n )}\n </li>\n ))}\n </ul>\n <p className=\"hint\">Once broken, a run where it is held refuses until that key gets a value of its own.</p>\n {error !== null && <ErrorLine error={error} />}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;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eAAhB,CACE,oBAAC,QAAD;MAAM,WAAU;gBAAQ,UAAU;KAAa,CAAA,GAC/C,qBAAC,SAAD,EAAA,UAAA,CAAO,UACC,oBAAC,QAAD;MAAM,WAAU;gBAAQ,UAAU;KAAa,CAAA,CAChD,EAAA,CAAA,CACH;QACL,UAAU,WACT,oBAAC,UAAD;KACE,MAAK;KACL,WAAU;KACV,UAAU;KACV,eAAe,KAAK,UAAU,OAAO,WAAW,MAAM,UAAU,MAAM,GAAG,EAAE,SAAS,CAAC,CAAC,YAAY,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;eACpH;IAEO,CAAA,IAER,oBAAC,SAAD;KAAO,WAAU;eAAc,GAAG,UAAU,OAAO,MAAM,GAAG,CAAC,CAAC,GAAG,wCAAwC,UAAU,OAAO,MAAM,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;IAAuB,CAAA,CAElL,EAAA,GAnBK,UAAU,EAmBf,CACL;GACC,CAAA;GACJ,oBAAC,KAAD;IAAG,WAAU;cAAO;GAAsF,CAAA;GACzG,UAAU,QAAQ,oBAAC,WAAD,EAAkB,MAAQ,CAAA;EAC1C;;AAET"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"role-field-CoCv8wse.js","names":[],"sources":["../../src/components/role-field.tsx"],"sourcesContent":["import { useId, useState } from 'react';\nimport { INSTANCE_ROLE_NAMES, type Filter, type InstanceRole, type Scope } from '@coffre/core/access';\nimport type { RoleVars } from '../lib/changes';\nimport { useShell } from '../lib/use-shell';\nimport { useRoles } from '../lib/use-roles';\nimport { slugProblem } from '../lib/validation';\nimport { X } from './icons';\n\n/**\n * A person's instance role, one dropdown, and under it, for every role but\n * Member, where it applies: projects and environments, each All, Only or\n * All except. Projects are picked from those there are; environments are\n * names, so any slug goes, the ones made later too. Owner is offered only\n * to an Owner of the whole instance, who alone makes one.\n */\nexport function RoleField({ value, onChange }: { value: RoleVars; onChange: (value: RoleVars) => void }) {\n const { role, scope } = value;\n const owners = useShell().capabilities.ownsInstance;\n // As the instance defines them: an Owner may have renamed or redescribed one.\n const { instanceRoles } = useRoles();\n const shown = (name: InstanceRole) => instanceRoles.find((each) => each.id === name);\n return (\n <>\n <label className=\"field\">\n <span className=\"label\">Global role</span>\n <select\n className=\"select\"\n value={role}\n onChange={(event) => onChange({ role: event.target.value as InstanceRole, scope })}\n >\n {INSTANCE_ROLE_NAMES.filter((name) => owners || name !== 'owner').map((name) => (\n <option key={name} value={name}>\n {shown(name)?.name ?? name}\n </option>\n ))}\n </select>\n <span className=\"hint\">\n Default permissions: {shown(role)?.description} Project grants add more.\n {!owners && ' Only an Owner makes someone an Owner.'}\n </span>\n </label>\n {role !== 'member' && <ScopeField scope={scope} onChange={(next) => onChange({ role, scope: next })} />}\n </>\n );\n}\n\n/**\n * Where something applies: projects and environments, each All, Only or All\n * except. A role's scope, and the instance's setting of where people set\n * up service accounts, which has the same shape.\n */\nexport function ScopeField({ scope, onChange, legend = 'Where' }: { scope: Scope; onChange: (scope: Scope) => void; legend?: string }) {\n const { projects } = useShell();\n const slugs = [...new Set(projects.flatMap((project) => project.environments.map((environment) => environment.slug)))].sort();\n return (\n <fieldset className=\"field scope-field\">\n <legend className=\"label\">{legend}</legend>\n <FilterRow\n label=\"Projects\"\n filter={scope.projects}\n options={projects.map((project) => project.slug)}\n onChange={(filter) => onChange({ ...scope, projects: filter })}\n />\n <FilterRow\n label=\"Environments\"\n filter={scope.environments}\n options={slugs}\n free\n onChange={(filter) => onChange({ ...scope, environments: filter })}\n />\n {scope.environments !== 'all' && <span className=\"hint\">Environments match by name in every project, new ones included.</span>}\n </fieldset>\n );\n}\n\ntype Mode = 'all' | 'only' | 'except';\n\nconst namesOf = (filter: Filter): string[] => (filter === 'all' ? [] : 'only' in filter ? filter.only : filter.except);\n\nfunction filterOf(mode: Mode, names: string[]): Filter {\n return mode === 'all' ? 'all' : mode === 'only' ? { only: names } : { except: names };\n}\n\n/** One filter: All, Only or All except, and the names it lists. */\nfunction FilterRow({\n label,\n filter,\n options,\n free = false,\n onChange,\n}: {\n label: string;\n filter: Filter;\n options: string[];\n /** Whether a name need not be among `options`: an environment's slug, which may come later. */\n free?: boolean;\n onChange: (filter: Filter) => void;\n}) {\n const mode: Mode = filter === 'all' ? 'all' : 'only' in filter ? 'only' : 'except';\n const names = namesOf(filter);\n return (\n <div className=\"scope-row\">\n <span className=\"scope-label\">{label}</span>\n <select\n className=\"select select-sm\"\n aria-label={`${label}: which`}\n value={mode}\n onChange={(event) => onChange(filterOf(event.target.value as Mode, names))}\n >\n <option value=\"all\">All</option>\n <option value=\"only\">Only</option>\n <option value=\"except\">All except</option>\n </select>\n {mode !== 'all' && (\n <NamePicker label={label} names={names} options={options} free={free} onChange={(next) => onChange(filterOf(mode, next))} />\n )}\n </div>\n );\n}\n\n/** Names as chips, and a field to add one: picked from the list, or, where any name goes, typed and entered. */\nfunction NamePicker({\n label,\n names,\n options,\n free,\n onChange,\n}: {\n label: string;\n names: string[];\n options: string[];\n free: boolean;\n onChange: (names: string[]) => void;\n}) {\n const [draft, setDraft] = useState('');\n const list = useId();\n const add = (raw: string) => {\n const name = raw.trim();\n setDraft('');\n if (name === '' || names.includes(name)) return;\n if (free ? slugProblem(name) !== null : !options.includes(name)) return;\n onChange([...names, name]);\n };\n const offered = options.filter((option) => !names.includes(option));\n return (\n <span className=\"scope-names\">\n {names.map((name) => (\n <span key={name} className=\"tag scope-chip\">\n <span className=\"mono\">{name}</span>\n <button type=\"button\" aria-label={`Remove ${name}`} onClick={() => onChange(names.filter((other) => other !== name))}>\n <X size={11} />\n </button>\n </span>\n ))}\n <input\n className=\"input input-mono scope-input\"\n list={list}\n value={draft}\n spellCheck={false}\n autoComplete=\"off\"\n placeholder={names.length === 0 ? (free ? 'dev' : 'Pick a project') : 'Add'}\n aria-label={`Add to ${label}`}\n aria-invalid={draft !== '' && free && slugProblem(draft.trim()) !== null}\n onChange={(event) => {\n // A name picked from the list goes in at once; one typed, on Enter.\n if ((event.nativeEvent as InputEvent).inputType === 'insertReplacementText' || (!free && options.includes(event.target.value))) {\n add(event.target.value);\n } else {\n setDraft(event.target.value);\n }\n }}\n onKeyDown={(event) => {\n if (event.key === 'Enter' || event.key === ',') {\n event.preventDefault();\n add(draft);\n } else if (event.key === 'Backspace' && draft === '' && names.length > 0) {\n onChange(names.slice(0, -1));\n }\n }}\n onBlur={() => add(draft)}\n />\n <datalist id={list}>\n {offered.map((option) => (\n <option key={option} value={option} />\n ))}\n </datalist>\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAgB,UAAU,EAAE,OAAO,YAAsE;CACvG,MAAM,EAAE,MAAM,UAAU;CACxB,MAAM,SAAS,SAAS,CAAC,CAAC,aAAa;CAEvC,MAAM,EAAE,kBAAkB,SAAS;CACnC,MAAM,SAAS,SAAuB,cAAc,MAAM,SAAS,KAAK,OAAO,IAAI;CACnF,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,qBAAC,SAAD;EAAO,WAAU;YAAjB;GACE,oBAAC,QAAD;IAAM,WAAU;cAAQ;GAAiB,CAAA;GACzC,oBAAC,UAAD;IACE,WAAU;IACV,OAAO;IACP,WAAW,UAAU,SAAS;KAAE,MAAM,MAAM,OAAO;KAAuB;IAAM,CAAC;cAEhF,oBAAoB,QAAQ,SAAS,UAAU,SAAS,OAAO,CAAC,CAAC,KAAK,SACrE,oBAAC,UAAD;KAAmB,OAAO;eACvB,MAAM,IAAI,CAAC,EAAE,QAAQ;IAChB,GAFK,IAEL,CACT;GACK,CAAA;GACR,qBAAC,QAAD;IAAM,WAAU;cAAhB;KAAuB;KACC,MAAM,IAAI,CAAC,EAAE;KAAY;KAC9C,CAAC,UAAU;IACR;;EACD;KACN,SAAS,YAAY,oBAAC,YAAD;EAAmB;EAAO,WAAW,SAAS,SAAS;GAAE;GAAM,OAAO;EAAK,CAAC;CAAI,CAAA,CACtG,EAAA,CAAA;AAEN;;;;;;AAOA,SAAgB,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,UAAU,MAAM,QAAQ,YAAY,MAAM,KAAK,CAAC,MAAM;IACpE,WAAW,UAAU;KAEnB,IAAK,MAAM,YAA2B,cAAc,2BAA4B,CAAC,QAAQ,QAAQ,SAAS,MAAM,OAAO,KAAK,GAC1H,IAAI,MAAM,OAAO,KAAK;UAEtB,SAAS,MAAM,OAAO,KAAK;IAE/B;IACA,YAAY,UAAU;KACpB,IAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,KAAK;MAC9C,MAAM,eAAe;MACrB,IAAI,KAAK;KACX,OAAO,IAAI,MAAM,QAAQ,eAAe,UAAU,MAAM,MAAM,SAAS,GACrE,SAAS,MAAM,MAAM,GAAG,EAAE,CAAC;IAE/B;IACA,cAAc,IAAI,KAAK;GACxB,CAAA;GACD,oBAAC,YAAD;IAAU,IAAI;cACX,QAAQ,KAAK,WACZ,oBAAC,UAAD,EAAqB,OAAO,OAAS,GAAxB,MAAwB,CACtC;GACO,CAAA;EACN;;AAEV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signin-errors-TlQmQe0t.js","names":[],"sources":["../../src/lib/signin-errors.ts"],"sourcesContent":["/**\n * What went wrong with a sign-in, in words. The callback redirects with a\n * code rather than a sentence so the URL stays short and nothing the provider\n * said is reflected into the page.\n */\nconst MESSAGES: Record<string, string> = {\n provider_denied: 'The sign-in was cancelled, or the provider refused it.',\n state_mismatch:\n 'This sign-in expired or was started in another tab. Start again from this page.',\n invalid_response:\n 'The provider answered in a way coffre could not verify. Try again; if it keeps happening, tell whoever runs coffre.',\n provider_unavailable: 'The provider could not be reached. Try again in a moment.',\n no_verified_email:\n 'That account has no verified email address, so coffre cannot match it to an invitation.',\n wrong_domain: 'That account is outside the organization this instance belongs to.',\n not_in_organization:\n 'That GitHub account is not a member of the required organization, or coffre cannot see its members. If it is a member, grant coffre access to the organization when GitHub asks, or ask whoever runs coffre to install its GitHub App there with the Members organization permission, read-only, and to approve that permission on the installation.',\n not_registered:\n 'Nobody has invited that account’s email address. Ask an owner to add you under Users, then sign in again.',\n deactivated: 'Your access to this coffre was removed. Ask an owner if that is a mistake.',\n account_mismatch:\n 'Your email already signs in with a different account. Use that one, then link this account from your account page.',\n already_linked: 'That account is already linked to someone else.',\n tampered:\n 'Your access record failed coffre’s integrity check: it was changed outside coffre. An owner must remove you and add you again.',\n unknown_provider: 'That sign-in option is not configured here.',\n link_session: 'Your session changed while linking. Sign in again, then retry.',\n};\n\n/**\n * Where an email already signs in, for `account_mismatch`: the providers by\n * the label the sign-in page shows them under, and the one just tried. What\n * the visitor may know: the provider has just verified the email is theirs.\n */\nexport type Already = { providers: readonly string[]; via?: string };\n\nexport function signinErrorMessage(code: string | undefined, already?: Already): string | null {\n if (code === undefined) return null;\n if (code === 'account_mismatch' && already !== undefined && already.providers.length > 0) return mismatch(already);\n return MESSAGES[code] ?? 'The sign-in did not complete. Try again.';\n}\n\n/** \"Your email already signs in with GitHub. Sign in with GitHub, then link this account from your account page.\" */\nfunction mismatch({ providers, via }: Already): string {\n const link = 'then link this account from your account page.';\n // The same provider, another account of it: a second GitHub account, say.\n if (providers.length === 1 && providers[0] === via) {\n return `Your email already signs in with another ${via} account. Sign in with that one, ${link}`;\n }\n const named = providers.map((provider) => (provider === via ? `another ${provider} account` : provider));\n const list = named.length < 3 ? named.join(' and ') : `${named.slice(0, -1).join(', ')} and ${named.at(-1)}`;\n return named.length === 1\n ? `Your email already signs in with ${list}. Sign in with ${list}, ${link}`\n : `Your email already signs in with ${list}. Sign in with one of them, ${link}`;\n}\n\nexport type LoginSearch = { next?: string; error?: string; with?: string; via?: string };\n\n/** A sign-in provider's id, as the instance configures it. */\nconst PROVIDER_ID = /^[a-z0-9_-]{1,40}$/;\n\n/**\n * `/login`'s search: where to resume after signing in, same-origin paths\n * only, since an absolute URL accepted here would make the sign-in page an\n * open redirect; and the sign-in's `error`, with account_mismatch's `with`\n * and `via`, provider ids, shown once, then taken out of the URL.\n */\nexport function loginSearch(search: Record<string, unknown>): LoginSearch {\n const out: LoginSearch = {};\n const { next, error, via } = search;\n if (typeof next === 'string' && next.startsWith('/') && !next.startsWith('//')) out.next = next;\n if (typeof error === 'string' && /^[a-z_]{1,40}$/.test(error)) out.error = error;\n const providers = typeof search.with === 'string' ? search.with.split(',').filter((id) => PROVIDER_ID.test(id)).slice(0, 8) : [];\n if (providers.length > 0) out.with = providers.join(',');\n if (typeof via === 'string' && PROVIDER_ID.test(via)) out.via = via;\n return out;\n}\n"],"mappings":";;;;;;AAKA,IAAM,WAAmC;CACvC,iBAAiB;CACjB,gBACE;CACF,kBACE;CACF,sBAAsB;CACtB,mBACE;CACF,cAAc;CACd,qBACE;CACF,gBACE;CACF,aAAa;CACb,kBACE;CACF,gBAAgB;CAChB,UACE;CACF,kBAAkB;CAClB,cAAc;AAChB;AASA,SAAgB,mBAAmB,MAA0B,SAAkC;CAC7F,IAAI,SAAS,KAAA,GAAW,OAAO;CAC/B,IAAI,SAAS,sBAAsB,YAAY,KAAA,KAAa,QAAQ,UAAU,SAAS,GAAG,OAAO,SAAS,OAAO;CACjH,OAAO,SAAS,SAAS;AAC3B;;AAGA,SAAS,SAAS,EAAE,WAAW,OAAwB;CACrD,MAAM,OAAO;CAEb,IAAI,UAAU,WAAW,KAAK,UAAU,OAAO,KAC7C,OAAO,4CAA4C,IAAI,mCAAmC;CAE5F,MAAM,QAAQ,UAAU,KAAK,aAAc,aAAa,MAAM,WAAW,SAAS,YAAY,QAAS;CACvG,MAAM,OAAO,MAAM,SAAS,IAAI,MAAM,KAAK,OAAO,IAAI,GAAG,MAAM,MAAM,GAAG,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,OAAO,MAAM,GAAG,EAAE;CACzG,OAAO,MAAM,WAAW,IACpB,oCAAoC,KAAK,iBAAiB,KAAK,IAAI,SACnE,oCAAoC,KAAK,8BAA8B;AAC7E;;AAKA,IAAM,cAAc;;;;;;;AAQpB,SAAgB,YAAY,QAA8C;CACxE,MAAM,MAAmB,CAAC;CAC1B,MAA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