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

Open sponsor link should ask user if they want to open an external URL #150828

Closed
isidorn opened this issue May 31, 2022 · 12 comments · Fixed by #155545
Closed

Open sponsor link should ask user if they want to open an external URL #150828

isidorn opened this issue May 31, 2022 · 12 comments · Fixed by #155545
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Milestone

Comments

@isidorn
Copy link
Contributor

isidorn commented May 31, 2022

Testing #150748

  1. code-insiders with new user data dir
  2. Search for my extension isidor-tryout https://marketplace.visualstudio.com/items?itemName=inikolic.isidor-tryout
  3. Click on the sponsor link -> notice how the patreon link just opens

I would have expected that VS Code would ask me if I am sure I want to open an external link.
I think we should just re-use the service that @rzhao271 introduced

@sandy081 sandy081 assigned sbatten and unassigned sandy081 May 31, 2022
@sandy081 sandy081 added bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority labels May 31, 2022
@sandy081
Copy link
Member

I use IOpenerService to open the URL and I expect that it asks for confirmation

return this.openerService.open(this.extension.publisherSponsorLink);

But, it seems the trusted domains validator is not showing the dialog

Assigning to @sbatten because I assume the workspace trust change might have broken this

if (this._workspaceTrustService.isWorkspaceTrusted() && !this._configurationService.getValue('workbench.trustedDomains.promptInTrustedWorkspace')) {
return true;
}

@sbatten
Copy link
Member

sbatten commented May 31, 2022

This was introduced via #124325 by @JacksonKearl. The logic is that the workspace is trusted and therefore we don't need to prompt, but I'm not sure we considered extension provided links.

@isidorn
Copy link
Contributor Author

isidorn commented Jun 1, 2022

Yes, that assumption might be flawed.
Adding an option to the openerService sounds like a potential path forward, however then it is up to the implementor to know if a link is extension provided which is error prone.
This is a special case because the extension can even be not installed. If the extension is installed we have bigger problems...

@sbatten what do you suggest we do here?

@sbatten
Copy link
Member

sbatten commented Jun 1, 2022

an option to the opener service was what I was originally thinking. I would expect it to be opt-in (i.e. you have to say you want to rely on workspace trust) otherwise by default, the link prompts. This would likely lead to a few cases where you are prompted erroneously, but its safer than the alternative. I'm not sure if the option makes sense on the opener service though, so I defer to that knowledge.

@sandy081
Copy link
Member

sandy081 commented Jun 2, 2022

Good idea. I like that by default we show the dialog if the domain is not trusted. One can override that if they depend on workspace trust.

@sandy081
Copy link
Member

sandy081 commented Jun 2, 2022

Is it possible to get this into this milestone?

@isidorn
Copy link
Contributor Author

isidorn commented Jun 2, 2022

This idea works for me.
+1 if possible for this milestone since I see Jackson's change is from this milestone and I worry this might cause some msrc cases to get opened potentially.

@sbatten
Copy link
Member

sbatten commented Jun 2, 2022

Jackon's change was actually introduced a year ago (May '21). Should this change come from @bpasero @lramos15 ?

@isidorn
Copy link
Contributor Author

isidorn commented Jun 2, 2022

Oh wrong May haha
Then it might be fine to do this in debt week. I leave it up to you to decide :)

@sbatten sbatten added this to the June 2022 milestone Jun 2, 2022
@bpasero
Copy link
Member

bpasero commented Jun 3, 2022

I suggest that this change is done by someone on the workspace trust team because the motivation for the change in the first place comes from you and you know best how you want to treat trust and link opening I would say. I can review the change though.

@sbatten
Copy link
Member

sbatten commented Jun 3, 2022

I see 3 parts here:

  1. The code in the opener service that correlates workspace trust and trusted domains
  2. The opener service options bag that tells us where it should be correlated
  3. The adoption of others to opt into this behavior

I can do 2 and update 1 if that's a reasonable property on the openerservice api

@sbatten sbatten modified the milestones: June 2022, July 2022 Jun 30, 2022
@sbatten
Copy link
Member

sbatten commented Jun 30, 2022

sorry I didn't get to this in June, will tackle next week

sbatten added a commit that referenced this issue Jul 21, 2022
* pipe workspace boolean for opener service validator
fixes #150828

* add fromWorkspace to notebook backlayer webview
@VSCodeTriageBot VSCodeTriageBot added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Jul 21, 2022
@isidorn isidorn added the verified Verification succeeded label Jul 27, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Sep 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants