@wbce-d9/api 12.5.9 → 12.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,6 +17,23 @@ import { getIPFromReq } from '../../utils/get-ip-from-req.js';
17
17
  import { Url } from '../../utils/url.js';
18
18
  import { isRedirectAllowedOnLogin } from '../../utils/is-redirect-allowed-on-login.js';
19
19
  import { BaseOAuthDriver } from './baseoauth.js';
20
+ // Authorization-request parameters the caller must never control
21
+ const RESERVED_AUTH_PARAMS = new Set([
22
+ 'prompt',
23
+ 'redirect',
24
+ 'scope',
25
+ 'access_type',
26
+ 'code_challenge',
27
+ 'code_challenge_method',
28
+ 'state',
29
+ 'nonce',
30
+ 'redirect_uri',
31
+ 'client_id',
32
+ 'response_type',
33
+ 'response_mode',
34
+ 'request',
35
+ 'request_uri',
36
+ ]);
20
37
  export class OpenIDAuthDriver extends BaseOAuthDriver {
21
38
  client;
22
39
  redirectUrl;
@@ -75,6 +92,7 @@ export class OpenIDAuthDriver extends BaseOAuthDriver {
75
92
  const codeChallenge = await oidc.calculatePKCECodeChallenge(codeVerifier);
76
93
  const paramsConfig = typeof this.config['params'] === 'object' ? this.config['params'] : {};
77
94
  const params = {
95
+ ...additionalParams,
78
96
  scope: this.config['scope'] ?? 'openid profile email',
79
97
  access_type: 'offline',
80
98
  ...paramsConfig,
@@ -84,7 +102,6 @@ export class OpenIDAuthDriver extends BaseOAuthDriver {
84
102
  state: codeChallenge,
85
103
  nonce: codeChallenge,
86
104
  redirect_uri: this.redirectUrl,
87
- ...additionalParams,
88
105
  };
89
106
  if (prompt) {
90
107
  params.prompt = 'consent';
@@ -155,7 +172,7 @@ export function createOpenIDAuthRouter(providerName) {
155
172
  issuer: 'directus',
156
173
  });
157
174
  const additionalParams = Object.fromEntries(Object.entries(req.query)
158
- .filter(([k, v]) => k !== 'prompt' && k !== 'redirect' && typeof v === 'string')
175
+ .filter(([k, v]) => RESERVED_AUTH_PARAMS.has(k) === false && typeof v === 'string')
159
176
  .map(([k, v]) => [k, v]));
160
177
  const authUrl = await provider.generateAuthUrl(codeVerifier, prompt, additionalParams);
161
178
  const urlParams = new URL(authUrl);
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wbce-d9/api",
3
- "version": "12.5.9",
3
+ "version": "12.5.10",
4
4
  "description": "Directus is a real-time API and App dashboard for managing SQL database content",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -143,20 +143,20 @@
143
143
  "tmp-promise": "3.0.3",
144
144
  "tsx": "3.12.6",
145
145
  "uuid-validate": "0.0.3",
146
- "@wbce-d9/app": "11.0.0",
146
+ "@wbce-d9/constants": "10.0.0",
147
147
  "@wbce-d9/exceptions": "10.0.0",
148
- "@wbce-d9/specs": "9.26.5",
149
- "@wbce-d9/schema": "10.0.0",
150
148
  "@wbce-d9/extensions-sdk": "10.0.4",
149
+ "@wbce-d9/schema": "10.0.0",
150
+ "@wbce-d9/specs": "9.26.5",
151
151
  "@wbce-d9/storage": "10.0.0",
152
- "@wbce-d9/constants": "10.0.0",
153
- "@wbce-d9/storage-driver-s3": "10.0.3",
154
152
  "@wbce-d9/storage-driver-azure": "10.0.3",
155
- "@wbce-d9/update-check": "10.0.4",
156
- "@wbce-d9/utils": "10.0.3",
157
- "@wbce-d9/storage-driver-gcs": "10.0.3",
158
153
  "@wbce-d9/storage-driver-cloudinary": "10.0.4",
159
- "@wbce-d9/storage-driver-local": "10.0.3"
154
+ "@wbce-d9/app": "11.0.0",
155
+ "@wbce-d9/storage-driver-gcs": "10.0.3",
156
+ "@wbce-d9/storage-driver-local": "10.0.3",
157
+ "@wbce-d9/storage-driver-s3": "10.0.3",
158
+ "@wbce-d9/update-check": "10.0.4",
159
+ "@wbce-d9/utils": "10.0.3"
160
160
  },
161
161
  "devDependencies": {
162
162
  "@ngneat/falso": "6.4.0",