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

pref: use whitelist for allowed href values #6499

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

LIlGG
Copy link
Member

@LIlGG LIlGG commented Aug 23, 2024

What type of PR is this?

/kind improvement
/area editor
/milestone 2.19.x

What this PR does / why we need it:

使用白名单校验替换原有的黑名单校验,解决 a 标签潜在的安全问题。

移除自定义的解决方案,使用 Tiptap 所提供的白名单方案。

How to test it?

测试 a 标签的 href 链接是否会受到 xss 的影响。

同时测试 #5479 的情况是否还会发生。即默认富文本编辑器中当链接为纯数字时是否还会报错。

Does this PR introduce a user-facing change?

使用白名单校验 a 标签的 href 用于解决潜在的安全问题。

@f2c-ci-robot f2c-ci-robot bot added kind/improvement Categorizes issue or PR as related to a improvement. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Aug 23, 2024
@f2c-ci-robot f2c-ci-robot bot added this to the 2.19.x milestone Aug 23, 2024
@f2c-ci-robot f2c-ci-robot bot added the area/editor Issues or PRs related to the Editor label Aug 23, 2024
@f2c-ci-robot f2c-ci-robot bot requested review from Aanko and JohnNiang August 23, 2024 04:09
Copy link

Copy link

codecov bot commented Aug 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.22%. Comparing base (6cd8dc8) to head (b84c8a6).
Report is 5 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6499      +/-   ##
============================================
+ Coverage     58.18%   58.22%   +0.04%     
- Complexity     3774     3775       +1     
============================================
  Files           651      651              
  Lines         22125    22128       +3     
  Branches       1538     1538              
============================================
+ Hits          12873    12885      +12     
+ Misses         8641     8634       -7     
+ Partials        611      609       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ruibaby
Copy link
Member

ruibaby commented Aug 23, 2024

除此之外,建议升级 tiptap 的依赖至 https://github.com/ueberdosis/tiptap/releases/tag/v2.6.4 以上,其中 https://github.com/ueberdosis/tiptap/pull/5470 也处理了相关的问题。

升级依赖可以单独提交 PR。

Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

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

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Aug 23, 2024
Copy link

f2c-ci-robot bot commented Aug 23, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ruibaby

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 23, 2024
@f2c-ci-robot f2c-ci-robot bot merged commit 9b99698 into halo-dev:main Aug 23, 2024
8 checks passed
@ruibaby ruibaby modified the milestones: 2.19.x, 2.19.0 Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/editor Issues or PRs related to the Editor kind/improvement Categorizes issue or PR as related to a improvement. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants