Skip to content

Commit 659800c

Browse files
committed
Add deployment config
1 parent 57cb9b7 commit 659800c

File tree

5 files changed

+19
-16
lines changed

5 files changed

+19
-16
lines changed

coderd/coderd.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,11 @@ func New(options *Options) *API {
171171
options = &Options{}
172172
}
173173

174-
rbac.ReloadBuiltinRoles(&rbac.RoleOptions{
175-
NoOwnerWorkspaceExec: true,
176-
})
174+
if options.DeploymentValues.DisableOwnerWorkspaceExec {
175+
rbac.ReloadBuiltinRoles(&rbac.RoleOptions{
176+
NoOwnerWorkspaceExec: true,
177+
})
178+
}
177179

178180
if options.Authorizer == nil {
179181
options.Authorizer = rbac.NewCachingAuthorizer(options.PrometheusRegistry)

coderd/coderdtest/coderdtest.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ func NewOptions(t *testing.T, options *Options) (func(http.Handler), context.Can
203203
if options.DeploymentValues == nil {
204204
options.DeploymentValues = DeploymentValues(t)
205205
}
206+
// This value is not safe to run in parallel. Force it to be false.
207+
options.DeploymentValues.DisableOwnerWorkspaceExec = false
206208

207209
// If no ratelimits are set, disable all rate limiting for tests.
208210
if options.APIRateLimit == 0 {

coderd/rbac/object.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,6 @@ var (
136136
Type: "organization_member",
137137
}
138138

139-
// ResourceWildcard represents all resource types
140-
ResourceWildcard = Object{
141-
Type: WildcardSymbol,
142-
}
143-
144139
// ResourceLicense is the license in the 'licenses' table.
145140
// ResourceLicense is site wide.
146141
// create/delete = add or remove license from site.

coderd/rbac/roles.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ func allPermsExcept(excepts ...Object) []Permission {
8080
if skip[r.Type] {
8181
continue
8282
}
83-
// Do not include the wildcard
84-
if r.Type == ResourceWildcard.Type {
85-
continue
86-
}
8783
// Owners can do everything else
8884
perms = append(perms, Permission{
8985
Negate: false,
@@ -149,10 +145,8 @@ func ReloadBuiltinRoles(opts *RoleOptions) {
149145
// All users can see the provisioner daemons.
150146
ResourceProvisionerDaemon.Type: {ActionRead},
151147
}),
152-
Org: map[string][]Permission{},
153-
User: Permissions(map[string][]Action{
154-
ResourceWildcard.Type: {WildcardSymbol},
155-
}),
148+
Org: map[string][]Permission{},
149+
User: allPermsExcept(),
156150
}
157151
},
158152

codersdk/deployment.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ type DeploymentValues struct {
162162
GitAuthProviders clibase.Struct[[]GitAuthConfig] `json:"git_auth,omitempty" typescript:",notnull"`
163163
SSHConfig SSHConfig `json:"config_ssh,omitempty" typescript:",notnull"`
164164
WgtunnelHost clibase.String `json:"wgtunnel_host,omitempty" typescript:",notnull"`
165+
DisableOwnerWorkspaceExec clibase.Bool `json:"disable_owner_workspace_exec,omitempty" typescript:",notnull"`
165166

166167
Config clibase.String `json:"config,omitempty" typescript:",notnull"`
167168
WriteConfig clibase.Bool `json:"write_config,omitempty" typescript:",notnull"`
@@ -1302,6 +1303,15 @@ when required by your organization's security policy.`,
13021303
Value: &c.DisablePathApps,
13031304
YAML: "disablePathApps",
13041305
},
1306+
{
1307+
Name: "Disable Owner Workspace Execution",
1308+
Description: "Remove the permission for the 'owner' role to have workspace execution on all workspaces. This prevents the 'owner' from ssh, apps, and terminal access based on the 'owner' role. They still have their user permissions to access their own workspaces.",
1309+
Flag: "disable-owner-workspace-exec",
1310+
Env: "CODER_DISABLE_OWNER_WORKSPACE_EXEC",
1311+
1312+
Value: &c.DisableOwnerWorkspaceExec,
1313+
YAML: "disableOwnerWorkspaceExec",
1314+
},
13051315
{
13061316
Name: "Session Duration",
13071317
Description: "The token expiry duration for browser sessions. Sessions may last longer if they are actively making requests, but this functionality can be disabled via --disable-session-expiry-refresh.",

0 commit comments

Comments
 (0)