Repository navigation
Embedded IdP: optional hosted domain (hd) for the Google connector? #8631
Pionerd
started this conversation in
Ideas & Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Before posting
Product area
Identity provider / SSO
Problem or use case
We self-host several NetBird instances with the embedded IdP and a Google connector, and we really like how simple that setup is: client ID, secret, done.
One thing we miss is Google's hosted domain restriction. Many of our users are signed in to several Google accounts (work, personal, sometimes a customer's Workspace). The Google account picker shows all of them, and any Google account can complete the login; keeping others out is then left to user approval afterwards.
The bundled Dex Google connector already supports this through
hostedDomains: with one domain it sendshd=<domain>(the picker only offers that Workspace), with several it sendshd=*, and in both cases it rejects ID tokens whosehdclaim isn't in the list. NetBird doesn't expose it:IdentityProviderRequesthas no field for it, andbuildOAuth2ConnectorConfigonly writesclientID,clientSecretandredirectURI.Proposed solution
Mostly a question: is this something you'd want to expose, or would you rather keep the identity provider form minimal? We can understand both, the current simplicity is a big part of why we like it.
If yes, something small would do: an optional "Allowed domains" list on Google identity providers (API + dashboard), stored as Dex
hostedDomains. Empty keeps today's behaviour.If no, knowing whether a hand-edited connector config is safe to rely on (see below) would already help.
Alternatives or workarounds considered
Setting it directly in the Dex storage works: we did this on four instances, the Google redirect now carries
hd=<domain>, logins still work and the setting survives restarts. From the code it should also survive later API updates, sinceoverlayConnectorConfigonly overwrites issuer, client ID/secret and redirect URI and keeps other keys:That's a sqlite edit with the server stopped, though, and nothing guarantees future versions keep preserving unknown keys.
Community impact and priority
Examples from other tools or products
Dex's own Google connector (
hostedDomains), which NetBird already bundles. Google'shdparameter: https://developers.google.com/identity/openid-connect/openid-connectSecurity, privacy, and compatibility considerations
The
hdURL parameter alone is only a UI hint; the value is that Dex also validates thehdclaim, so it becomes a real restriction. Backward compatible: an empty list keeps current behaviour. Accounts without a Workspace (personal Gmail) have nohdclaim and are rejected once a list is set, which is the point, but worth a note in the UI.Implementation ideas
Optional
hosted_domainson IdentityProviderRequest/IdentityProvider for type google, mapped tohostedDomainsin buildOAuth2ConnectorConfig and overlayConnectorConfig, read back in parseStorageConnector. Dashboard: a tags input shown only for Google.Are you willing to help?
Yes, I can submit a PR if the approach is accepted.
Additional context
No response
All reactions