mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #48492 from CaoShuFeng/CanonicalHeaderKey
Automatic merge from submit-queue Fix Audit-ID header key Now http header key "Audit-ID" doesn't have effect, because golang automaticly transforms "Audit-ID" into "Audit-Id". This change use http.Header.Get() function to canonicalize "Audit-ID" to "Audit-Id". **Release note**: ``` NONE ```
This commit is contained in:
commit
40825b26d1
@ -50,9 +50,9 @@ func NewEventFromRequest(req *http.Request, level auditinternal.Level, attribs a
|
|||||||
|
|
||||||
// prefer the id from the headers. If not available, create a new one.
|
// prefer the id from the headers. If not available, create a new one.
|
||||||
// TODO(audit): do we want to forbid the header for non-front-proxy users?
|
// TODO(audit): do we want to forbid the header for non-front-proxy users?
|
||||||
ids := req.Header[auditinternal.HeaderAuditID]
|
ids := req.Header.Get(auditinternal.HeaderAuditID)
|
||||||
if len(ids) > 0 {
|
if ids != "" {
|
||||||
ev.AuditID = types.UID(ids[0])
|
ev.AuditID = types.UID(ids)
|
||||||
} else {
|
} else {
|
||||||
ev.AuditID = types.UID(uuid.NewRandom().String())
|
ev.AuditID = types.UID(uuid.NewRandom().String())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user