Skip to content

ui: login session checked before proceding. - #14586

Open
DaanHoogland wants to merge 3 commits into
mainfrom
ghi14528-login-undefined-sessionkey
Open

DaanHoogland wants to merge 3 commits into
mainfrom
ghi14528-login-undefined-sessionkey

Conversation

@DaanHoogland

@DaanHoogland DaanHoogland commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR checks the session key before assuming the login was successful.
It also checks whether config.json load failed or some other error occurred after loading.

... and ...

When an authenticator throws an unexpected exception during login, ApiServlet
swallowed it and answered 200 with an empty body, which the UI took for a login
without a session key. Such an exception is now answered with a 500 error
instead of an empty response, and the session is invalidated when it happens
during login, so no authenticated session is left behind.

The NPE that triggered this for first LDAP logins (#14528) has meanwhile been
fixed in DefaultLoginAPIAuthenticatorCmd by #14098; this PR was rebased on
top of that and no longer touches that class.

Fixes: #14528

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@codecov

codecov Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 20.77%. Comparing base (2f34b0c) to head (81447ff).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
server/src/main/java/com/cloud/api/ApiServlet.java 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #14586      +/-   ##
============================================
- Coverage     20.77%   20.77%   -0.01%     
+ Complexity    20847    20846       -1     
============================================
  Files          6053     6053              
  Lines        548222   548239      +17     
  Branches      73236    73238       +2     
============================================
  Hits         113896   113896              
- Misses       420984   420998      +14     
- Partials      13342    13345       +3     
Flag Coverage Δ
uitests 3.86% <ø> (-0.01%) ⬇️
unittests 22.20% <85.71%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19909

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

Metric Value
Line coverage 25.69%
Branch coverage 20.84%

Grade Scale

Grade Line Coverage Meaning
🟢 A ≥ 80% Excellent - this code sleeps well at night 😴
🟡 B 60-79% Good - almost there, don't stop now 😉
🟠 C 40-59% Acceptable - your code is wearing a seatbelt, but no airbags 😬
🔴 D 20-39% Marginal - boldly shipping where no test has gone before 🖖
⛔ F < 20% Failing - tests? what tests? 🔥

Branch coverage is shown as a secondary signal. Grade is determined by line coverage.
View full Actions run

@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@blueorangutan test keepEnv

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-17492)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 57821 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr14586-t17492-kvm-ol8.zip
Smoke tests completed. 157 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

@DaanHoogland
DaanHoogland marked this pull request as ready for review November 8, 2026 10:41
Copilot AI balanced review requested due to automatic review settings November 8, 2026 10:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@DaanHoogland
DaanHoogland force-pushed the ghi14528-login-undefined-sessionkey branch from 4e1f024 to 222494d Compare November 12, 2026 16:10
Copilot AI balanced review requested due to automatic review settings November 12, 2026 16:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@DaanHoogland
DaanHoogland force-pushed the ghi14528-login-undefined-sessionkey branch from 222494d to 81447ff Compare November 13, 2026 15:03
Copilot AI balanced review requested due to automatic review settings November 13, 2026 15:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@sonarqubecloud

Copy link
Copy Markdown

@RosiKyu

RosiKyu commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@RosiKyu a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 20082

@RosiKyu

RosiKyu commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@RosiKyu a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-17587)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 57273 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr14586-t17587-kvm-ol8.zip
Smoke tests completed. 156 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_08_arping_in_ssvm Failure 5.28 test_diagnostics.py

@RosiKyu RosiKyu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

I tested this on a KVM lab with the PR packages, compared with a main nightly.

  • I set the browser storage entry from #14528 (primate__Access-Token) to undefined and reloaded the UI. On main the UI shows "We're experiencing a problem" and the technical details blame config.json. With the PR the entry is removed and the login page is shown.
  • A login with the correct admin password opens the UI normally.
  • A login with a wrong password shows "Error 531: Failed to authenticate user admin in domain 1; please provide valid credentials".

The server change for an unexpected exception during login can't be triggered from the UI, so I left that to the unit tests.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

First user-login when ldap enabled throws an exeption

4 participants