Skip to content

Commit d482526

Browse files
authored
fix(identity): streamline SSO settings and harden SCIM provisioning (#7581)
* fix(identity): streamline SSO settings and harden SCIM provisioning * fix(identity): reuse settings controls and tighten SCIM projections
1 parent d594a9e commit d482526

80 files changed

Lines changed: 29205 additions & 1728 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test-build.yml

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ permissions:
99

1010
jobs:
1111
oauth-postgres:
12-
name: OAuth PostgreSQL (${{ matrix.provision }})
12+
name: OAuth and SCIM PostgreSQL (${{ matrix.provision }})
1313
runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-8vcpu-ubuntu-2404' || 'ubuntu-latest' }}
1414
timeout-minutes: 15
1515
strategy:
@@ -22,17 +22,17 @@ jobs:
2222
env:
2323
POSTGRES_USER: postgres
2424
POSTGRES_PASSWORD: postgres
25-
POSTGRES_DB: sim_oauth
25+
POSTGRES_DB: sim_auth_scim
2626
ports:
2727
- 5432:5432
2828
options: >-
29-
--health-cmd "pg_isready -U postgres -d sim_oauth"
29+
--health-cmd "pg_isready -U postgres -d sim_auth_scim"
3030
--health-interval 5s
3131
--health-timeout 5s
3232
--health-retries 10
3333
env:
34-
DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/sim_oauth
35-
OAUTH_TOKEN_FAMILY_TEST_DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/sim_oauth
34+
DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/sim_auth_scim
35+
OAUTH_TOKEN_FAMILY_TEST_DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/sim_auth_scim
3636
BETTER_AUTH_SECRET: oauth-postgres-ci-secret-at-least-32-characters
3737
OAUTH_PROVIDER_ENABLED: 'true'
3838
NEXT_PUBLIC_APP_URL: https://test.sim.ai
@@ -73,14 +73,76 @@ jobs:
7373
working-directory: packages/db
7474
run: bun run db:migrate
7575

76-
- name: Verify provider issuance and token lifecycle in PostgreSQL
76+
- name: Verify OAuth lifecycle and SCIM membership guards in PostgreSQL
7777
working-directory: apps/sim
7878
run: >-
7979
bunx vitest run
8080
lib/auth/oauth-token-family.postgres.test.ts
8181
lib/auth/oauth-provider-lifecycle.postgres.test.ts
8282
app/api/auth/oauth2/token/route.postgres.test.ts
8383
lib/auth/sim-auth-adapter.test.ts
84+
ee/scim/lib/managed-membership.postgres.test.ts
85+
lib/auth/sso/application/admit-sso-user.postgres.test.ts
86+
87+
- name: Verify SCIM and administration over real HTTP
88+
working-directory: apps/sim
89+
env:
90+
NEXT_PUBLIC_APP_URL: http://127.0.0.1:3017
91+
BETTER_AUTH_URL: http://127.0.0.1:3017
92+
NEXT_PUBLIC_FORCE_HOSTED: 'true'
93+
BILLING_ENABLED: 'true'
94+
NEXT_PUBLIC_BILLING_ENABLED: 'true'
95+
ENTERPRISE_ENABLED: 'true'
96+
NEXT_PUBLIC_ENTERPRISE_ENABLED: 'true'
97+
SCIM_ENABLED: 'true'
98+
NEXT_PUBLIC_SCIM_ENABLED: 'true'
99+
SSO_ENABLED: 'true'
100+
NEXT_PUBLIC_SSO_ENABLED: 'true'
101+
ORGANIZATIONS_ENABLED: 'true'
102+
NEXT_PUBLIC_ORGANIZATIONS_ENABLED: 'true'
103+
INTERNAL_API_SECRET: scim-http-ci-local-secret-at-least-32-characters
104+
DB_TX_TRIPWIRE: throw
105+
DISABLE_TELEMETRY: 'true'
106+
NEXT_TELEMETRY_DISABLED: '1'
107+
NEXT_PUBLIC_CHAT_DISABLED: 'true'
108+
run: |
109+
server_log="$RUNNER_TEMP/scim-next.log"
110+
node ../../node_modules/next/dist/bin/next dev --hostname 127.0.0.1 --port 3017 > "$server_log" 2>&1 &
111+
server_pid=$!
112+
finish() {
113+
kill "$server_pid" 2>/dev/null || true
114+
wait "$server_pid" 2>/dev/null || true
115+
awk '/^ (GET|POST|PUT|PATCH|DELETE|HEAD) \/api\// { print }' "$server_log" > "$RUNNER_TEMP/scim-http-status.log"
116+
}
117+
trap finish EXIT
118+
deadline=$((SECONDS + 120))
119+
until curl --fail --silent --max-time 3 http://127.0.0.1:3017/api/health > /dev/null; do
120+
if ! kill -0 "$server_pid" 2>/dev/null; then
121+
echo 'Local SCIM app exited during startup.'
122+
exit 1
123+
fi
124+
if [ "$SECONDS" -ge "$deadline" ]; then
125+
echo 'Local SCIM app did not become ready within 120 seconds.'
126+
exit 1
127+
fi
128+
sleep 2
129+
done
130+
SCIM_E2E_BASE_URL="$NEXT_PUBLIC_APP_URL" \
131+
SCIM_E2E_DATABASE_URL="$DATABASE_URL" \
132+
SCIM_E2E_AUTH_SECRET="$BETTER_AUTH_SECRET" \
133+
SCIM_E2E_REPORT_PATH="$RUNNER_TEMP/scim-e2e-report.json" \
134+
bun run test:scim:e2e
135+
136+
- name: Upload SCIM failure report and HTTP status log
137+
if: failure()
138+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
139+
with:
140+
name: scim-failure-${{ matrix.provision }}
141+
path: |
142+
${{ runner.temp }}/scim-e2e-report.json
143+
${{ runner.temp }}/scim-http-status.log
144+
if-no-files-found: ignore
145+
retention-days: 7
84146

85147
test-build:
86148
name: Lint and Test

0 commit comments

Comments
 (0)