server icon indicating copy to clipboard operation
server copied to clipboard

[PM-15990] fix(identity): preserve port in IdentityServer Origin URL

Open xinghejd opened this issue 1 year ago â€ĸ 3 comments

đŸŽŸī¸ Tracking

https://github.com/bitwarden/server/issues/4981

📔 Objective

Previously, when using a custom port in self-hosted deployments (e.g., https://bitwarden.myserver.com:8443), the port information was lost during redirects from /identity/connect/authorize to /identity/sso/Login, despite having correctly configured globalSettings__baseServiceUri__vault.

This fix replaces Uri.Host with Uri.Authority when setting IdentityServer's Origin URL, ensuring:

  • Port information is preserved in redirect URLs
  • Maintains compatibility with both standard (443) and custom port deployments

📸 Screenshots

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

đŸĻŽ Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or â„šī¸ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or âš ī¸ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or â™ģī¸ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

xinghejd avatar Dec 13 '24 07:12 xinghejd

Thank you for your contribution! We've added this to our internal Community PR board for review. ID: PM-15990 Link: https://bitwarden.atlassian.net/browse/PM-15990

Details on our contribution process can be found here: https://contributing.bitwarden.com/contributing/pull-requests/community-pr-process.

bitwarden-bot avatar Dec 13 '24 07:12 bitwarden-bot

Logo Checkmarx One – Scan Summary & Details – 031fefcc-1b4f-47a4-84d7-b25c9c68e5e5

Great job! No new security vulnerabilities introduced in this pull request

github-actions[bot] avatar Nov 28 '25 16:11 github-actions[bot]

Codecov Report

:x: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 53.28%. Comparing base (480c20a) to head (3a3ce8c).

Files with missing lines Patch % Lines
bitwarden_license/src/Sso/Startup.cs 0.00% 1 Missing :warning:
src/Identity/Startup.cs 0.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5150      +/-   ##
==========================================
+ Coverage   53.26%   53.28%   +0.01%     
==========================================
  Files        1906     1906              
  Lines       84973    84973              
  Branches     7639     7639              
==========================================
+ Hits        45265    45275      +10     
+ Misses      37954    37944      -10     
  Partials     1754     1754              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Nov 28 '25 17:11 codecov[bot]