-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[server] Remove admin OTS create/use flow #16761
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,38 +190,6 @@ export class UserController { | |
} | ||
}); | ||
|
||
router.get( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do we login to a websession with the new credentials? Not set up, yet? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
"/login/ots/admin-user/:key", | ||
loginUserWithOts(async (req: express.Request, res: express.Response, user: User, secret: string) => { | ||
// In case there is no/an empty key specified: Nobody should be able to call this so they are not able to guess values here | ||
if (!this.config.admin.loginKey) { | ||
throw new ResponseError(500, "No admin login key configured, cannot login as admin-user"); | ||
} | ||
|
||
// Counterpart is here: https://github.com/gitpod-io/gitpod/blob/478a75e744a642d9b764de37cfae655bc8b29dd5/components/server/src/installation-admin/installation-admin-controller.ts#L38 | ||
const secretHash = crypto | ||
.createHash("sha256") | ||
.update(user.id + this.config.admin.loginKey) | ||
.digest("hex"); | ||
if (secretHash !== secret) { | ||
throw new ResponseError(401, "OTS secret not verified"); | ||
} | ||
|
||
// Login this user (sets cookie as side-effect) | ||
await new Promise<void>((resolve, reject) => { | ||
req.login(user, (err) => { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(); | ||
} | ||
}); | ||
}); | ||
|
||
// Simply redirect to the app for now | ||
res.redirect("/orgs/new", 307); | ||
}, BUILTIN_INSTLLATION_ADMIN_USER_ID), | ||
); | ||
router.get( | ||
"/login/ots/:userId/:key", | ||
loginUserWithOts(async (req: express.Request, res: express.Response, user: User, secret: string) => { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@easyCZ How is the admin-user unblocked in the new flow?
Just want to make sure this is not overlooked.