fix: include trace id in sensitive access audit
Deploy olons-admin production / deploy (push) Successful in 8m9s
Deploy olons-admin production / deploy (push) Successful in 8m9s
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
|||||||
"github.com/gogf/gf/v2/encoding/gjson"
|
"github.com/gogf/gf/v2/encoding/gjson"
|
||||||
"github.com/gogf/gf/v2/errors/gerror"
|
"github.com/gogf/gf/v2/errors/gerror"
|
||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
|
"github.com/gogf/gf/v2/os/gctx"
|
||||||
"github.com/gogf/gf/v2/os/gtime"
|
"github.com/gogf/gf/v2/os/gtime"
|
||||||
"github.com/gogf/gf/v2/util/grand"
|
"github.com/gogf/gf/v2/util/grand"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
@@ -629,7 +630,7 @@ func (s *sSysAppMember) Sensitive(ctx context.Context, in *sysin.AppMemberSensit
|
|||||||
result = 2
|
result = 2
|
||||||
}
|
}
|
||||||
lc := dao.SensitiveAccessLog.Columns()
|
lc := dao.SensitiveAccessLog.Columns()
|
||||||
_, logErr := dao.SensitiveAccessLog.Ctx(ctx).Fields(lc.AccessNo, lc.ActorId, lc.TargetType, lc.TargetId, lc.FieldSet, lc.PurposeCode, lc.PurposeText, lc.AuthorizationNo, lc.MfaVerified, lc.Result).Hook(hook.SaveTenant).Data(g.Map{lc.AccessNo: res.AccessNo, lc.ActorId: contexts.GetUserId(ctx), lc.TargetType: in.TargetType, lc.TargetId: in.TargetId, lc.FieldSet: gjson.New(res.Fields), lc.PurposeCode: in.PurposeCode, lc.PurposeText: in.PurposeText, lc.AuthorizationNo: res.AccessNo, lc.MfaVerified: 0, lc.Result: result}).Insert()
|
_, logErr := dao.SensitiveAccessLog.Ctx(ctx).Fields(lc.AccessNo, lc.ActorId, lc.TargetType, lc.TargetId, lc.FieldSet, lc.PurposeCode, lc.PurposeText, lc.AuthorizationNo, lc.MfaVerified, lc.Result, lc.TraceId).Hook(hook.SaveTenant).Data(g.Map{lc.AccessNo: res.AccessNo, lc.ActorId: contexts.GetUserId(ctx), lc.TargetType: in.TargetType, lc.TargetId: in.TargetId, lc.FieldSet: gjson.New(res.Fields), lc.PurposeCode: in.PurposeCode, lc.PurposeText: in.PurposeText, lc.AuthorizationNo: res.AccessNo, lc.MfaVerified: 0, lc.Result: result, lc.TraceId: gctx.CtxId(ctx)}).Insert()
|
||||||
if logErr != nil {
|
if logErr != nil {
|
||||||
return nil, gerror.Wrap(logErr, "记录敏感信息访问失败")
|
return nil, gerror.Wrap(logErr, "记录敏感信息访问失败")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user