Skip to content

Fixes #27093 : Add warning logging to silent catch blocks in SubjectContext#27094

Open
RajdeepKushwaha5 wants to merge 3 commits intoopen-metadata:mainfrom
RajdeepKushwaha5:fix/subject-context-silent-exception-logging
Open

Fixes #27093 : Add warning logging to silent catch blocks in SubjectContext#27094
RajdeepKushwaha5 wants to merge 3 commits intoopen-metadata:mainfrom
RajdeepKushwaha5:fix/subject-context-silent-exception-logging

Conversation

@RajdeepKushwaha5
Copy link
Copy Markdown
Contributor

@RajdeepKushwaha5 RajdeepKushwaha5 commented Apr 6, 2026

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.

# Method Line What it catches
1 isTeamAsset() ~171 Team entity lookup for asset ownership
2 isInTeam() ~201 Team hierarchy traversal for membership
3 getRolesForTeams() ~228 Role resolution from team hierarchy
4 hasRole() ~300 Role check via team parent chain
5 UserPolicyIterator ~473 Resource owner team policy loading

Why:
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:check passes
  • Verified no behavioral changes — same return values, same control flow
  • Existing auth tests unaffected (purely additive logging)

This continues the silent exception cleanup pattern from PR #27063 (FeedRepository) and PR #27092 (SAML/IndexResource resource leaks).

Type of change:

  • Bug fix

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes #ISSUE_NUMBER: Add warning logging to silent catch blocks in SubjectContext
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.

Summary by Gitar

  • Bug fixes:
    • Fixed 409 error when creating entities in DataObservabilityGovernanceTab.spec.ts
    • Corrected UI display issues for custom properties containing dots in their names
    • Resolved loading effect bugs in ontology scroll component

This will update automatically on new commits.

Copilot AI review requested due to automatic review settings April 6, 2026 13:29
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 6, 2026

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@RajdeepKushwaha5 RajdeepKushwaha5 force-pushed the fix/subject-context-silent-exception-logging branch from de6877b to 6039944 Compare April 6, 2026 13:37
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 6, 2026

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 7, 2026

🔴 Playwright Results — 1 failure(s), 19 flaky

✅ 3667 passed · ❌ 1 failed · 🟡 19 flaky · ⏭️ 89 skipped

Shard Passed Failed Flaky Skipped
🔴 Shard 1 478 1 2 4
🟡 Shard 2 650 0 3 7
🟡 Shard 3 652 0 7 1
🟡 Shard 4 633 0 1 27
🟡 Shard 5 610 0 1 42
🟡 Shard 6 644 0 5 8

Genuine Failures (failed on all attempts)

Pages/SearchIndexApplication.spec.ts › Search Index Application (shard 1)
Error: �[2mexpect(�[22m�[31mreceived�[39m�[2m).�[22mtoEqual�[2m(�[22m�[32mexpected�[39m�[2m) // deep equality�[22m

Expected: �[32mStringMatching /success|activeError/g�[39m
Received: �[31m"failed"�[39m
🟡 19 flaky test(s) (passed on retry)
  • Pages/Customproperties-part1.spec.ts › no duplicate card after update (shard 1, 1 retry)
  • Pages/UserCreationWithPersona.spec.ts › Create user with persona and verify on profile (shard 1, 1 retry)
  • Features/BulkEditEntity.spec.ts › Glossary (shard 2, 2 retries)
  • Features/BulkImport.spec.ts › Keyboard Delete selection (shard 2, 1 retry)
  • Features/Glossary/LargeGlossaryPerformance.spec.ts › should search and filter glossary terms (shard 2, 1 retry)
  • Features/LandingPageWidgets/DomainDataProductsWidgets.spec.ts › Domain asset count should update when assets are removed (shard 3, 1 retry)
  • Features/RestoreEntityInheritedFields.spec.ts › Validate restore with Inherited domain and data products assigned (shard 3, 1 retry)
  • Features/RestoreEntityInheritedFields.spec.ts › Validate restore with Inherited domain and data products assigned (shard 3, 1 retry)
  • Features/RestoreEntityInheritedFields.spec.ts › Validate restore with Inherited domain and data products assigned (shard 3, 1 retry)
  • Features/RTL.spec.ts › Verify Following widget functionality (shard 3, 1 retry)
  • Features/Table.spec.ts › Tags term should be consistent for search (shard 3, 1 retry)
  • Flow/NotificationAlerts.spec.ts › Conversation source alert (shard 3, 1 retry)
  • Pages/Customproperties-part2.spec.ts › entityReferenceList shows item count, scrollable list, no expand toggle (shard 4, 1 retry)
  • Pages/Glossary.spec.ts › Add and Remove Assets (shard 5, 1 retry)
  • Pages/HyperlinkCustomProperty.spec.ts › should show No Data placeholder when hyperlink has no value (shard 6, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage schema filter selection (shard 6, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: searchIndex (shard 6, 1 retry)
  • Pages/ODCSImportExport.spec.ts › Multi-object ODCS contract - object selector shows all schema objects (shard 6, 1 retry)
  • Pages/Users.spec.ts › Permissions for table details page for Data Consumer (shard 6, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

Copilot AI review requested due to automatic review settings April 7, 2026 05:00
@RajdeepKushwaha5 RajdeepKushwaha5 force-pushed the fix/subject-context-silent-exception-logging branch from 6039944 to 8ac8ccd Compare April 7, 2026 05:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

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.
Copilot AI review requested due to automatic review settings April 19, 2026 18:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Apr 20, 2026

Code Review ✅ Approved

Adds warning logging to silent catch blocks in SubjectContext to improve observability for exception handling. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Silent exception swallowing in SubjectContext authorization code (5 catch blocks)

3 participants