-
Notifications
You must be signed in to change notification settings - Fork 153
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
Implement gRPC service for envoy ExtAuthz #4990
Conversation
Signed-off-by: Shinnosuke Sawada <[email protected]>
Signed-off-by: Shinnosuke Sawada <[email protected]>
Signed-off-by: Shinnosuke Sawada <[email protected]>
…possible Signed-off-by: Shinnosuke Sawada <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4990 +/- ##
==========================================
+ Coverage 22.04% 22.45% +0.40%
==========================================
Files 519 520 +1
Lines 57247 56852 -395
==========================================
+ Hits 12621 12766 +145
+ Misses 43604 43060 -544
- Partials 1022 1026 +4 ☔ View full report in Codecov by Sentry. |
@@ -0,0 +1,68 @@ | |||
package grpcapi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the pipecd license header (refer other files)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I added this commit: 6ed9c7a.
Signed-off-by: Shinnosuke Sawada <[email protected]>
Overall LGTM, just left a nits about licensing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you go 👍
func (e *EnvoyAuthorizationServer) parsePipedToken(a string) (string, string, string, error) { | ||
if !strings.HasPrefix(a, "Bearer ") { | ||
return "", "", "", errors.New("invalid authorization header") | ||
} | ||
|
||
parts := strings.Split(strings.TrimPrefix(a, "Bearer "), ",") | ||
if len(parts) != 3 || parts[0] == "" || parts[1] == "" || parts[2] == "" { | ||
return "", "", "", errors.New("malformed piped token") | ||
} | ||
return parts[0], parts[1], parts[2], nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[IMO] It might be nice to use parsePipedToken in rpc/rpcauth
WDYT?
https://github.com/pipe-cd/pipecd/blob/ce05395afbd2397e60a7a9b99cb6c4d3fad07294/pkg/rpc/rpcauth/auth.go#L55C1-L77C2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
That sounds nice! I'll change the codes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed the codes.
@Warashi DCO not pass 👀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Signed-off-by: Shinnosuke Sawada <[email protected]>
Signed-off-by: Shinnosuke Sawada <[email protected]>
6049c0f
to
0093830
Compare
@khanhtc1202 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Implement gRPC service for envoy ExtAuthz Signed-off-by: Shinnosuke Sawada <[email protected]> * Run gRPC server for envoy ExtAuthz Signed-off-by: Shinnosuke Sawada <[email protected]> * Add words to make document clear Signed-off-by: Shinnosuke Sawada <[email protected]> * Change dependency versions as which match current we uses as much as possible Signed-off-by: Shinnosuke Sawada <[email protected]> * Add License header Signed-off-by: Shinnosuke Sawada <[email protected]> * Expose parsePipedToken to use at envoy grpc auth service Signed-off-by: Shinnosuke Sawada <[email protected]> * Use rpcauth.ParsePipedToken instead of implementing in package Signed-off-by: Shinnosuke Sawada <[email protected]> --------- Signed-off-by: Shinnosuke Sawada <[email protected]> Signed-off-by: khanhtc1202 <[email protected]>
What this PR does / why we need it:
This PR implements envoy external authorization service with gRPC, as RFC.
After merging this PR, I'll send another PR to add routing to the envoy configuration.
Which issue(s) this PR fixes:
Part of #4977
Does this PR introduce a user-facing change?: No