Skip to content

Commit 5b6325f

Browse files
author
Christian Weichel
committed
Remove privileged feature flag and permission
now that we have user-namespaced workspaces the privileged flag has become even more of a nuisance and technical debt. Fixes #3058
1 parent f3f67fc commit 5b6325f

19 files changed

+259
-575
lines changed

components/gitpod-db/src/typeorm/entity/db-user.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@ export class DBUser implements User {
6060
})
6161
blocked?: boolean;
6262

63-
@Column({
64-
default: false
65-
})
66-
privileged?: boolean;
67-
6863
@Column({
6964
type: 'simple-json',
7065
nullable: true

components/gitpod-protocol/go/gitpod-config-types.go

Lines changed: 0 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/gitpod-protocol/src/permission.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ export namespace Permission {
4040
/** The permission for actions like block user, stop workspace, etc. */
4141
export const ENFORCEMENT: PermissionName = "enforcement";
4242

43-
/** The permission to start privileged workspaces */
44-
export const PRIVILEGED_WORKSPACE: PermissionName = "privileged-ws";
45-
4643
/** The permission for registry access (start workspaces referencing gitpod-internal Docker images) */
4744
export const REGISTRY_ACCESS: PermissionName = "registry-access";
4845

@@ -77,7 +74,6 @@ export namespace Role {
7774
permissions: [
7875
Permission.MONITOR,
7976
Permission.ENFORCEMENT,
80-
Permission.PRIVILEGED_WORKSPACE,
8177
Permission.REGISTRY_ACCESS,
8278
Permission.IDE_SETTINGS
8379
]
@@ -89,7 +85,6 @@ export namespace Role {
8985
permissions: [
9086
Permission.MONITOR,
9187
Permission.REGISTRY_ACCESS,
92-
Permission.PRIVILEGED_WORKSPACE,
9388
]
9489
};
9590

components/gitpod-protocol/src/protocol.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ export interface User {
3535
*/
3636
blocked?: boolean;
3737

38-
/**
39-
* whether this user can run workspaces in privileged mode
40-
*/
41-
privileged?: boolean;
42-
4338
/** A map of random settings that alter the behaviour of Gitpod on a per-user basis */
4439
featureFlags?: UserFeatureSettings;
4540

@@ -151,7 +146,7 @@ export interface UserFeatureSettings {
151146
* The values of this type MUST MATCH enum values in WorkspaceFeatureFlag from ws-manager/client/core_pb.d.ts
152147
* If they don't we'll break things during workspace startup.
153148
*/
154-
export const WorkspaceFeatureFlags = { "privileged": undefined, "registry_facade": undefined, "full_workspace_backup": undefined, "fixed_resources": undefined, "user_namespace": undefined };
149+
export const WorkspaceFeatureFlags = { "registry_facade": undefined, "full_workspace_backup": undefined, "fixed_resources": undefined, "user_namespace": undefined };
155150
export type NamedWorkspaceFeatureFlag = keyof (typeof WorkspaceFeatureFlags);
156151

157152
export interface UserEnvVarValue {

components/server/src/user/authorization-service.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export class PermissionSpec {
2323

2424
expect(cut.hasPermission(userViewer, Permission.MONITOR)).to.be.true;
2525
expect(cut.hasPermission(userViewer, Permission.REGISTRY_ACCESS)).to.be.true;
26-
expect(cut.hasPermission(userViewer, Permission.PRIVILEGED_WORKSPACE)).to.be.true;
2726
expect(cut.hasPermission(userViewer, Permission.ENFORCEMENT)).to.be.false;
2827
}
2928

@@ -36,7 +35,6 @@ export class PermissionSpec {
3635

3736
expect(cut.hasPermission(userDev, Permission.MONITOR)).to.be.true;
3837
expect(cut.hasPermission(userDev, Permission.REGISTRY_ACCESS)).to.be.true;
39-
expect(cut.hasPermission(userDev, Permission.PRIVILEGED_WORKSPACE)).to.be.true;
4038
expect(cut.hasPermission(userDev, Permission.ENFORCEMENT)).to.be.true;
4139
}
4240
}

components/server/src/websocket-connection-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { ErrorCodes as RPCErrorCodes, MessageConnection, ResponseError } from "v
1515
import { AllAccessFunctionGuard, FunctionAccessGuard, WithFunctionAccessGuard } from "./auth/function-access";
1616
import { RateLimiter, UserRateLimiter } from "./auth/rate-limiter";
1717
import { CompositeResourceAccessGuard, OwnerResourceGuard, ResourceAccessGuard, SharedWorkspaceAccessGuard, WithResourceAccessGuard } from "./auth/resource-access";
18-
import { increaseApiCallCounter, increaseApiConnectionClosedCounter, increaseApiConnectionCounter, increaseApiCallUserCounter } from "./prometheusMetrics";
18+
import { increaseApiCallCounter, increaseApiConnectionClosedCounter, increaseApiConnectionCounter, increaseApiCallUserCounter } from "./prometheus-metrics";
1919
import { GitpodServerImpl } from "./workspace/gitpod-server-impl";
2020

2121
export type GitpodServiceFactory<C extends GitpodClient, S extends GitpodServer> = () => GitpodServerImpl<C, S>;

components/server/src/workspace/workspace-starter.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,7 @@ export class WorkspaceStarter {
246246
if (user.featureFlags && user.featureFlags.permanentWSFeatureFlags) {
247247
featureFlags = featureFlags.concat(featureFlags, user.featureFlags.permanentWSFeatureFlags);
248248
}
249-
// privileged are special cases which require the privileged-ws permission
250-
if (!this.authService.hasPermission(user, "privileged-ws")) {
251-
featureFlags = featureFlags.filter(f => f != "privileged");
252-
}
253-
249+
254250
// if the user has feature preview enabled, we need to add the respective feature flags.
255251
// Beware: all feature flags we add here are not workspace-persistent feature flags, e.g. no full-workspace backup.
256252
if (!!user.additionalData?.featurePreview) {

components/ws-manager-api/core.proto

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,9 @@ enum WorkspaceFeatureFlag {
421421
// NOOP feature flag is just here because I don't want privileged to be 0
422422
NOOP = 0;
423423

424-
// Privileged workspaces allow users to become root
425-
PRIVILEGED = 1;
424+
// Privileged workspaces allowed users to become root by making them root on the machine.
425+
// They've been the precursor to user-namespaced workspaces.
426+
reserved 1;
426427

427428
// Was used for appplitools-specific workspace config (e.g., proxy + network restriction)
428429
// APPLITOOLS = 2;

0 commit comments

Comments
 (0)