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 the problem that bundle files can be generated arbitrarily #6028

Conversation

JohnNiang
Copy link
Member

What type of PR is this?

/kind bug
/area core
/area plugin
/milestone 2.16.0

What this PR does / why we need it:

Before the PR, any user can generate bundle files by providing random query param v while requesting bundle files.

This PR refactors the whole bundle file generation method.

  1. Do nothing if users provide arbitrary bundle file version
  2. Better lock for writing bundle files if not exist

Special notes for your reviewer:

  1. Request http://localhost:8090/apis/api.console.halo.run/v1alpha1/plugins/-/bundle.js?v=xyz
  2. Check if the file xyz.js in folder $TMPDIR/halo-plugin-bundle**

Does this PR introduce a user-facing change?

None

Signed-off-by: JohnNiang <johnniang@foxmail.com>
@f2c-ci-robot f2c-ci-robot bot added the release-note-none Denotes a PR that doesn't merit a release note. label Jun 1, 2024
@f2c-ci-robot f2c-ci-robot bot added this to the 2.16.0 milestone Jun 1, 2024
@f2c-ci-robot f2c-ci-robot bot added the kind/bug Categorizes issue or PR as related to a bug. label Jun 1, 2024
@f2c-ci-robot f2c-ci-robot bot requested review from ruibaby and wan92hen June 1, 2024 16:38
@f2c-ci-robot f2c-ci-robot bot added area/core Issues or PRs related to the Halo Core area/plugin Issues or PRs related to the Plugin Provider labels Jun 1, 2024
Copy link

f2c-ci-robot bot commented Jun 1, 2024

@JohnNiang: The label(s) area/ cannot be applied, because the repository doesn't have them.

In response to this:

What type of PR is this?

/kind bug
/area core
/area plugin
/milestone 2.16.0

What this PR does / why we need it:

Before the PR, any user can generate bundle files by providing random query param v while requesting bundle files.

This PR refactors the whole bundle file generation method.

  1. Do nothing if users provide arbitrary bundle file version
  2. Better lock for writing bundle files if not exist

Special notes for your reviewer:

  1. Request http://localhost:8090/apis/api.console.halo.run/v1alpha1/plugins/-/bundle.js?v=xyz
  2. Check if the file xyz.js in folder $TMPDIR/halo-plugin-bundle**

Does this PR introduce a user-facing change?

None

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link

codecov bot commented Jun 1, 2024

Codecov Report

Attention: Patch coverage is 86.31579% with 13 lines in your changes are missing coverage. Please review.

Project coverage is 56.47%. Comparing base (5fdf6c0) to head (50bc1a3).
Report is 223 commits behind head on main.

Files Patch % Lines
...core/extension/service/impl/PluginServiceImpl.java 87.50% 5 Missing and 4 partials ⚠️
...lo/app/core/extension/endpoint/PluginEndpoint.java 82.60% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6028      +/-   ##
============================================
- Coverage     56.91%   56.47%   -0.44%     
- Complexity     3319     3541     +222     
============================================
  Files           587      622      +35     
  Lines         18968    20961    +1993     
  Branches       1401     1478      +77     
============================================
+ Hits          10795    11838    +1043     
- Misses         7594     8523     +929     
- Partials        579      600      +21     

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

Copy link

sonarqubecloud bot commented Jun 1, 2024

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.2% Duplication on New Code

See analysis details on SonarCloud

Copy link
Member

@guqing guqing 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 Jun 3, 2024
Copy link

f2c-ci-robot bot commented Jun 3, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: guqing

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 Jun 3, 2024
@f2c-ci-robot f2c-ci-robot bot merged commit ba96118 into halo-dev:main Jun 3, 2024
8 checks passed
f2c-ci-robot bot pushed a commit that referenced this pull request Jun 13, 2024
…#6073)

#### What type of PR is this?

/kind regression
/area plugin
/milestone 2.17.x

#### What this PR does / why we need it:

This PR reverts changes of generating bundle resource version in <#6028>.

Because the changes were adapted realtime change of bundle files for plugin developers in plugin development runtime mode, but I ignored it.

#### Special notes for your reviewer:

1. Try to start Halo in plugin development mode
2. Change and rebuild ui resources
3. Refresh console and check the result

#### Does this PR introduce a user-facing change?

```release-note
None
```
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/core Issues or PRs related to the Halo Core area/plugin Issues or PRs related to the Plugin Provider kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants