Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change samesite for workspace owner cookie #19028

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion components/server/src/user/user-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { GitpodServerImpl } from "../workspace/gitpod-server-impl";
import { StopWorkspacePolicy } from "@gitpod/ws-manager/lib";
import { UserService } from "./user-service";
import { WorkspaceService } from "../workspace/workspace-service";
import { getExperimentsClientForBackend } from "@gitpod/gitpod-protocol/lib/experiments/configcat-server";

export const ServerFactory = Symbol("ServerFactory");
export type ServerFactory = () => GitpodServerImpl;
Expand Down Expand Up @@ -358,12 +359,16 @@ export class UserController {
return;
}

const useSameSiteNone = await getExperimentsClientForBackend().getValueAsync("sameSiteNone", false, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the goal of introducing a feature flag here? I'd like to understand the motivation and broader idea before we merge sth like this. πŸ™‚
E.g., if the problem is "public port" is to public, then this is not a fix, but makes it worse. 🀷

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a feature flag so we can disable it in case we overlooked something during testing

user,
});

res.cookie(name, token, {
path: "/",
httpOnly: true,
secure: true,
maxAge: 1000 * 60 * 60 * 24 * 1, // 1 day
sameSite: "lax", // default: true. "Lax" needed for cookie to work in the workspace domain.
sameSite: useSameSiteNone ? "none" : "lax", // default: true. "Lax" needed for cookie to work in the workspace domain.
domain: `.${this.config.hostUrl.url.host}`,
});
res.sendStatus(200);
Expand Down
Loading