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: webview csp source #2597

Merged
merged 1 commit into from
Apr 18, 2023
Merged

fix: webview csp source #2597

merged 1 commit into from
Apr 18, 2023

Conversation

life2015
Copy link
Member

@life2015 life2015 commented Apr 18, 2023

Types

  • 🐛 Bug Fixes

Background or solution

之前 OpenSumi 对于 WebView CSPSource 做了一个处理,但是存在一个空格的问题会导致设置错误,这个 PR 修复了空格的问题。

image

🤖 Generated by Copilot at d9433d5

  • Fix webview resource loading bug by adding a space before 'self' in cspSource (link)

Changelog

🤖 Generated by Copilot at d9433d5

Fix a webview resource loading bug by adding a space in the cspSource string. The bug affected extensions that use webviews and was caused by a typo in ext.host.api.webview.ts.

@life2015 life2015 requested a review from Aaaaash April 18, 2023 02:57
@CLAassistant
Copy link

CLAassistant commented Apr 18, 2023

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


retrox.jcy seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@opensumi opensumi bot added the 🐞 bug Something isn't working label Apr 18, 2023
@github-actions
Copy link
Contributor

ChatGPT Code Review:

Code Review:

这个 diff 文件只有一个改动,就是在 cspSource 属性中添加了一个空格。之前的代码中,selfvscode-resource 之间没有空格,但是改动后在它们之间添加了一个空格。

这个改动的目的可能是为了修复 CSP(Content Security Policy)的问题。CSP 是一种安全机制,用于保护 Web 应用程序免受 XSS 和其他网络攻击。这个改动可能是因为之前的 CSP 设置方式不符合要求,导致应用程序受到攻击。

建议:

可以进一步检查之前的 CSP 设置是否符合要求,以及这个改动是否已经解决了之前的问题。

对于这个 diff 文件的修改建议如下:

  • 在代码中添加注释,解释这个修改的目的是为了修复 CSP 问题。
  • 可以将 'self'vscode-resource 之间的空格与其他的空格保持一致,以提高代码的可读性。

Commit Message:

根据 Angular 规范,一个合适的 commit message 包括三个部分:header、body 和 footer。

这个代码修改的 header 可以是 "fix: fix CSP issue in webview",表示这个修改是为了修复 CSP 问题。在 body 部分,可以详细说明问题和解决方案。在 footer 部分,可以添加更多的信息,例如 issue number,相关的 Pull Request 等。

@codecov
Copy link

codecov bot commented Apr 18, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (d3afff4) 57.63% compared to head (d9433d5) 57.63%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2597   +/-   ##
=======================================
  Coverage   57.63%   57.63%           
=======================================
  Files        1327     1327           
  Lines       83598    83598           
  Branches    17413    17413           
=======================================
  Hits        48185    48185           
  Misses      32175    32175           
  Partials     3238     3238           
Flag Coverage Δ
jsdom 52.65% <0.00%> (ø)
node 16.76% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...sion/src/hosted/api/vscode/ext.host.api.webview.ts 69.89% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@erha19 erha19 merged commit 1ed75f0 into main Apr 18, 2023
14 checks passed
@erha19 erha19 deleted the fix/webview-csp-source branch April 18, 2023 07:24
@erha19 erha19 added this to the 2.24 milestone Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants