Skip to content

Fixes 27091: Close SAML validation resources - #34082

Merged
sonika-shah merged 2 commits into
mainfrom
27091-bug-resource-leaks-in-samlsettingsholder-samlvalidator-and-indexresource-unclosed-streams-and-connections
Sep 29, 2026
Merged

sonika-shah merged 2 commits into
mainfrom
27091-bug-resource-leaks-in-samlsettingsholder-samlvalidator-and-indexresource-unclosed-streams-and-connections

Conversation

@harshach

Copy link
Copy Markdown
Collaborator

Describe your changes:

Fixes #27091

This PR closes resources owned by the SAML configuration and validation paths:

  • Loads the SAML JKS keystore through a try-with-resources helper so the file stream is always closed.
  • Closes the IdP response stream after reading the diagnostic snippet.
  • Disconnects the IdP HttpURLConnection in a finally block on every response and exception path.
  • Adds regression tests that assert the keystore stream, response stream, and HTTP connection are released.

The IndexResource leak described in the issue was already resolved by #27269, so this PR intentionally does not modify it.

Type of change:

  • Bug fix

High-level design:

N/A — small resource-management bug fix.

Tests:

Use cases covered

  • Loading a JKS-backed SAML configuration closes the keystore input stream.
  • Reading an IdP error response closes the response stream.
  • Validating IdP connectivity disconnects the HTTP connection after processing the response.

Unit tests

  • I added unit tests for the new/changed logic.
  • Files added/updated:
    • SamlSettingsHolderTest.java
    • SamlValidatorTest.java
  • Coverage %: Not measured; focused tests exercise each changed resource-ownership path.

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

  1. Ran mvn -pl openmetadata-service spotless:check.
  2. Ran mvn -nsu -pl openmetadata-service -DskipTests=false -Dtest=SamlValidatorTest,SamlSettingsHolderTest test.
  3. Verified 65 tests pass with zero failures, errors, or skips.

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>.
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code where the existing validation flow benefits from context.
  • For JSON Schema changes: Not applicable; this PR does not change schemas.
  • For UI changes: Not applicable; this PR does not change the UI.
  • I have added tests and listed them above.
  • I have added tests that cover the exact resource leaks being fixed.

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

✅ SSO Login Nightly — PASSED

View workflow run · Commit 18e96aa

Provider Status Pass Fail Flaky Skip Duration
basic ✅ pass 6 0 0 0 0m 40s
ldap ✅ pass 6 0 0 0 0m 40s
keycloak-oidc-confidential ✅ pass 9 0 0 0 1m 13s
keycloak-oidc-public ✅ pass 8 0 0 0 0m 37s
msal-mock ✅ pass 5 0 0 0 0m 18s
auth0-mock ✅ pass 5 0 0 0 0m 22s
okta ⏩ skipped - - - - -
keycloak-azure-saml ✅ pass 1 0 0 0 0m 24s
keycloak-azure-saml-crosssite ⏩ skipped - - - - -

Totals: 40 passed · 0 failed · 0 flaky · 0 skipped · duration 4m 17s

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 5fefb7e15db75abd4f618c7f41bb877e18d6f717 in Playwright run 36341794422, attempt 1.

✅ 4618 passed · ❌ 0 failed · 🟡 2 flaky · ⏭️ 1 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 48m 40s

⏱️ Max setup 4m 26s · max shard execution 19m 7s · max shard-job elapsed before upload 22m 48s · reporting 17s

🌐 219.69 requests/attempt · 2.21 app boots/UI scenario · 40.02% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 40.02% (convergence target: at most 15%).
  • Browser traffic was 219.69 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.21 per UI scenario (10829 boots / 4896 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard advanced-search-01 66 0 0 0 0 0
✅ Shard advanced-search-02 64 0 0 0 0 0
🟡 Shard chromium-01 132 0 1 0 0 0
✅ Shard chromium-02 147 0 0 0 0 0
✅ Shard chromium-03 146 0 0 0 0 0
✅ Shard chromium-04 129 0 0 0 0 0
✅ Shard chromium-05 141 0 0 0 0 0
✅ Shard chromium-06 221 0 0 0 0 0
✅ Shard chromium-07 118 0 0 0 0 0
✅ Shard chromium-08 158 0 0 0 0 0
✅ Shard chromium-09 144 0 0 0 0 0
✅ Shard chromium-10 170 0 0 0 0 0
✅ Shard chromium-11 173 0 0 0 0 0
✅ Shard chromium-12 155 0 0 0 0 0
✅ Shard chromium-13 131 0 0 0 0 0
✅ Shard chromium-14 176 0 0 0 0 0
✅ Shard chromium-15 148 0 0 0 0 0
✅ Shard chromium-16 142 0 0 0 0 0
✅ Shard chromium-17 134 0 0 0 0 0
✅ Shard chromium-18 137 0 0 0 0 0
✅ Shard chromium-19 143 0 0 0 0 0
✅ Shard chromium-20 134 0 0 0 0 0
✅ Shard chromium-21 162 0 0 1 0 0
✅ Shard chromium-22 158 0 0 0 0 0
✅ Shard chromium-23 180 0 0 0 0 0
🟡 Shard chromium-24 142 0 1 0 0 0
✅ Shard chromium-25 135 0 0 0 0 0
✅ Shard chromium-26 161 0 0 0 0 0
✅ Shard chromium-27 131 0 0 0 0 0
✅ Shard data-asset-rules-01 65 0 0 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard import-export-01 65 0 0 0 0 0
✅ Shard import-export-02 85 0 0 0 0 0
✅ Shard ingestion-01 46 0 0 0 0 0
✅ Shard ingestion-02 47 0 0 0 0 0
✅ Shard reindex-01 41 0 0 0 0 0
✅ Shard search-01 12 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0
🟡 2 flaky test(s) (passed on retry)
  • Pages/Domains.spec.ts › Verify domain custom property value persistence (shard chromium-01, 1 retry)
  • Pages/Glossary.spec.ts › Glossary & terms creation for reviewer as team (shard chromium-24, 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

…er-samlvalidator-and-indexresource-unclosed-streams-and-connections
@gitar-bot

gitar-bot Bot commented Sep 27, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · SAML validation now closes keystore and IdP response resources and connections.

Closes SAML validation resource leaks by ensuring the JKS keystore stream, IdP response stream, and HTTP connection are properly released across all response and exception paths. Regression tests verify each resource is cleaned up correctly.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

🤖 Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

This branch was previously deployed

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

Labels

backend 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] Resource leaks in SamlSettingsHolder, SamlValidator, and IndexResource — unclosed streams and connections

2 participants