Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/e2e-api-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ jobs:
tail: true
wait-for: 30s
log-output-if: true
- name: Start mock-saml-idp in background
uses: JarvusInnovations/background-action@v1.0.7
with:
run: pnpm run start:mock-saml-idp --log-order=stream &
wait-on: |
http://localhost:8142/idp
tail: true
wait-for: 30s
log-output-if: true
- name: Start run-email-queue in background
uses: JarvusInnovations/background-action@v1.0.7
with:
Expand Down
7 changes: 7 additions & 0 deletions apps/dev-launchpad/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,13 @@ <h2 style="margin-top: 64px;">Background services</h2>
"Src: ./apps/mock-oauth-server",
],
},
{
name: "SAML mock IdP",
portSuffix: "42",
description: [
"Src: ./apps/mock-saml-idp",
],
},
{
name: "examples/supabase",
portSuffix: "15",
Expand Down
14 changes: 12 additions & 2 deletions apps/e2e/tests/snapshot-serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,26 @@ const stripUrlQueryParams = [
"code",
"code_challenge",
"interaction_uid",
// SAML — both URL-binding (query) and POST-binding (form) carry these,
// each encodes the AuthnRequest ID + timestamps + signature so snapshots
// would re-roll on every test run.
"SAMLRequest",
"SAMLResponse",
"RelayState",
Comment thread
BilalG1 marked this conversation as resolved.
] as const;

const keyedCookieNamePrefixes = [
"stack-oauth-inner-",
"stack-saml-inner-",
] as const;

const stringRegexReplacements = [
[/(\/integrations\/(neon|custom)\/oauth\/idp\/(interaction|auth)\/)[a-zA-Z0-9_-]+/gi, "$1<stripped $3 UID>"],
[new RegExp(`localhost\:${getPortPrefix()}`, "gi"), "localhost:<$$NEXT_PUBLIC_STACK_PORT_PREFIX>"],
[new RegExp(`localhost\%3A${getPortPrefix()}`, "gi"), "localhost%3A%3C%24NEXT_PUBLIC_STACK_PORT_PREFIX%3E"],
[/(Timeout exceeded: elapsed )[0-9.]+( ms)/gi, "$1<stripped time>$2"],
// SAML XML timestamps (e.g. IssueInstant, NotBefore, NotOnOrAfter).
[/(IssueInstant|NotBefore|NotOnOrAfter)="[^"]+"/g, '$1="<stripped SAML timestamp>"'],
] as const;


Expand Down Expand Up @@ -219,8 +228,9 @@ const snapshotSerializer: SnapshotSerializer = {
if (headerName === "set-cookie") {
const partsStrings = value.split(";").map((part) => part.trim());
let cookieName = partsStrings[0].split("=")[0];
if (keyedCookieNamePrefixes.some((prefix) => cookieName.startsWith(prefix))) {
cookieName = `${keyedCookieNamePrefixes}<stripped cookie name key>`;
const matchedPrefix = keyedCookieNamePrefixes.find((prefix) => cookieName.startsWith(prefix));
if (matchedPrefix) {
cookieName = `${matchedPrefix}<stripped cookie name key>`;
}
const cookieValue = partsStrings[0].split("=")[1];
const parts = new Map(partsStrings.map((part) => {
Expand Down
6 changes: 6 additions & 0 deletions apps/mock-saml-idp/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
"extends": [
"../../configs/eslint/defaults.js",
],
"ignorePatterns": ['/*', '!/src']
};
Comment thread
BilalG1 marked this conversation as resolved.
26 changes: 26 additions & 0 deletions apps/mock-saml-idp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "@stackframe/mock-saml-idp",
"version": "2.8.86",
"repository": "https://github.com/stack-auth/stack-auth",
"private": true,
"main": "index.js",
"scripts": {
"start": "tsx src/index.ts",
"dev": "tsx watch --clear-screen=false src/index.ts",
"typecheck": "tsc --noEmit",
"lint": "eslint --ext .tsx,.ts .",
"clean": "rimraf dist && rimraf node_modules"
},
"dependencies": {
"express": "^4.21.2",
"handlebars": "^4.7.8",
"node-forge": "^1.3.1",
"samlify": "^2.10.0"
},
"devDependencies": {
"@types/express": "^5.0.0",
"@types/node-forge": "^1.3.11",
"tsx": "^4.16.2"
},
Comment thread
coderabbitai[bot] marked this conversation as resolved.
"packageManager": "pnpm@10.23.0"
}
Loading
Loading