Skip to content

[SHOT-97] fix: target container names instead of bare service hostnames#7894

Draft
mimartin12 wants to merge 4 commits into
mainfrom
fix/SHOT-97-nginx-proxy-hostname-collision
Draft

[SHOT-97] fix: target container names instead of bare service hostnames#7894
mimartin12 wants to merge 4 commits into
mainfrom
fix/SHOT-97-nginx-proxy-hostname-collision

Conversation

@mimartin12

@mimartin12 mimartin12 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/SHOT-97

📔 Objective

Fixes: #5692

nginx proxy_pass and the internal identity service URI used bare Docker service names, which can resolve to the wrong container when another container sharing the network answers to that name, returning 502s and misrouting auth traffic. Point them at the unique bitwarden-* container names.

  • NginxConfig.hbs: all proxy_pass upstreams use bitwarden-* names
  • EnvironmentFileBuilder.cs: pin internalIdentity and the Key Connector identityServerUri to http://bitwarden-identity:5000

📸 Screenshots

nginx proxy_pass and the internal identity service URI used bare Docker service names, which can resolve to the wrong container when another container sharing the network answers to that name, returning 502s and misrouting auth traffic. Point them at the unique bitwarden-* container names.

- NginxConfig.hbs: all proxy_pass upstreams use bitwarden-* names
- EnvironmentFileBuilder.cs: pin internalIdentity and the Key Connector identityServerUri to http://bitwarden-identity:5000
@mimartin12 mimartin12 added the ai-review Request a Claude code review label Jun 30, 2026
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

This reviews an infrastructure fix that retargets nginx proxy_pass upstreams (NginxConfig.hbs) and internal service URIs (EnvironmentFileBuilder.cs) from bare Docker service aliases to the unique bitwarden-* container names, resolving the hostname collision in issue #5692. I verified each retargeted name against the container_name values in DockerCompose.hbs and confirmed all six new globalSettings__baseServiceUri__internal* overrides map to backing fields that resolve correctly in GlobalSettings.BaseServiceUriSettings. The earlier review concern about other internal URIs left on bare service names is now addressed by adding the full set of internal overrides, and the inert internalScim override was removed.

No new findings.

{
["globalSettings__baseServiceUri__vault"] = _context.Config.Url,
["globalSettings__baseServiceUri__cloudRegion"] = _context.Install?.CloudRegion.ToString(),
["globalSettings__baseServiceUri__internalIdentity"] = "http://bitwarden-identity:5000",

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.

QUESTION: Are the other internal service URIs intentionally left on bare service names?

Details

This pins internalIdentity to http://bitwarden-identity:5000, but the other internal URIs still fall through to BuildInternalUri's default, which produces bare service names (http://identity:5000 style). For example, InternalNotifications resolves to http://notifications:5000 and is actively consumed by NotificationsApiPushEngine (src/Core/Platform/Push/Engines/NotificationsApiPushEngine.cs:28), so it shares the exact same cross-container hostname-collision failure mode this PR is fixing for identity.

If SHOT-97 is scoped only to auth traffic that's fine — just confirming whether InternalNotifications/InternalApi/InternalVault/InternalSso (and the mssql DataSource = "tcp:mssql,1433" at line 71) were deliberately left out of this change.

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.23%. Comparing base (5ba34d1) to head (f05fadd).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7894      +/-   ##
==========================================
+ Coverage   61.21%   61.23%   +0.02%     
==========================================
  Files        2219     2220       +1     
  Lines       98059    98110      +51     
  Branches     8848     8854       +6     
==========================================
+ Hits        60024    60076      +52     
+ Misses      35918    35917       -1     
  Partials     2117     2117              

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

Comment thread util/Setup/EnvironmentFileBuilder.cs Outdated
@sonarqubecloud

Copy link
Copy Markdown

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

Labels

ai-review Request a Claude code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NGINX proxy config hostname collision

1 participant