Skip to content

Commit fe64129

Browse files
Merge pull request #2 from IBM/fix/requestdump
fix secret request issue in context log
2 parents 5e7f8fa + b0a2e89 commit fe64129

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

enforcer/pkg/control/common/reqcontext.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ func (rc *ReqContext) IsCreator() bool {
108108
return rc.UserName != "" && rc.UserName == rc.OrgMetadata.Annotations.CreatedBy()
109109
}
110110

111+
func (rc *ReqContext) IsSecret() bool {
112+
return rc.Kind == "Secret" && rc.GroupVersion() == "v1"
113+
}
114+
111115
type ParsedRequest struct {
112116
UID string
113117
JsonStr string

enforcer/pkg/control/enforcer/checkcontext.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ func (self *CheckContext) convertToLogBytes() []byte {
558558

559559
}
560560

561-
if self.config.Log.IncludeRequest {
561+
if self.config.Log.IncludeRequest && !reqc.IsSecret() {
562562
logRecord["request.dump"] = reqc.RequestJsonStr
563563
}
564564

0 commit comments

Comments
 (0)