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 issue that access key doesn't work if appid passed is in different case #3627

Merged
merged 3 commits into from
Apr 7, 2021

Conversation

nobodyiam
Copy link
Member

What's the purpose of this PR

fix the issue that access key doesn't work if appid passed is in different case

Which issue(s) this PR fixes:

Fixes #3626

Brief changelog

Use tree set with CASE_INSENSITIVE_ORDER comparator.

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Read the Contributing Guide before making this pull request.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit tests to verify the code.
  • Run mvn clean test to make sure this pull request doesn't break anything.

@nobodyiam nobodyiam requested a review from nisiyong April 3, 2021 11:43
@codecov-io
Copy link

Codecov Report

Merging #3627 (82a3b82) into master (3de1d72) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3627      +/-   ##
============================================
+ Coverage     50.97%   50.99%   +0.01%     
- Complexity     2329     2330       +1     
============================================
  Files           449      449              
  Lines         14026    14026              
  Branches       1426     1426              
============================================
+ Hits           7150     7152       +2     
+ Misses         6389     6388       -1     
+ Partials        487      486       -1     
Impacted Files Coverage Δ Complexity Δ
...nfigservice/service/AccessKeyServiceWithCache.java 84.69% <100.00%> (ø) 22.00 <0.00> (ø)
...ervice/service/ReleaseMessageServiceWithCache.java 85.88% <0.00%> (-1.18%) 24.00% <0.00%> (-1.00%)
.../framework/apollo/spring/property/SpringValue.java 89.47% <0.00%> (+1.75%) 21.00% <0.00%> (+1.00%)
...rk/apollo/spring/property/SpringValueRegistry.java 88.88% <0.00%> (+5.55%) 11.00% <0.00%> (+1.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3de1d72...82a3b82. Read the comment docs.

@nisiyong
Copy link
Member

nisiyong commented Apr 4, 2021

It looks good to me, but how we avoid this situation next time.
It seems that there had serval issues about sensitive appId previously, do we need some common utils to fix the same issues?

@nobodyiam
Copy link
Member Author

It seems that there had serval issues about sensitive appId previously, do we need some common utils to fix the same issues?

You are right, there have been several case sensitive issues. Previously we also have this issue for namespace names, and we fixed that via NamespaceUtil#normalizeNamespace.
Maybe we could also write an AppUtil to normalize the app id?

https://github.com/ctripcorp/apollo/blob/943bbb4d56bd9d3bbec291ea17136099a3a60b7c/apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/util/NamespaceUtil.java#L28-L40

@nisiyong
Copy link
Member

nisiyong commented Apr 5, 2021

@nobodyiam I think we can merge this PR first, and create a new issue to build AppUtil.

Copy link
Member

@nisiyong nisiyong left a comment

Choose a reason for hiding this comment

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

LGTM

@nobodyiam nobodyiam merged commit 32a2a97 into apolloconfig:master Apr 7, 2021
@nobodyiam nobodyiam deleted the fix-3626 branch April 7, 2021 00:02
@nobodyiam nobodyiam added this to the 1.9.0 milestone May 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

客户端配置的AppId大小写与服务端不一致时可越过accessKey检查而直接获取到配置
3 participants