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

[Feature/Extension] Add integration test case for OBO hostmapping #3270

Merged
merged 3 commits into from
Sep 7, 2023

Conversation

RyanL1997
Copy link
Collaborator

@RyanL1997 RyanL1997 commented Aug 30, 2023

Description

Add integration test case for OBO hostmapping

  • Category (Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation)
    Test Enhancement

Issues Resolved

Check List

  • New functionality includes testing
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Ryan Liang <jiallian@amazon.com>
@codecov
Copy link

codecov bot commented Aug 30, 2023

Codecov Report

Merging #3270 (cb516d7) into main (0338cdd) will increase coverage by 0.98%.
Report is 15 commits behind head on main.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #3270      +/-   ##
============================================
+ Coverage     63.15%   64.14%   +0.98%     
- Complexity     3448     3470      +22     
============================================
  Files           263      263              
  Lines         20024    20112      +88     
  Branches       3341     3359      +18     
============================================
+ Hits          12647    12901     +254     
+ Misses         5748     5532     -216     
- Partials       1629     1679      +50     

see 24 files with indirect coverage changes

String[] splitToken = oboToken.split("\\.");

String unsignedToken = splitToken[0] + "." + splitToken[1] + ".";
Claims claims = Jwts.parserBuilder().build().parseClaimsJwt(unsignedToken).getBody();
Copy link
Member

Choose a reason for hiding this comment

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

Is splitting the token necessary for calling parseClaimsJwt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, otherwise it won't recognize the verify signature part of the token, and throw an error:

Signed JWSs are not supported.
io.jsonwebtoken.UnsupportedJwtException: Signed JWSs are not supported.
...

Copy link
Member

Choose a reason for hiding this comment

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

A couple lines down you are creating an instance of EncryptionDecryptionUtil with the expected encryption key. Can you do something similar with the JWTParser to avoid having to split the token?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's a good point. I just updated.

Signed-off-by: Ryan Liang <jiallian@amazon.com>
Copy link
Member

@cwperks cwperks left a comment

Choose a reason for hiding this comment

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

Thank you @RyanL1997. This PR looks good to me. I left 2 comments to be addressed and will approve this PR once addressed or responded to.

String[] splitToken = oboToken.split("\\.");

String unsignedToken = splitToken[0] + "." + splitToken[1] + ".";
Claims claims = Jwts.parserBuilder().build().parseClaimsJwt(unsignedToken).getBody();
Copy link
Member

Choose a reason for hiding this comment

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

A couple lines down you are creating an instance of EncryptionDecryptionUtil with the expected encryption key. Can you do something similar with the JWTParser to avoid having to split the token?

Signed-off-by: Ryan Liang <jiallian@amazon.com>
@RyanL1997 RyanL1997 merged commit 7e1b786 into opensearch-project:main Sep 7, 2023
57 checks passed
stephen-crawford pushed a commit to stephen-crawford/security that referenced this pull request Sep 14, 2023
…ensearch-project#3270)

Add integration test case for OBO hostmapping

* Category (Enhancement, New feature, Bug fix, Test fix, Refactoring,
Maintenance, Documentation)
Test Enhancement

* Resolve opensearch-project#3222

- [x] New functionality includes testing
- [ ] New functionality has been documented
- [x] Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and
signing off your commits, please check
[here](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).

---------

Signed-off-by: Ryan Liang <jiallian@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants