1
0
forked from baron/baron-sso

chore(auth): restrict OIDC generated claims debug logs to dev environment

- Prevent overly verbose logging of ID token payloads in production by checking APP_ENV
This commit is contained in:
2026-04-24 12:00:00 +09:00
parent 8e28a9d74b
commit f810427b21
2 changed files with 11 additions and 5 deletions

View File

@@ -5149,8 +5149,11 @@ func (h *AuthHandler) GetConsentRequest(c *fiber.Ctx) error {
)
// [Debug] 실제 생성된 클레임 출력 (요청사항 확인용 - 자동 승인 시)
if debugClaimsJSON, err := json.MarshalIndent(sessionClaims, "", " "); err == nil {
slog.Info("=== [ACTUAL DATA] GENERATED OIDC CLAIMS (SKIP) ===", "claims", string(debugClaimsJSON))
appEnv := strings.ToLower(os.Getenv("APP_ENV"))
if appEnv == "dev" || appEnv == "development" || appEnv == "" {
if debugClaimsJSON, err := json.MarshalIndent(sessionClaims, "", " "); err == nil {
slog.Info("=== [ACTUAL DATA] GENERATED OIDC CLAIMS (SKIP) ===", "claims", string(debugClaimsJSON))
}
}
acceptResp, err := h.Hydra.AcceptConsentRequest(c.Context(), challenge, consentRequest, sessionClaims)
@@ -5316,8 +5319,11 @@ func (h *AuthHandler) AcceptConsentRequest(c *fiber.Ctx) error {
)
// [Debug] 실제 생성된 클레임 출력 (요청사항 확인용)
if debugClaimsJSON, err := json.MarshalIndent(sessionClaims, "", " "); err == nil {
slog.Info("=== [ACTUAL DATA] GENERATED OIDC CLAIMS ===", "claims", string(debugClaimsJSON))
appEnv := strings.ToLower(os.Getenv("APP_ENV"))
if appEnv == "dev" || appEnv == "development" || appEnv == "" {
if debugClaimsJSON, err := json.MarshalIndent(sessionClaims, "", " "); err == nil {
slog.Info("=== [ACTUAL DATA] GENERATED OIDC CLAIMS ===", "claims", string(debugClaimsJSON))
}
}
acceptResp, err := h.Hydra.AcceptConsentRequest(c.Context(), req.ConsentChallenge, consentRequest, sessionClaims)

View File

@@ -323,7 +323,7 @@ func (h *UserHandler) GetUser(c *fiber.Ctx) error {
}
return c.JSON(h.mapIdentitySummary(c.Context(), *identity))
}
}
func (h *UserHandler) CreateUser(c *fiber.Ctx) error {
if h.OryProvider == nil || h.KratosAdmin == nil {