-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Improve hostname validation #4118
Conversation
@@ -18,7 +18,7 @@ import { BitbucketTokenHelper } from "./bitbucket-token-handler"; | |||
const expect = chai.expect; | |||
import { skipIfEnvVarNotSet } from "@gitpod/gitpod-protocol/lib/util/skip-if"; | |||
|
|||
@suite.only(timeout(10000), skipIfEnvVarNotSet("GITPOD_TEST_TOKEN_BITBUCKET")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
const workspaceId = url.workspaceId; | ||
if (workspaceId) { | ||
const hostname = url.url.hostname as string; | ||
if (hostname.startsWith(workspaceId)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice if we had one place for the workspace URL parsing. But might be out of scope for this PR, as it was here before, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitpodHostUrl
does the URL parsing. Here we explicitly check, that the workspace-like hostname is not prefixed.
Ah, perhaps you mean to extract the computation of the prefix and move it to GitpodHostUrl
? 🤷🏻♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested, works fine. Also, re-enables the test that failed because of this! ❤️
No description provided.