Skip to content

feat(sso): full Dex integration (connector pinning, tested LDAP/local/upstream, compose profile) - #431

Merged
M0Rf30 merged 3 commits into
mainfrom
feat/dex-sso
Nov 8, 2026
Merged

M0Rf30 merged 3 commits into
mainfrom
feat/dex-sso

Conversation

@M0Rf30

@M0Rf30 M0Rf30 commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Dex is now a first-class way to sign in to OpenArtifact, not just a generic OIDC issuer.

Connector pinning (oidc_config.dex_connector_id)

  • Optional; plain OIDC only (rejected for github/oauth2); [A-Za-z0-9_-], 1–64 chars.
  • Login URL carries connector_id, so Dex skips its connector chooser.
  • Default scopes become openid email profile groups federated:id; explicit scopes must include federated:id.
  • On callback the ID token's federated_claims.connector_id must equal the pin, otherwise sso_login_denied (reason logged server-side only). Stops a user from stripping the hint and authenticating through another connector of the same Dex.
  • One Dex client can back several OpenArtifact providers, one per connector.
  • Declarative config, openapi.json, generated web types and API reference updated.

Web UI

  • "Dex (single connector)" provider type with the connector ID field, client-side validation mirroring the server, all 11 locales.
  • Entra/Google-only settings are hidden (and cleared) for Dex.

Tests

  • tests/integration/dex_sso_integration_test.go (testcontainers: OpenLDAP + Dex + a second Dex as upstream OIDC): claims per connector, groups → group_mapping, wrong password, link_by_email on/off, logout, pinned login via ldap/local/upstream, unpinned provider shows the chooser, hint-stripping denied for three provider/connector pairs.
  • Unit tests for the auth URL, scopes, the federated-claims check and validation; component tests for the form.

Compose

  • Opt-in dex profile (OpenLDAP + Dex, digest-pinned, loopback only); default docker compose up unchanged.

Docs

  • docs/security/sso.md: Dex row in the vendor table; Dex section (when to use it vs native providers, one client/many providers, claims, email_verified caveats, connector examples, SAML connector warning, local-only logout, Try it locally).
  • Upgrade note (new optional field, no action required).

Observed with Dex v2.46.1

  • email_verified is true for LDAP, password DB and upstream-OIDC users.
  • groups only with the groups scope; federated_claims only with federated:id.
  • No end_session_endpoint: logout ends the OpenArtifact session only.

Verification

  • make lint, make deadcode, make dup, go mod tidy -diff, make test, reuse lint, make docs-check.
  • Dex integration test with -race.
  • Web: typecheck, bun test (2313 pass), i18n:check, build.
  • Manual, real browser against the compose profile: created the provider in the UI, provider test OK, alice signed in through the LDAP form (chooser skipped), stripped connector_id and finished through the password DB → generic denial, log shows ID token comes from Dex connector "local", the provider is pinned to "ldap".

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Coverage

