-
Notifications
You must be signed in to change notification settings - Fork 74
Authentication check running inside the Pod for Source and BrokerCell Fanout and Retry #1982
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: grac3gao 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 |
320185d
to
325a695
Compare
933b210
to
31527c0
Compare
/test pull-google-knative-gcp-conformance-tests |
2 similar comments
/test pull-google-knative-gcp-conformance-tests |
/test pull-google-knative-gcp-conformance-tests |
pkg/broker/handler/pool.go
Outdated
@@ -80,6 +84,9 @@ func (c *probeChecker) ServeHTTP(w http.ResponseWriter, req *http.Request) { | |||
w.WriteHeader(http.StatusNotFound) | |||
return | |||
} | |||
// Perform Authentication check. | |||
authcheck.AuthenticationCheck(req.Context(), c.logger, c.authType, w) |
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.
Should this return under some condition? Such as if the auth check fails.
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.
It only write statue into the response, which I included in the authcheck.AuthenticationCheck previously. Based on your comment, I'll do:
if err := authcheck.AuthenticationCheck; err != nil {
pc.logger.Error("authentication check failed", zap.Error(err))
w.WriteHeader(http.StatusUnauthorized)
return
}
67ccacb
to
7e73565
Compare
name: "authentication check failed, using empty authType", | ||
authType: "empty", | ||
statusCode: http.StatusUnauthorized, | ||
wantError: true, |
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.
Was trying to use specific errors, however, in Prow and local, it returns different errors. In local, it can't write error into termination file (no such file), but in Prow, it can. Tried to create file, error showed no permission to do so. Thus, I just verify whether there is an error or not.
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.
Sorry for the late comments
ade72cb
to
7b416f8
Compare
5b119af
to
dcf36fd
Compare
dcf36fd
to
d1dd67d
Compare
89bca52
to
c514303
Compare
c514303
to
f9ff19c
Compare
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
/hold for others to take a look
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
/unhold I think only @yolocs and myself were commenting. |
The following is the coverage report on the affected files.
|
Fixes #
Proposed Changes
Note This PR only adds authentication check in Pod of Source and BrokerCell Fanout and Retry.
For Pods using kncloudevent library like Ingress, it is blocked by #1973
Release Note
Docs