Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Short circuit non-dba/owner visiting instance pages.

天舟42c8f23106b9
diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts
index 9613bad4a3..acbbb35578 100644
--- a/frontend/src/router/index.ts
+++ b/frontend/src/router/index.ts
@@ -587,11 +587,8 @@ router.beforeEach((to, from, next) => {
}
}
- if (to.name === "workspace.database.create") {
- if (
- !store.getters["plan/feature"]("bytebase.dba-workflow") ||
- isDBAOrOwner(loginUser.role)
- ) {
+ if (to.name === "workspace.environment" || to.name === "workspace.instance") {
+ if (isDBAOrOwner(loginUser.role)) {
next();
} else {
next({
@@ -602,8 +599,23 @@ router.beforeEach((to, from, next) => {
return;
}
- if (to.name === "workspace.environment" || to.name === "workspace.instance") {
- if (isDBAOrOwner(loginUser.role)) {
+ // Fetching specific instance would try to fetch the sensitive info
+ // so we short circuit here for non-DBA/Owner to avoid there.
+ if (to.name?.toString().startsWith("workspace.instance.")) {
+ if (!isDBAOrOwner(loginUser.role)) {
+ next({
+ name: "error.403",
+ replace: false,
+ });
+ return;
+ }
+ }
+
+ if (to.name === "workspace.database.create") {
+ if (
+ !store.getters["plan/feature"]("bytebase.dba-workflow") ||
+ isDBAOrOwner(loginUser.role)
+ ) {
next();
} else {
next({