From 2fd461fa5582fcdca820cc2dcacaae0e605a66b8 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Sat, 12 Sep 2026 12:15:07 +0300 Subject: [PATCH] Add on-premise OAuth2 email domain restrictions. Check the provider email before account and membership changes. Document the roadmap export validation and remaining source review. Thanks to xet7 ! --- docker-compose.yml | 2 + docs/DeveloperDocs/Roadmap-Export-Audit.md | 122 +++++++++++++++++++++ docs/Features/Login/Keycloak/Keycloak.md | 17 ++- packages/wekan-oidc/emailDomainPolicy.js | 19 ++++ packages/wekan-oidc/oidc_server.js | 7 ++ tests/oidcEmailDomainPolicy.test.cjs | 67 +++++++++++ 6 files changed, 233 insertions(+), 1 deletion(-) create mode 100644 docs/DeveloperDocs/Roadmap-Export-Audit.md create mode 100644 packages/wekan-oidc/emailDomainPolicy.js create mode 100644 tests/oidcEmailDomainPolicy.test.cjs diff --git a/docker-compose.yml b/docker-compose.yml index 6ac596bfe4..ce7a98356a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -449,6 +449,8 @@ services: #- OAUTH2_FULLNAME_MAP=name # The claim name you want to map to the email field: #- OAUTH2_EMAIL_MAP=email + # Optional exact email domains for generic OAuth2/OIDC login (on-premise supported). + #- OAUTH2_ALLOWED_EMAIL_DOMAINS=example.internal,other.internal #----------------------------------------------------------------- # ==== OAUTH2 Nextcloud ==== # 1) Register the application with Nextcloud: https://your.nextcloud/index.php/settings/admin/security diff --git a/docs/DeveloperDocs/Roadmap-Export-Audit.md b/docs/DeveloperDocs/Roadmap-Export-Audit.md new file mode 100644 index 0000000000..5a20852243 --- /dev/null +++ b/docs/DeveloperDocs/Roadmap-Export-Audit.md @@ -0,0 +1,122 @@ +# Roadmap export audit + +Audit started 2026-09-12. Implementation and source review are incomplete. + +The replacement `.tools/export.json` parses as JSON and contains all 14 +expected board-export sections, 138 cards, 21 lists and seven swimlanes. +Seven attachment payloads decode successfully and are nonempty; the older +`cat.jpeg` payload is empty. Another `cat.jpeg` record marked +`storage-migrate` contains 8,175 bytes. Four attachment records reference +absent cards and one checklist item references an absent checklist. These +may be stale database records; comparison with the live board is required +to certify completeness. Zero comments are exported. + +The board title is "WeKan ® Open Source Kanban board with MIT license". +Unchecked roadmap items must be compared with current source before changes; +Done and archived cards are historical status, not proof of current behavior. + +## Reviewed behaviors + +- OAuth2 email-domain restriction: added `OAUTH2_ALLOWED_EMAIL_DOMAINS` to + the existing generic OAuth2/OIDC callback. Exact domains, no network lookup, + no new dependency. Tests execute the actual callback with mocked responses. +- Date-change rule triggers: existing `server/triggersDef.js`, + `server/models/cards.js` and `tests/rulesDateFieldTrigger.test.cjs`. +- Rule editing: existing `server/rulesButton.js`, `server/models/rules.js` + and `tests/ruleUpdateInPlace.test.cjs`. +- Bidirectional minicard text: existing title/composer direction attributes + and isolation covered by `tests/minicardBidiIsolation.test.cjs`. This does + not certify every UI element has automatic direction support. + +## Cards awaiting full source review + +This inventory includes informational and prototype cards. Only remaining +Meteor 3 functionality that can operate on-premise without Internet access +belongs in the implementation scope. Cloud-only integrations and unrelated +programming-language rewrites require no implementation for this task. + +| Card ID | List | Title | +| --- | --- | --- | +| 9bFK4idL3Cdbf3YCP | Demo + Wishes :rainbow: | # Demo card :thumbsup: :heart: :tada: | +| uanq777TgLG2aQMTj | Minimize Optimize | Incorrect email notification | +| JdpyPyezsMhmcxsqS | In Progress | List not scrolling when dragging cards to top | +| Sh28EFSDKGdeDy3Hu | Minimize Optimize | Gravatar icons | +| rAEJL6Je7H7zwQoYL | Minimize Optimize | Header login | +| WGi6H5Sev28f73rtW | RAD/Mobile/Desktop App/Accessible/Voice/HTML4 prototypes that use WeKan API | Friend integration: Login | +| 6fjTaDWXT5jJken2u | Attachments Import Export | GitLab integration | +| w75Eo7yS9vtBWPxbz | Login | SAML / Shibboleth based on RocketChat | +| j9MtNahuvqs5ZQeEA | UI | 1. 15h Collapsible Swimlanes with count + rename lists in swimlane [#2107](https://github.com/wekan/wekan/issues/2107) 2. 10h [Bug] Full path display of subtasks cards disappears after a refresh of the subtask board [#3453](https://github.com/wekan/wekan/issues/3453) 3. 10h [UX Bug] Subtask "View it" button to another tab, open the parent card instead of the subtask [#3743](https://github.com/wekan/wekan/issues/3743) 4. 10h Feature Request: Filter Subtasks by Parent [#1871](https://github.com/wekan/wekan/issues/1871) | +| KJY6pxvvHNAgQFPoj | Think | Main Boards - Drag n Drop and/or Color | +| a9wuKBsHjHZFFfvTG | Permissions | Board key like Jira | +| Bq96jdi2QnavtmgRc | Permissions | Pretty ID like Jira | +| 8gqgDcyPtNLhouNFu | Permissions | Multi board calendar like Planyway from Trello | +| BqurJTQkcdrJxHqxw | Permissions | Rules Feature: Trigger on Date Change | +| E6ezju9eqZR6WYnxr | Permissions | - Truncate/Scroll board title text - 2FA login for clients - LDAP with employees ID - Customers and Organizations login pages separately - Integrations to bots, REST API, Webhooks | +| vsRY59RbqNMaL59S7 | Minimize Optimize | Linked cards make load all cards of database | +| rsf9TS7SNPNq8Fp3z | Minimize Optimize | Mobile, Desktop, Calendar, Edit Rule fixes and features. 10h prepaid + 10h postpaid = total 20h. | +| JxrT6fkxdGcBLcp6o | Minimize Optimize | UI improvements | +| LPEBG3ThH2ETMXCmw | Minimize Optimize | Map card | +| S22RwzJc43uv9dShH | UI | Got away from BountySource, so that BountySource would not grab bounty money. Do not use BountySource anymore, instead use [Commercial Support](https://wekan.team/commercial-support/) | +| 2gRNZom6tmgmrxDnx | Minimize Optimize | Fix Import/Export CSV/TSV | +| s7SkzYviC2e963FkT | Minimize Optimize | Mobile and Desktop apps | +| oJWy3mTt4dYBFhYTa | Demo + Wishes :rainbow: | Wekan business model | +| W9nN8mkD6kz6v2pKQ | Minimize Optimize | Registering to not overwrite profile language | +| CJ5GXJ63uxMFa8se3 | Notifications | Email to board. Waits for Mass Import to be implemented first. | +| zJ8L5mPeRCG5ZaBJa | Login | Drag and drop between checklists closes the card sometimes on Firefox | +| MLrgcbaYY2Muuqx7W | Permissions | Removed `wekan-` from exported filenames, for whitelabeling. | +| YLpeqYCgBnfmW6CKW | Minimize Optimize | Granular Roles, create read only etc custom role permission combinations | +| 9zZe4uc69vGzJwBMz | Minimize Optimize | Try to find out how to exclude exceljs from browserside javascript, so that Wekan would work on MyPal webbrowser. | +| so45bWgr8xntnEvDJ | Minimize Optimize | NormalAssignedOnly: only Assigned cards are visible. Etc. | +| mXXFpsWPcBbNQtZEj | Minimize Optimize | Grant to Wekan bugfixes, accessibility and permissions | +| r9wbs35A62u8xF2Rj | Notifications | Notifications Settings (After Mass Import from Trello is ready, this Notifications Settings will be paid, it is not paid yet) | +| EstqPusbf97zhSvR4 | Minimize Optimize | Wekan/Kimai Time Tracking integration | +| y6KPAMyc9aERbeazH | Minimize Optimize | Email templates | +| o9hqer5oxuJHG7bha | Minimize Optimize | Change Favicon | +| Ks9vKCScaKZ6CM6cn | Attachments Import Export | Board Export to HTML to also show card content when clicked | +| DXEKGpi8G6fMxNcRD | Notifications | Combine notifications to Email and/or Tray | +| trLCQdMFdofYSktpP | RAD/Mobile/Desktop App/Accessible/Voice/HTML4 prototypes that use WeKan API | Wekan Backend = Multiple versions of next generation Wekan, built from one source code to all platforms. Starting with prototypes for each version. | +| Lepz6jgwy4WG2H4Gy | Minimize Optimize | Backend changes | +| HJAiF3uRSJHGeeRdE | Minimize Optimize | Porting WeKan MongoDB data to other databases, queries to SQL, Sync | +| SYohzx8Lhrna3AqT8 | Minimize Optimize | In-Place [translating](https://transifex.com/wekan/wekan) of WeKan | +| CrHbsSdzqGfFGzsH8 | Minimize Optimize | Nested Icons, each to have assignable permission levels | +| ztC2EjpM8HSqaevGR | Minimize Optimize | Add User/Admin API for everything | +| LnaaBDiyk93dJ4WQa | RAD/Mobile/Desktop App/Accessible/Voice/HTML4 prototypes that use WeKan API | At Mobile Web, toggle between Mobile UI and Desktop UI | +| AT5vCGeESadnC4Nqc | RAD/Mobile/Desktop App/Accessible/Voice/HTML4 prototypes that use WeKan API | [HaxeUI](https://www.haxeui.org) | +| S6jegFB3CWoBJieqS | RAD/Mobile/Desktop App/Accessible/Voice/HTML4 prototypes that use WeKan API | [Gambas](http://gambas.sourceforge.net) | +| Air3yawSKxpmLjurJ | RAD/Mobile/Desktop App/Accessible/Voice/HTML4 prototypes that use WeKan API | [Lazarus/FreePascal](http://gambas.sourceforge.net) | +| xgwAfMerjm5dT3qk8 | RAD/Mobile/Desktop App/Accessible/Voice/HTML4 prototypes that use WeKan API | [Redox OS](https://www.redox-os.org) | +| cd6rAdwYyChn6RBT8 | RAD/Mobile/Desktop App/Accessible/Voice/HTML4 prototypes that use WeKan API | Apple [SwiftUI](https://developer.apple.com/xcode/swiftui/) | +| MFvtrD9EpQDMknW5F | RAD/Mobile/Desktop App/Accessible/Voice/HTML4 prototypes that use WeKan API | Find all examples how to make Mobile Kanban Apps, and create minimal example that adds card with API to WeKan board | +| He7NNY7x5yXTu22uE | RAD/Mobile/Desktop App/Accessible/Voice/HTML4 prototypes that use WeKan API | WeKan Hosting Platform | +| 7aJniMXBtt6dMnQDJ | Minimize Optimize | Embedded | +| cgD3TwadeoufzH6sA | RAD/Mobile/Desktop App/Accessible/Voice/HTML4 prototypes that use WeKan API | PHP | +| o5rC9BSmeeRpEEFAT | RAD/Mobile/Desktop App/Accessible/Voice/HTML4 prototypes that use WeKan API | [Gemini](https://en.wikipedia.org/wiki/Gemini_(protocol)) | +| 3BKXHfuN5NfQycXse | RAD/Mobile/Desktop App/Accessible/Voice/HTML4 prototypes that use WeKan API | [CloudFlare Workers](https://workers.cloudflare.com) | +| nrdgxyZHhe3wnA9SD | RAD/Mobile/Desktop App/Accessible/Voice/HTML4 prototypes that use WeKan API | Go, GDRP, DataBunker, RClone | +| nrjGewSBE3omrvr6D | Minimize Optimize | [Accessibility](https://github.com/wekan/wekan/issues/459). WeKan first page links: Accessible / Voice Control / HTML4 MPA / HTML5 SPA | +| XfZmRCTYFBEKNsPvm | RAD/Mobile/Desktop App/Accessible/Voice/HTML4 prototypes that use WeKan API | [Nim](https://nim-lang.org) | +| prmajcBvhez4P6Bjs | Minimize Optimize | - Limitations on attachments, size and type (performance) - Minimizing browser side loaded data (performance) - S3/Minio bucket support for attachments (performance) - Logging, timestamps and user actions (security). Log/activity summary grouping. - Adding Hierarchy within user groups (security/privacy) - Map AD groups to permissions at Admin Panel and add metadata to boards (was: Onboarding, to categorize data for filing (privacy)) - Bugfixes | +| AYmzy9SeCXP7Y6ZGv | Login | CAS login | +| dgAadcPRvtCfJz8Pz | RAD/Mobile/Desktop App/Accessible/Voice/HTML4 prototypes that use WeKan API | Dapsi / Multiverse WeKan | +| gm6fRfLKk9H8SMoTK | Think | ClamAV / ClamScan to scan attachments. Fix bug where this feature prevents migrating attachments. | +| aTYCef9diZA7fo5ps | Minimize Optimize | Why changing list color reloads webpage? Try to find and remove that code. | +| B6nTLLL522AEgZgqM | Minimize Optimize | Fix memory leaks or add automated nightly restarts. | +| QRHCdkxcfsAHyXwA7 | Minimize Optimize | Move from wiki to website | +| h4HATReukjWTTX66o | Login | 1. OAuth/Keycloak logins 2. LDAP group memberships reflect access to boards with 15min sync 3. use LDAP user avatar when logged in through OAuth/Keycloak 4. Others at issues | +| KGzTzKBBuC3RrWrPv | Login | 1. Automatic list of new users 2. Admin all boards memberships 3. Improve notification emails 4. Improve calendar view. | +| 5Ac2FHL9iJ3PZ2sW5 | Minimize Optimize | Embedding WeKan | +| BD4Kdg5cG6wY3uqKf | Minimize Optimize | Calendar movement fixes | +| jCkCDxPj7SroqheKj | Minimize Optimize | Developing enabling Wekan API at Sanstorm. | +| iEpxNs6ERcrTYuhTo | Minimize Optimize | Update WeKan and RocketChat at Sandstorm | +| oRbJosYqCwbocfZt4 | Minimize Optimize | Any file format should eligible for drag/drop as attachment, i.e. drag/drop emails or email attachments or files in general from folders. not just images. https://github.com/wekan/wekan/issues/2936 | +| bWqyw5PFGTYkK4cPW | Minimize Optimize | Make archived subtasks work like completed checklist items. Postpaid 10h. https://github.com/wekan/wekan/issues/3409 | +| CiMZ5umNshEFtmpzh | In Progress | Update Snap Stable, Show checklists on minicard, SAML | +| CZHMR9hikcbyF6uA9 | Minimize Optimize | No new Post-Paid work is accepted, because some customers did not pay Post-Paid development. | +| DhzjYmtswRS2FbMjk | Notifications | Wekan Notifications: group many notifications to one notification, and notification icon fix, issues #2026 #3363 #3967 | +| B9tBCr3DJRksFDCmi | In Progress | 4h of 20h CSV export, tex, zoom, roundrobin, max stack size, avatarUrl, adminUserCount | +| nXeKmeifkghMnf57f | Demo + Wishes :rainbow: | Updating this Roadmap to list everything. Trying to implement all paid features and fixes ASAP during 2026. Note: Please do not send me any threats, that would slow me down, I'm trying to concentrate do develop every paid feature. If you would like to speed up, you can sponsor with some payment method at https://wekan.team/sponsor/ or https://wekan.team/commercial-support/ , so then I can then spend more time coding WeKan. | +| waYYDXwNymJrRQAmT | Minimize Optimize | SAML+checklistminicard 60h | +| zaNjRgKTPtba7HkzW | Demo + Wishes :rainbow: | Each feature/fix has prepaid time available, 100e/hour. Spent time shows what amount is used. | +| GuphFXYv3AtHH4MEx | RAD/Mobile/Desktop App/Accessible/Voice/HTML4 prototypes that use WeKan API | Azure [issues](https://github.com/wekan/wekan/issues?q=is%3Aissue+is%3Aopen+azure+label%3ATargets%3AAzure) | +| mPhupDTneiikjPK3g | Minimize Optimize | Duplicate cards: at every swimlane, move cards (bottom card of list first) to leftmost list, and remove other shared lists columns from top list | +| qRYaNFLaFEWQiMYGP | In Progress | Unit and UI Tests (PF-2209) | diff --git a/docs/Features/Login/Keycloak/Keycloak.md b/docs/Features/Login/Keycloak/Keycloak.md index dc09a091f9..c8effe5621 100644 --- a/docs/Features/Login/Keycloak/Keycloak.md +++ b/docs/Features/Login/Keycloak/Keycloak.md @@ -64,6 +64,21 @@ sudo systemctl status snap.wekan.wekan - OAUTH2_EMAIL_MAP=email ``` +To restrict OAuth2/OIDC sign-in to specific email domains, set +`OAUTH2_ALLOWED_EMAIL_DOMAINS=example.internal,other.internal`. This also works +with an on-premise Keycloak server without Internet access and needs no DNS +lookup or additional dependency. The domains are comma-separated, trimmed and +compared without regard to case. Each domain matches exactly; subdomains must +be listed separately. Leave the variable unset or empty to allow all domains. +Malformed restrictions deny sign-in rather than disabling the restriction. + +The policy checks the provider's mapped email on every new OAuth2 handshake, +for new and existing users, before any group or board memberships are changed. +Configure the identity provider to supply an authoritative email that users +cannot freely change. This setting does not revoke existing sessions or affect +local password, LDAP, CAS or SAML sign-in. Sign out existing users when changing +the policy if they must authenticate again immediately. + ### Log Out redirects to the Keycloak home page (issue #6158) With autologin (`OIDC_REDIRECTION_ENABLED=true`), clicking **Log Out** used to @@ -78,4 +93,4 @@ otherwise Keycloak rejects the redirect back to Wekan. ### Debugging, if Docker OIDC login does not work ``` docker logs wekan-app -``` \ No newline at end of file +``` diff --git a/packages/wekan-oidc/emailDomainPolicy.js b/packages/wekan-oidc/emailDomainPolicy.js new file mode 100644 index 0000000000..77f90b1a36 --- /dev/null +++ b/packages/wekan-oidc/emailDomainPolicy.js @@ -0,0 +1,19 @@ +'use strict'; + +// Match the email supplied by the configured identity provider, never a local +// profile field. No DNS lookup is necessary, including for intranet domains. +function isEmailDomainAllowed(email, configuration) { + if (configuration === undefined || configuration === null || configuration === '') return true; + if (typeof configuration !== 'string') return false; + const domains = configuration.split(',').map(value => value.trim().toLowerCase()); + const validDomain = value => /^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/.test(value) + && value.split('.').every(label => label && !label.startsWith('-') && !label.endsWith('-')); + // A malformed configured restriction must never silently disable the policy. + if (!domains.length || domains.some(domain => !validDomain(domain))) return false; + if (typeof email !== 'string' || /\s/.test(email)) return false; + const parts = email.split('@'); + if (parts.length !== 2 || !parts[0] || !validDomain(parts[1].toLowerCase())) return false; + return domains.includes(parts[1].toLowerCase()); +} + +module.exports = { isEmailDomainAllowed }; diff --git a/packages/wekan-oidc/oidc_server.js b/packages/wekan-oidc/oidc_server.js index eb89555bed..ff0f4e6b4b 100644 --- a/packages/wekan-oidc/oidc_server.js +++ b/packages/wekan-oidc/oidc_server.js @@ -7,6 +7,7 @@ import fs from 'fs'; import { resolveOidcEndpoint } from './endpoint'; const { mergeWhitelistedClaims } = require('./serviceDataClaims'); const { maybeGenerateOauth2ClientSecretJwt } = require('./oauth2ClientSecretJwt'); +const { isEmailDomainAllowed } = require('./emailDomainPolicy'); // #2458 (Sign in with Apple): Apple's "client secret" is not a static string // like every other generic-OAuth2 provider's - it is a short-lived JWT the @@ -175,6 +176,12 @@ OAuth.registerService('oidc', 2, null, async function (query) { serviceData.refreshToken = token.refresh_token; if (debug) console.log('XXX: serviceData:', serviceData); + // Apply to every handshake, including existing users, before group/board + // routines can change memberships or Meteor can create or merge an account. + if (!isEmailDomainAllowed(serviceData.email, process.env.OAUTH2_ALLOWED_EMAIL_DOMAINS)) { + throw new Meteor.Error(403, 'Login forbidden'); + } + profile.name = userinfo[process.env.OAUTH2_FULLNAME_MAP]; // || userinfo["displayName"]; profile.email = userinfo[process.env.OAUTH2_EMAIL_MAP]; // || userinfo["email"]; if (serviceData.picture) profile.avatarUrl = serviceData.picture; // localized on board open diff --git a/tests/oidcEmailDomainPolicy.test.cjs b/tests/oidcEmailDomainPolicy.test.cjs new file mode 100644 index 0000000000..597b26844b --- /dev/null +++ b/tests/oidcEmailDomainPolicy.test.cjs @@ -0,0 +1,67 @@ +'use strict'; + +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const { isEmailDomainAllowed } = require('../packages/wekan-oidc/emailDomainPolicy'); + +assert.equal(isEmailDomainAllowed(undefined, undefined), true); +assert.equal(isEmailDomainAllowed(undefined, ''), true); +assert.equal(isEmailDomainAllowed('person@EXAMPLE.internal', ' example.internal, other.internal '), true); +assert.equal(isEmailDomainAllowed('person@other.internal', 'example.internal,other.internal'), true); +assert.equal(isEmailDomainAllowed('person@intranet', 'intranet'), true); +for (const email of [undefined, null, {}, '', '@example.internal', 'person@evil.internal', + 'person@sub.example.internal', 'person@example.internal.evil', 'person@@example.internal', + 'person@example.internal ', 'person@example.internal\n']) { + assert.equal(isEmailDomainAllowed(email, 'example.internal'), false, String(email)); +} +for (const config of [' ', ',', 'example.internal,', '*.internal', 'example..internal', + '-example.internal', 'example-.internal', 'https://example.internal', {}]) { + assert.equal(isEmailDomainAllowed('person@example.internal', config), false, String(config)); +} +const source = fs.readFileSync(path.join(__dirname, '../packages/wekan-oidc/oidc_server.js'), 'utf8'); +const guard = source.indexOf('if (!isEmailDomainAllowed(serviceData.email, process.env.OAUTH2_ALLOWED_EMAIL_DOMAINS))'); +assert.ok(guard > source.indexOf('mergeWhitelistedClaims(')); +assert.ok(guard < source.indexOf("await Meteor.callAsync('groupRoutineOnLogin'")); +assert.ok(guard < source.indexOf("await Meteor.callAsync('boardRoutineOnLogin'")); +assert.match(source.slice(guard, guard + 220), /throw new Meteor.Error\(403, 'Login forbidden'\)/); +// Exercise the actual OAuth callback against an intranet provider response. +// Denied logins must not reach either routine that mutates memberships. +const vm = require('node:vm'); +const callbackSource = source.slice(source.indexOf("OAuth.registerService('oidc'"), source.indexOf('var userAgent')); +async function handshake(email, restriction) { + let callback; + const calls = []; + const context = { + OAuth: { registerService(name, version, options, handler) { callback = handler; } }, + process: { env: { + OAUTH2_EMAIL_MAP: 'mail', OAUTH2_ID_MAP: 'sub', + OAUTH2_ALLOWED_EMAIL_DOMAINS: restriction, + } }, + getToken: async () => ({ access_token: 'fake-provider-token' }), + getUserInfo: async () => ({ sub: 'existing-or-new-user', mail: email }), + getTokenContent: () => null, + getConfiguration: async () => ({}), + mergeWhitelistedClaims() {}, isEmailDomainAllowed, + Meteor: { + Error: class extends Error { constructor(code, reason) { super(reason); this.error = code; } }, + callAsync: async name => calls.push(name), + }, + }; + vm.runInNewContext(callbackSource, context); + try { return { result: await callback({}), calls }; } + catch (error) { return { error, calls }; } +} +(async () => { + const allowed = await handshake('person@example.internal', 'example.internal'); + assert.equal(allowed.result.serviceData.email, 'person@example.internal'); + assert.deepEqual(allowed.calls, ['groupRoutineOnLogin', 'boardRoutineOnLogin']); + for (const email of ['person@evil.internal', undefined]) { + const denied = await handshake(email, 'example.internal'); + assert.equal(denied.error.error, 403); + assert.deepEqual(denied.calls, []); + } + const unrestricted = await handshake('person@other.internal', undefined); + assert.ok(unrestricted.result); + console.log('oidcEmailDomainPolicy: positive, negative and actual OAuth callback checks passed'); +})().catch(error => { console.error(error); process.exitCode = 1; });