Skip to content

fix(clouds): separate user domain from project domain in clouds.yaml parser - #3725

Open
abnvanand wants to merge 1 commit into
gophercloud:mainfrom
abnvanand:dev-abnvanand
Open

fix(clouds): separate user domain from project domain in clouds.yaml parser#3725
abnvanand wants to merge 1 commit into
gophercloud:mainfrom
abnvanand:dev-abnvanand

Conversation

@abnvanand

Copy link
Copy Markdown
Contributor

Fixes #3724

Links to the line numbers/files in the OpenStack source code that support the
code in this PR:

Made two changes to openstack/config/clouds/clouds.go:

  1. Removed ProjectDomainID and ProjectDomainName from the DomainID/DomainName coalesces.
    These fields now carry only the user's domain (user_domain_id / user_domain_name)

  2. Pre-building an explicit AuthScope when project_domain_id or project_domain_name is set
    alongside a project name. This passes the project domain directly to the scope, bypassing
    ToTokenV3ScopeMap's fallback that would otherwise inherit the user domain.

Test cases

  • project_domain_id + user_domain_name: verifies DomainID is empty (no bleed) and scope
    carries the correct project domain ID.
  • project_domain_name differing from user_domain_name: verifies scope carries the project
    domain name, not the user domain.
  • project_domain_name without user_domain_name: verifies DomainName is empty — project
    domain must not silently substitute for the user domain.

…ouds.yaml

When user_domain_name/user_domain_id and project_domain_name/project_domain_id
point to different domains, the parser was coalescing project domain fields into
AuthOptions.DomainID/DomainName — the fields used for user authentication.
This caused two failure modes:

- Hard error when user_domain_name and project_domain_id are both set: both
  DomainName and DomainID become non-empty, triggering ErrDomainIDOrDomainName.
- Silent 401 when user_domain_name and project_domain_name differ: ToTokenV3ScopeMap
  copies DomainName (the user's domain) into the project scope, so Keystone looks
  up the project in the wrong domain.

Fix by removing ProjectDomainID and ProjectDomainName from the DomainID/DomainName
coalesces, and pre-building an explicit AuthScope when project_domain_id or
project_domain_name is set alongside a project name so the project domain is
passed directly to the scope rather than inherited from the user auth fields.
@github-actions github-actions Bot added edit:config This PR updates config code semver:patch No API change backport-v2 This PR will be backported to v2 labels Apr 23, 2026
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 64.035% (+0.01%) from 64.022% — abnvanand:dev-abnvanand into gophercloud:main

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

Labels

backport-v2 This PR will be backported to v2 edit:config This PR updates config code semver:patch No API change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clouds.yaml parser uses user domain as project scope when domains differ

2 participants