Skip to content

[server] enable auth for snapshot creation #3444

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 1 commit into from
Mar 18, 2021

Conversation

JanKoehnlein
Copy link
Contributor

The problem is that for snapshot creation, we don't have a snapshot yet, and as such have to provide the workspaceID instead for the create token. This creates an ambiguity between

snapshot:<snapshot ID>:create
snapshot:<workspace ID>:create

which has to be resolved. This solution uses a prefix if the subjectID is a workspaceID.

I refrained from creating a SnapshotCreateResourceGuard wire that up using a CompositeResourceGuard as the latter only ORs the composite guards. As such the TokenResourceGuard would still accept a SnapshotResource whose snapshotID equals the workspaceID for which the permission has been granted. So our hope that we could solve this with a local additive change was wrong. Alternatively, we could either add a VetoCompositeResourceGuard or put the entire filtering and matching logic into TokenResourceGuard. Both appeared far more invasive to me than the prefix approach.

@JanKoehnlein JanKoehnlein requested a review from csweichel March 15, 2021 10:08
@JanKoehnlein
Copy link
Contributor Author

How to test this

Copy link
Contributor

@csweichel csweichel left a comment

Choose a reason for hiding this comment

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

Works as expected :)
Love the resource guard change - it's much simpler than what we originally discussed.

Only the message is quite verbose and somewhat hard to parse.
I'd propose something like this:

before after
image image

@akosyakov akosyakov force-pushed the jankoehnlein/code-allow-snapshot-2811 branch 2 times, most recently from 41c98f8 to ec54ff2 Compare March 15, 2021 12:25
JanKoehnlein added a commit to gitpod-io/openvscode-server that referenced this pull request Mar 15, 2021
@JanKoehnlein JanKoehnlein requested a review from csweichel March 15, 2021 14:09
JanKoehnlein added a commit to gitpod-io/openvscode-server that referenced this pull request Mar 16, 2021
@JanKoehnlein JanKoehnlein force-pushed the jankoehnlein/code-allow-snapshot-2811 branch from 56dd37a to a6695a7 Compare March 16, 2021 08:28
@csweichel
Copy link
Contributor

image

Personally I still find the URL in there to be too much noise :/

@JanKoehnlein
Copy link
Contributor Author

Personally I still find the URL in there to be too much noise :/

Yes, it is noisy. The problem is that the "Copy URL to Clipboard" will silently fail when clipboard access is not granted in the browser, and VS Code seems to block all other ways to present the URL in the dialog. And it's a bit better if the base URL is just https://gitpod.io.

For the time being, we could add an outputChannel and print the URL there, such that users can copy it themselves. In the long run, we should go for another UI that also allows browsing all snapshots of that workspace. Still we have to solve the copy/paste problem.

@akosyakov
Copy link
Member

I think we can go with it for now and then replace it with proper webview which will fix the clipboard issue as well. @svenefftinge would it be fine?

@svenefftinge
Copy link
Contributor

Is using a link as Chris proposed not possible within the notification? I would find that more UX-friendly, as it is easier on the eye and easier to copy.

@akosyakov
Copy link
Member

@JanKoehnlein I read through the code and it seems that links are supported with markdown syntax: https://github.com/microsoft/vscode/blob/a699ffaee62010c4634d301da2bbdb7646b8d1da/src/vs/base/common/linkedText.ts#L26-L28

i.e. [label](url)

@JanKoehnlein
Copy link
Contributor Author

I tried markdown links in a VS Code message dialog yesterday, but it didn't work. Tried again today, and now it works. Must have slightly messed up the syntax. So now it's a link. Sorry for the noise (in all regards)

@akosyakov akosyakov force-pushed the jankoehnlein/code-allow-snapshot-2811 branch from a6695a7 to 0e83f05 Compare March 16, 2021 12:27
Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

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

LGTM

@JanKoehnlein JanKoehnlein merged commit 9da787c into main Mar 18, 2021
@JanKoehnlein JanKoehnlein deleted the jankoehnlein/code-allow-snapshot-2811 branch March 18, 2021 13:00
akosyakov pushed a commit to gitpod-io/openvscode-server that referenced this pull request Apr 12, 2021
pavan-tri pushed a commit to trilogy-group/gitpod that referenced this pull request Apr 28, 2021
JanKoehnlein added a commit to gitpod-io/openvscode-server that referenced this pull request May 19, 2021
JanKoehnlein added a commit to gitpod-io/openvscode-server that referenced this pull request May 19, 2021
akosyakov pushed a commit to gitpod-io/openvscode-server that referenced this pull request Jun 26, 2021
akosyakov pushed a commit to gitpod-io/openvscode-server that referenced this pull request Jun 27, 2021
akosyakov pushed a commit to gitpod-io/openvscode-server that referenced this pull request Jul 14, 2021
akosyakov pushed a commit to gitpod-io/openvscode-server that referenced this pull request Jul 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants