Fixes #27093 : Add warning logging to silent catch blocks in SubjectContext#27094
Conversation
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
There was a problem hiding this comment.
Pull request overview
Adds warning-level logging to previously silent exception catch blocks in SubjectContext to improve diagnosability of authorization/policy-evaluation failures without changing fail-closed behavior.
Changes:
- Added
LOG.warn(...)to several catch blocks in team/role/policy traversal logic. - Included contextual details (team/role identifiers) plus exception message + stack trace in logs.
...-service/src/main/java/org/openmetadata/service/security/policyevaluator/SubjectContext.java
Show resolved
Hide resolved
...-service/src/main/java/org/openmetadata/service/security/policyevaluator/SubjectContext.java
Show resolved
Hide resolved
de6877b to
6039944
Compare
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
🔴 Playwright Results — 1 failure(s), 24 flaky✅ 3593 passed · ❌ 1 failed · 🟡 24 flaky · ⏭️ 207 skipped
Genuine Failures (failed on all attempts)❌
|
Replace empty catch blocks in security-critical authorization code with LOG.warn calls that include exception context and stack traces: - isTeamAsset(): log team asset ownership lookup failures - isInTeam(): log team hierarchy traversal failures - getRolesForTeams(): log role resolution failures - hasRole(): log role check failures via team chain - UserPolicyIterator: log resource owner policy load failures No behavioral changes - fail-closed pattern preserved. Logging enables diagnosis of intermittent auth failures caused by transient DB errors or data inconsistencies.
6039944 to
8ac8ccd
Compare
Code Review ✅ ApprovedAdds warning logging to 5 silent catch blocks in SubjectContext to improve error visibility and debuggability. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
|



Describe your changes:
Fixes #27093
Add warning-level logging to 5 silent catch blocks in
SubjectContext.java— security-critical authorization code that silently swallowed all exceptions with no logging, making intermittent auth failures impossible to diagnose.What changed:
All 5 catch blocks now log
LOG.warn(...)with the exception message, full stack trace, and context (team name/ID, method purpose). No behavioral changes — the fail-closed pattern (returning false / skipping) is correct for security code and is preserved.isTeamAsset()isInTeam()getRolesForTeams()hasRole()UserPolicyIteratorWhy:
A transient DB failure during policy evaluation would silently deny user access with zero log entries. The class already uses
LOG.warn()for circular dependency detection — these catches should be consistent.How I tested:
mvn spotless:checkpassesThis continues the silent exception cleanup pattern from PR #27063 (
FeedRepository) and PR #27092 (SAML/IndexResource resource leaks).Type of change:
Checklist:
Fixes #ISSUE_NUMBER: Add warning logging to silent catch blocks in SubjectContext