You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bundle: warn when a workspace path is in /Workspace/Shared without users CAN_MANAGE
Renames ValidateSharedRootPermissions to ValidateWorkspaceSharedPermissions and
extends it to also cover workspace.state_path. It warns when root_path or state_path
is in /Workspace/Shared — granting read/write to all workspace users — but the
top-level permissions section does not declare that access via group_name: users
CAN_MANAGE.
The state_path warning is suppressed only when state_path is nested under root_path,
since the root warning already covers it. When state_path is a separate shared
folder, both warnings fire.
Co-authored-by: Shreyas Goenka <shreyas.goenka@databricks.com>
// Whether the top-level permissions grant group_name: users CAN_MANAGE, i.e.
35
+
// the broad /Workspace/Shared access is intentional and declared.
36
+
usersCanManage:=false
35
37
for_, p:=rangeb.Config.Permissions {
36
38
ifp.GroupName=="users"&&p.Level==CAN_MANAGE {
37
-
allUsers=true
39
+
usersCanManage=true
38
40
break
39
41
}
40
42
}
41
43
42
-
if!allUsers {
44
+
// root_path is in /Workspace/Shared without users CAN_MANAGE.
45
+
ifrootIsShared&&!usersCanManage {
43
46
diags=diags.Append(diag.Diagnostic{
44
47
Severity: diag.Warning,
45
-
Summary: fmt.Sprintf("the bundle root path %s is writable by all workspace users", b.Config.Workspace.RootPath),
46
-
Detail: "The bundle is configured to use /Workspace/Shared, which will give read/write access to all users. If this is intentional, add CAN_MANAGE for 'group_name: users' permission to your bundle configuration. If the deployment should be restricted, move it to a restricted folder such as /Workspace/Users/<username or principal name>.",
48
+
Summary: fmt.Sprintf("the bundle root path %s is writable by all workspace users", rootPath),
49
+
Detail: "The bundle root path is in /Workspace/Shared, giving read/write access to all workspace users that is not reflected in the permissions section. If this is intentional, add CAN_MANAGE for 'group_name: users' to your bundle permissions. Otherwise, move the bundle to a restricted path such as /Workspace/Users/<username>.",
50
+
})
51
+
}
52
+
53
+
// state_path is in /Workspace/Shared without users CAN_MANAGE. Skip only when
54
+
// state_path is nested under root_path, since the root warning above already
55
+
// covers it. When state_path is a separate folder, warn about it on its own.
Summary: fmt.Sprintf("the bundle state path %s is writable by all workspace users", statePath),
60
+
Detail: "The bundle state path is in /Workspace/Shared, giving read/write access to all workspace users that is not reflected in the permissions section. If this is intentional, add CAN_MANAGE for 'group_name: users' to your bundle permissions. Otherwise, move the state path to a restricted location such as /Workspace/Users/<username>.",
47
61
})
48
62
}
49
63
50
64
returndiags
51
65
}
66
+
67
+
// statePathUnderRootPath returns true when statePath is nested under rootPath, in
68
+
// which case permissions applied to root_path also cover the state directory.
69
+
//
70
+
// By default state_path lives under root_path (it defaults to "${root_path}/state"),
71
+
// so we treat it as nested unless both paths are set and root_path is genuinely not a
72
+
// prefix of state_path. That keeps us from emitting a separate state warning for the
73
+
// common case.
74
+
//
75
+
// Both paths are /Workspace-normalized by PrependWorkspacePrefix before this mutator
76
+
// runs, so the prefix comparison here is reliable.
0 commit comments