Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: update access ui (#20516)
ecmadao2de3d113c0bf
diff --git a/frontend/src/react/components/sql-editor/AccessPane.tsx b/frontend/src/react/components/sql-editor/AccessPane.tsxindex ba09463d73..5fde13b846 100644--- a/frontend/src/react/components/sql-editor/AccessPane.tsx+++ b/frontend/src/react/components/sql-editor/AccessPane.tsx@@ -393,6 +393,7 @@ export function AccessPane() {<AccessGrantRequestDrawerquery={pendingCreate?.query}unmask={pendingCreate?.unmask}+ export={pendingCreate?.export}targets={pendingCreate?.targets}onClose={handleDrawerClose}/>diff --git a/frontend/src/react/components/sql-editor/RequestExportButton.tsx b/frontend/src/react/components/sql-editor/RequestExportButton.tsxindex e7f94aaa1d..b114a8f954 100644--- a/frontend/src/react/components/sql-editor/RequestExportButton.tsx+++ b/frontend/src/react/components/sql-editor/RequestExportButton.tsx@@ -60,7 +60,6 @@ export function RequestExportButton({drawerHost.openAccessGrantDrawer({query: statement,targets,- unmask: true,export: true,});} else {@@ -99,7 +98,6 @@ export function RequestExportButton({<AccessGrantRequestDrawerquery={statement}targets={targets}- unmask={true}export={true}onClose={() => setShowDrawer(false)}/>diff --git a/frontend/src/react/locales/en-US.json b/frontend/src/react/locales/en-US.jsonindex e1fec2ff61..e13b7b2739 100644--- a/frontend/src/react/locales/en-US.json+++ b/frontend/src/react/locales/en-US.json@@ -1176,7 +1176,10 @@}},"details": "Access Grant Details",- "expired-at": "Expired at"+ "expired-at": "Expired at",+ "export-results-to-file": "Export results to a file",+ "this-grant-allows": "This grant allows",+ "unmask-data-in-results": "Unmask sensitive data in results"},"action-anyway": "{{action}} anyway","advanced-search": {@@ -2792,7 +2795,6 @@"table-empty-placeholder": "Click Run to execute the query.","table-view": "Table view","text-format": "Text format",- "unmask-warning": "The query result may include unmasked sensitive data.","upload-file": "Upload file","url-copied-to-clipboard": "The URL is copied to your clipboard","vertical-display": "Vertical display",diff --git a/frontend/src/react/locales/es-ES.json b/frontend/src/react/locales/es-ES.jsonindex a19915dc3b..ef453fd743 100644--- a/frontend/src/react/locales/es-ES.json+++ b/frontend/src/react/locales/es-ES.json@@ -1176,7 +1176,10 @@}},"details": "Detalles de la concesión de acceso",- "expired-at": "Expiró el"+ "expired-at": "Expiró el",+ "export-results-to-file": "Exportar resultados a un archivo",+ "this-grant-allows": "Esta concesión permite",+ "unmask-data-in-results": "Desenmascarar datos sensibles en los resultados"},"action-anyway": "{{action}} de todos modos","advanced-search": {@@ -2792,7 +2795,6 @@"table-empty-placeholder": "Haga clic en Ejecutar para ejecutar la consulta.","table-view": "Vista de tabla","text-format": "Formato de texto",- "unmask-warning": "El resultado de la consulta puede incluir datos sensibles sin enmascarar.","upload-file": "Subir archivo","url-copied-to-clipboard": "La URL se copia al portapapeles.","vertical-display": "Pantalla vertical",diff --git a/frontend/src/react/locales/ja-JP.json b/frontend/src/react/locales/ja-JP.jsonindex ab5786ef0e..eaba3ac936 100644--- a/frontend/src/react/locales/ja-JP.json+++ b/frontend/src/react/locales/ja-JP.json@@ -1176,7 +1176,10 @@}},"details": "アクセス付与の詳細",- "expired-at": "有効期限"+ "expired-at": "有効期限",+ "export-results-to-file": "結果をファイルにエクスポート",+ "this-grant-allows": "このアクセス権限で許可される操作",+ "unmask-data-in-results": "結果内の機密データのマスクを解除"},"action-anyway": "まだ {{action}} が必要です","advanced-search": {@@ -2792,7 +2795,6 @@"table-empty-placeholder": "「実行」をクリックしてクエリを実行します。","table-view": "テーブルビュー","text-format": "テキスト形式",- "unmask-warning": "クエリ結果にマスク解除された機密データが含まれる場合があります。","upload-file": "ファイルをアップロードする","url-copied-to-clipboard": "URLがクリップボードにコピーされました","vertical-display": "縦型表示",diff --git a/frontend/src/react/locales/vi-VN.json b/frontend/src/react/locales/vi-VN.jsonindex 89bc6a0c5e..f6adca1089 100644--- a/frontend/src/react/locales/vi-VN.json+++ b/frontend/src/react/locales/vi-VN.json@@ -1176,7 +1176,10 @@}},"details": "Chi tiết cấp quyền truy cập",- "expired-at": "Hết hạn lúc"+ "expired-at": "Hết hạn lúc",+ "export-results-to-file": "Xuất kết quả ra tệp",+ "this-grant-allows": "Cấp quyền này cho phép",+ "unmask-data-in-results": "Hiển thị dữ liệu nhạy cảm trong kết quả"},"action-anyway": "{{action}} bằng mọi cách","advanced-search": {@@ -2792,7 +2795,6 @@"table-empty-placeholder": "Nhấp vào Chạy để thực hiện truy vấn.","table-view": "Chế độ xem bảng","text-format": "Định dạng văn bản",- "unmask-warning": "Kết quả truy vấn có thể bao gồm dữ liệu nhạy cảm chưa che.","upload-file": "Tải lên tệp","url-copied-to-clipboard": "URL đã được sao chép vào bảng nhớ tạm của bạn","vertical-display": "Hiển thị dọc",diff --git a/frontend/src/react/locales/zh-CN.json b/frontend/src/react/locales/zh-CN.jsonindex 17f8c25e77..4189a094e0 100644--- a/frontend/src/react/locales/zh-CN.json+++ b/frontend/src/react/locales/zh-CN.json@@ -1176,7 +1176,10 @@}},"details": "访问授权详情",- "expired-at": "过期时间"+ "expired-at": "过期时间",+ "export-results-to-file": "将结果导出为文件",+ "this-grant-allows": "此授权允许",+ "unmask-data-in-results": "在结果中查看未脱敏的敏感数据"},"action-anyway": "仍要{{action}}","advanced-search": {@@ -2792,7 +2795,6 @@"table-empty-placeholder": "点击 \"运行\" 执行查询","table-view": "表格视图","text-format": "文本格式",- "unmask-warning": "查询结果可能包含未脱敏的敏感数据。","upload-file": "上传文件","url-copied-to-clipboard": "URL 已复制到剪贴板","vertical-display": "竖向展示",diff --git a/frontend/src/react/pages/project/issue-detail/components/IssueDetailAccessGrantDetails.tsx b/frontend/src/react/pages/project/issue-detail/components/IssueDetailAccessGrantDetails.tsxindex 32d9bee5aa..5687195cb4 100644--- a/frontend/src/react/pages/project/issue-detail/components/IssueDetailAccessGrantDetails.tsx+++ b/frontend/src/react/pages/project/issue-detail/components/IssueDetailAccessGrantDetails.tsx@@ -1,9 +1,7 @@-import { Loader2 } from "lucide-react";+import { Download, EyeOff, Loader2, Shield } from "lucide-react";import { useEffect, useMemo, useState } from "react";import { useTranslation } from "react-i18next";import { EngineIcon } from "@/react/components/EngineIcon";-import { Alert } from "@/react/components/ui/alert";-import { Badge } from "@/react/components/ui/badge";import { useProjectByName } from "@/react/hooks/useProjectByName";import { useAppStore } from "@/react/stores/app";import { projectNamePrefix } from "@/store/modules/v1/common";@@ -114,13 +112,6 @@ export function IssueDetailAccessGrantDetails() {<span className="text-sm text-control-light">{t("common.statement")}</span>- {accessGrant.unmask && (- <Alert- variant="warning"- showIcon={false}- description={t("sql-editor.unmask-warning")}- />- )}<div className="max-h-[30em] overflow-auto rounded-xs bg-gray-50 p-4"><pre className="whitespace-pre-wrap font-mono text-sm">{accessGrant.query}@@ -134,18 +125,10 @@ export function IssueDetailAccessGrantDetails() {<span className="text-sm text-control-light">{t("common.permissions")}</span>- <div className="flex flex-wrap gap-2">- {accessGrant.unmask && (- <Badge variant="secondary">- {t("sql-editor.access-type-unmask")}- </Badge>- )}- {accessGrant.export && (- <Badge variant="secondary">- {t("sql-editor.access-type-export")}- </Badge>- )}- </div>+ <GrantScopeCard+ unmask={accessGrant.unmask}+ exportAllowed={accessGrant.export}+ /></div>)}@@ -210,3 +193,47 @@ function IssueDetailAccessGrantTarget({ target }: { target: string }) {</div>);}++/**+ * "This grant allows" card: a neutral header bar and one row per+ * granted capability. The risk signal lives in the rows, not the+ * chrome — the unmask row goes warning-toned (text + icon) while+ * everything else stays grey. Built from `warning` / `control-*`+ * tokens only; kept local for now, can be lifted when the request+ * drawer's confirmation step adopts the same shape.+ */+function GrantScopeCard({+ unmask,+ exportAllowed,+}: {+ unmask: boolean;+ exportAllowed: boolean;+}) {+ const { t } = useTranslation();+ return (+ <div className="overflow-hidden rounded-sm border border-control-border">+ <div className="flex items-center gap-x-2 border-b border-control-border bg-control-bg px-3 py-2 text-sm font-medium text-control">+ <Shield className="size-4 shrink-0" />+ <span>{t("issue.access-grant.this-grant-allows")}</span>+ </div>+ <div className="flex flex-col">+ {unmask && (+ // Unmask carries the entire sensitive-access signal —+ // warning-toned text + icon make the verdict live in the+ // row itself. Export and any future Tier-1 capability stay+ // neutral; the contrast is the warning.+ <div className="flex items-center gap-x-2 px-3 py-2 text-sm text-warning-hover">+ <EyeOff className="size-4 shrink-0" />+ <span>{t("issue.access-grant.unmask-data-in-results")}</span>+ </div>+ )}+ {exportAllowed && (+ <div className="flex items-center gap-x-2 px-3 py-2 text-sm">+ <Download className="size-4 shrink-0 text-control-light" />+ <span>{t("issue.access-grant.export-results-to-file")}</span>+ </div>+ )}+ </div>+ </div>+ );+}diff --git a/frontend/src/react/router/navigation.test.ts b/frontend/src/react/router/navigation.test.tsindex f8dbc66b9c..98d7f9a55e 100644--- a/frontend/src/react/router/navigation.test.ts+++ b/frontend/src/react/router/navigation.test.ts@@ -12,6 +12,7 @@ beforeEach(() => {new Map<string, string>([["auth.signin", "/auth"],["project.detail", "/projects/:projectId"],+ ["project.issue.detail", "/projects/:projectId/issues/:issueId"],]));});@@ -42,6 +43,39 @@ describe("navigation resolvePath", () => {test("unknown name falls back to / (never throws mid-guard)", () => {expect(resolvePath("does.not.exist")).toBe("/");});++ // Regression: a substring-prefix collision in the params bag (e.g.+ // `:project` inherited from the SQL-editor route alongside an+ // explicit `:projectId` for an issue route) used to corrupt the+ // longer placeholder, turning `/projects/:projectId/issues/:issueId`+ // into `/projects/<v>Id/issues/123`. The substitution must match+ // `:key` as a whole token.+ test("does not substring-replace `:project` inside `:projectId`", () => {+ expect(+ resolvePath("project.issue.detail", {+ params: {+ project: "from-inherited-route",+ projectId: "project-sample",+ issueId: "123",+ },+ })+ ).toBe("/projects/project-sample/issues/123");+ });++ // Order-of-iteration safety: even if the shorter key appears first+ // in `Object.entries`, the negative-lookahead guard prevents the+ // collision. Both orderings must produce the same result.+ test("token match is independent of params iteration order", () => {+ expect(+ resolvePath("project.issue.detail", {+ params: {+ projectId: "p1",+ project: "p1",+ issueId: "i1",+ },+ })+ ).toBe("/projects/p1/issues/i1");+ });});describe("navigation dispatch", () => {diff --git a/frontend/src/react/router/navigation.ts b/frontend/src/react/router/navigation.tsindex 1d8801a4ca..4fd9efe047 100644--- a/frontend/src/react/router/navigation.ts+++ b/frontend/src/react/router/navigation.ts@@ -79,7 +79,18 @@ export function resolvePath(for (const [key, value] of Object.entries(options.params)) {if (value === undefined) continue;const single = Array.isArray(value) ? (value[0] ?? "") : value;- path = path.replace(`:${key}`, encodeURIComponent(single));+ // Match `:key` only when NOT followed by another identifier char,+ // so `:project` doesn't substring-match inside `:projectId` and+ // turn `/projects/:projectId/...` into `/projects/<v>Id/...`. The+ // collision shows up when callers merge in inherited route params+ // (e.g. the SQL editor's `:project` clobbers the issue route's+ // `:projectId`). React-router param names are restricted to+ // `[A-Za-z0-9_]+`, so the negative lookahead is safe — no regex+ // escape needed.+ path = path.replace(+ new RegExp(`:${key}(?![A-Za-z0-9_])`),+ encodeURIComponent(single)+ );}}if (options.query) {