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

Fix Trusted Types violations (round #3) #108400

Closed
8 tasks done
jrieken opened this issue Oct 9, 2020 · 6 comments
Closed
8 tasks done

Fix Trusted Types violations (round #3) #108400

jrieken opened this issue Oct 9, 2020 · 6 comments
Assignees
Labels
engineering VS Code - Build / issue tracking / etc. insiders-released Patch has been released in VS Code Insiders
Milestone

Comments

@jrieken
Copy link
Member

jrieken commented Oct 9, 2020

Current remaining violations. Compiled this list using yarn tsec-compile-check and the .vscode/searches/TrustedTypes.code-search

Usage of innerHTML

Worker, use createScriptUrl

  • src/vs/base/worker/defaultWorkerFactory.ts @alexdima
  • src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.ts @alexdima
  • src/vs/workbench/services/extensions/worker/extensionHostWorker.ts @alexdima

Script.text

  • src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts @connor4312
@jrieken jrieken self-assigned this Oct 9, 2020
@jrieken jrieken added the engineering VS Code - Build / issue tracking / etc. label Oct 9, 2020
@jrieken jrieken added this to the October 2020 milestone Oct 9, 2020
@jrieken jrieken modified the milestones: October 2020, November 2020 Oct 27, 2020
@alexdima
Copy link
Member

FYI @jrieken : running yarn tsec-compile-check shows much more errors than the ones captured above. This can be easily reproduced using yarn upgrade tsec --latest which I did on my machine and got a newer node module.

@jrieken
Copy link
Member Author

jrieken commented Nov 25, 2020

Worker -- I don't know what to do here, we use new Worker()

@alexdima for workers a trusted script url should be enough to fix things

@jrieken
Copy link
Member Author

jrieken commented Dec 9, 2020

Since the tsec tool is still over eager with errors and incompatible with latest TS syntax:
ttpatch.diff.txt The patch installs a default trusted types policy and warns whenever that's being used. For this to work need to run the "right code" - which is sometimes tricky.

@connor4312
Copy link
Member

sorry for the silly question, this is my first trusted types ping -- what should I do if the usage is intended? In the renderer webview, we intentionally want to insert unsanitized HTML that's rendered for the webview.

@alexdima
Copy link
Member

alexdima commented Dec 9, 2020

@connor4312 Here are 3 examples of what I had to do when I really had to use .innerHTML:

84cf12f#diff-b41fb33a1ffaa149285201e892f84c51e34e9eda746019cf41e7209972ff3d51

@alexdima alexdima removed their assignment Dec 9, 2020
@connor4312
Copy link
Member

got it, thanks!

@jrieken jrieken assigned Tyriar and unassigned meganrogge Jan 5, 2021
@Tyriar Tyriar closed this as completed in e8edff5 Jan 6, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Feb 20, 2021
lemanschik pushed a commit to code-oss-dev/code that referenced this issue Nov 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
engineering VS Code - Build / issue tracking / etc. insiders-released Patch has been released in VS Code Insiders
Projects
None yet
Development

No branches or pull requests

6 participants
@jrieken @Tyriar @connor4312 @alexdima @meganrogge and others