Coverage vs main
Go, unit + integration 83.4% +0.1
Go, unit tests only 69.9% ±0.0
Go, integration tests only 54.5% ±0.0
Web, lines 90.8% +0.4
Web, functions 84.6% -0.1
Go by area
Area Coverage vs main
cmd/docgen 80.3% ±0.0
cmd/genformats 90.8% ±0.0
cmd/oa 0.0% ±0.0
cmd/resetpw 0.0% ±0.0
cmd/server 70.7% ±0.0
internal/ai 85.6% ±0.0
internal/api 76.7% ±0.0
internal/apkkeys 77.1% ±0.0
internal/artifactpath 100.0% ±0.0
internal/attest 85.6% ±0.0
internal/audit 97.6% ±0.0
internal/auth 91.1% +0.1
internal/backup 72.1% ±0.0
internal/bgtask 96.8% ±0.0
internal/branding 93.5% ±0.0
internal/clientsetup 93.6% ±0.0
internal/config 96.4% ±0.0
internal/cron 90.0% ±0.0
internal/crypto 91.0% ±0.0
internal/curation 99.0% ±0.0
internal/database 78.1% +0.7
internal/declarative 83.5% ±0.0
internal/dtrack 85.3% ±0.0
internal/exploit 93.3% -0.3
internal/federation 81.1% ±0.0
internal/format 80.9% ±0.0
internal/formats 87.9% ±0.0
internal/gpgkeys 86.8% ±0.0
internal/group 89.5% ±0.0
internal/httpcache 100.0% ±0.0
internal/httpcompress 93.3% ±0.0
internal/httpx 85.7% ±0.0
internal/importmeta 93.3% ±0.0
internal/iocopy 100.0% ±0.0
internal/itempath 98.3% ±0.0
internal/lazyre 100.0% ±0.0
internal/license 98.5% ±0.0
internal/licensemeta 87.5% ±0.0
internal/licensepolicy 92.6% ±0.0
internal/limitio 92.9% ±0.0
internal/mcp 89.5% ±0.0
internal/metrics 96.2% ±0.0
internal/middleware 94.0% ±0.0
internal/netutil 93.1% ±0.0
internal/nixkeys 79.6% ±0.0
internal/oacli 84.8% ±0.0
internal/ocimanifest 100.0% ±0.0
internal/ocipath 100.0% ±0.0
internal/osv 88.5% ±0.0
internal/passwd 93.3% ±0.0
internal/pathseg 100.0% ±0.0
internal/pglock 79.0% ±0.0
internal/pkgdeps 88.1% ±0.0
internal/presign 99.2% ±0.0
internal/promote 85.1% ±0.0
internal/proxy 86.5% ±0.0
internal/publicurl 96.8% ±0.0
internal/pypisimple 97.9% ±0.0
internal/quarantine 100.0% ±0.0
internal/quota 88.4% ±0.0
internal/recovery 85.8% +0.1
internal/registry 100.0% ±0.0
internal/replication 78.2% -0.1
internal/repodispatch 84.8% ±0.0
internal/repotype 97.0% ±0.0
internal/sbom 90.6% ±0.0
internal/scanexport 96.4% ±0.0
internal/search 90.7% ±0.0
internal/secrets 91.4% ±0.0
internal/storage 84.8% ±0.0
internal/telemetry 92.2% ±0.0
internal/tiering 83.5% ±0.0
internal/trash 96.7% ±0.0
internal/urlparams 100.0% ±0.0
internal/vuln 89.5% ±0.0
internal/webhook 84.1% ±0.0
internal/worker 82.4% -0.2
internal/workq 79.5% ±0.0
pkg/ansible 89.8% ±0.0
pkg/apk 96.0% ±0.0
pkg/cargo 95.6% ±0.0
pkg/compactindex 97.8% ±0.0
pkg/composer 94.5% ±0.0
pkg/conan 99.2% ±0.0
pkg/conda 94.8% ±0.0
pkg/deb 80.2% ±0.0
pkg/delta 71.4% ±0.0
pkg/gemversion 100.0% ±0.0
pkg/gpg 86.7% ±0.0
pkg/helm 97.0% ±0.0
pkg/logger 93.8% ±0.0
pkg/maven 96.7% ±0.0
pkg/nix 99.1% ±0.0
pkg/npm 88.0% ±0.0
pkg/nuget 97.6% ±0.0
pkg/pacman 90.4% ±0.0
pkg/pyversion 100.0% ±0.0
pkg/rpm 92.3% ±0.0
pkg/rpmsign 90.5% ±0.0
pkg/rubymarshal 87.1% ±0.0
pkg/xzlimit 63.3% ±0.0
tests/integration 78.8% ±0.0
web 93.7% ±0.0
Web by area (lines)
Area Coverage vs main
src 24.2% ±0.0
src/api 91.5% ±0.0
src/components 89.4% ±0.0
src/composables 92.3% ±0.0
src/i18n 98.4% ±0.0
src/lib 98.8% ±0.0
src/pages 90.7% +1.3
src/pwa 97.6% ±0.0
src/router 99.7% ±0.0
src/stores 99.0% ±0.0
src/telemetry 90.9% ±0.0

Full report (HTML, merged profile) in the CI run artifacts

@M0Rf30 M0Rf30 changed the title feat(sso): verify Dex LDAP sign-in end to end, add a compose dex profile feat(sso): full Dex integration (connector pinning, tested LDAP/local/upstream, compose profile) Nov 8, 2026
OpenArtifact documented Dex as the way to sign in with LDAP, but nothing
exercised it. A testcontainers integration test now runs OpenLDAP and Dex
(the same images and config the compose profile ships) and drives the
browser flow against an in-process server: claims and scopes, group
provisioning through group_mapping, wrong password, link_by_email on and
off, and logout.

- docker/docker-compose.yml: opt-in `dex` profile (openldap + dex,
  digest-pinned, loopback port); default `compose up` unchanged
- docker/dex/: Dex config and LDIF seed (alice, bob, two groups)
- docs/security/sso.md: Dex row in the vendor table; observed behaviour
  (email_verified always true for LDAP, groups only with the groups
  scope, opaque sub from idAttr + connector id, local-only logout);
  "Try it locally"
Add oidc_config.dex_connector_id: OpenArtifact sends connector_id so Dex skips
its chooser, defaults scopes to openid email profile groups federated:id, and
denies a login whose ID token's federated_claims.connector_id differs (a user
cannot strip the hint and sign in through another connector of the same Dex).

Web UI gets a Dex option (11 locales). The Dex integration test now runs three
connectors (ldap, password database, oidc to a second Dex) with one provider
each, and the compose dex profile gains a password-database user. Docs: new Dex
section with per-connector setup, claim and email_verified behaviour.
@M0Rf30
M0Rf30 merged commit b7378b4 into main Nov 8, 2026
25 checks passed
@M0Rf30
M0Rf30 deleted the feat/dex-sso branch November 8, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant