Skip to content

[PM-38027] feat: Match local URI domain by port in iOS#2708

Open
xrvk wants to merge 4 commits into
bitwarden:mainfrom
xrvk:xrvk/fix-local-ip-domain-port-match-ios
Open

[PM-38027] feat: Match local URI domain by port in iOS#2708
xrvk wants to merge 4 commits into
bitwarden:mainfrom
xrvk:xrvk/fix-local-ip-domain-port-match-ios

Conversation

@xrvk

@xrvk xrvk commented May 25, 2026

Copy link
Copy Markdown

🎟️ Tracking

📔 Objective

When multiple local services share the same IP or localhost host but run on different ports, domain matching can select the wrong login. This change adds iOS parity with the clients fix by requiring matching ports for domain matching only when both URIs are localhost or IP addresses.

Changes:

  • Updated DefaultCipherMatchingHelper domain matching to reject localhost/IP matches when ports differ.
  • Kept regular domain matching behavior unchanged so non-local domains remain port-agnostic for .domain.
  • Added focused CipherMatchingHelperTests coverage for local IP and localhost port cases, plus a regression test that regular domains still match across different ports.

📸 Screenshots

N/A - no UI changes.

@CLAassistant

CLAassistant commented May 25, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@bitwarden-bot

Copy link
Copy Markdown
Collaborator

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

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

@bitwarden-bot bitwarden-bot changed the title [PM-38027] Match local URI domain by port in iOS [PM-38097] [PM-38027] Match local URI domain by port in iOS May 25, 2026
@xrvk xrvk changed the title [PM-38097] [PM-38027] Match local URI domain by port in iOS [PM-38027] Match local URI domain by port in iOS May 25, 2026
@xrvk xrvk marked this pull request as ready for review May 25, 2026 15:44
@xrvk xrvk requested review from a team and matt-livefront as code owners May 25, 2026 15:44
xrvk and others added 2 commits May 26, 2026 14:01
Apply domain-match port disambiguation for localhost/IP URIs in iOS autofill matching, mirroring clients behavior while keeping regular domains port-agnostic.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Detect IPv6 literals locally in CipherMatchingHelper since the shared isIPAddress regex only handles IPv4, and add tests for IPv6 port mismatch and multi-URI fallback after a localhost/IP port mismatch rejection.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@xrvk xrvk force-pushed the xrvk/fix-local-ip-domain-port-match-ios branch from 0920057 to 61470bf Compare May 26, 2026 21:01
@morganzellers-bw morganzellers-bw self-assigned this May 27, 2026
@morganzellers-bw morganzellers-bw added the app:password-manager Bitwarden Password Manager app context label Jun 5, 2026
@morganzellers-bw

Copy link
Copy Markdown
Contributor

Hi @xrvk!

These changes look good and I approved the workflows to run. I'll keep an eye on this one and let you know if I need any updates; thanks for the contribution! 👍

@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.90%. Comparing base (1372c15) to head (f8392f3).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2708   +/-   ##
=======================================
  Coverage   87.90%   87.90%           
=======================================
  Files        1719     1719           
  Lines      167804   167887   +83     
=======================================
+ Hits       147507   147584   +77     
- Misses      20297    20303    +6     

☔ 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.

@morganzellers-bw morganzellers-bw removed app:password-manager Bitwarden Password Manager app context needs-qa labels Jun 5, 2026
@morganzellers-bw morganzellers-bw changed the title [PM-38027] Match local URI domain by port in iOS [PM-38027] feat: Match local URI domain by port in iOS Jun 10, 2026
@morganzellers-bw morganzellers-bw added app:password-manager Bitwarden Password Manager app context t:feature labels Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app:password-manager Bitwarden Password Manager app context community-pr t:feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants