@marcoappio/marco-config 4.0.1 → 4.0.2

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.
@@ -64,7 +64,7 @@ const appwriteDeployments = {
64
64
  },
65
65
  production: {
66
66
  applicationUrl: 'https://app.marcoapp.io',
67
- endpoint: 'https://api.marcoapp.io/v1',
67
+ endpoint: 'https://platform.marcoapp.io/v1',
68
68
  oauthClientIds: {
69
69
  google: '338197922176-oml1o2iputhhu3vijgue9h8sbfq17qme.apps.googleusercontent.com',
70
70
  microsoft: 'd34106a5-5210-417e-bf38-6ddbe3aa91a7',
@@ -281,7 +281,7 @@ describe('appwrite', () => {
281
281
  expect(appwrite.environments).toEqual(['development', 'production', 'staging']);
282
282
  expect(appwrite.deployments.production).toEqual({
283
283
  applicationUrl: 'https://app.marcoapp.io',
284
- endpoint: 'https://api.marcoapp.io/v1',
284
+ endpoint: 'https://platform.marcoapp.io/v1',
285
285
  oauthClientIds: {
286
286
  google: '338197922176-oml1o2iputhhu3vijgue9h8sbfq17qme.apps.googleusercontent.com',
287
287
  microsoft: 'd34106a5-5210-417e-bf38-6ddbe3aa91a7',
@@ -497,7 +497,7 @@ export declare const appwriteFunctions: {
497
497
  context: "webhook";
498
498
  method: "GET";
499
499
  path: "/v1/wh/oauth/callback";
500
- requestSchema: v.StrictObjectSchema<{
500
+ requestSchema: v.ObjectSchema<{
501
501
  readonly code: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
502
502
  readonly state: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
503
503
  }, undefined>;
@@ -134,7 +134,7 @@ const apiRoutes = {
134
134
  context: 'webhook',
135
135
  method: 'GET',
136
136
  path: oauth.redirectPath,
137
- requestSchema: v.strictObject({
137
+ requestSchema: v.object({
138
138
  code: string.required(4096),
139
139
  state: string.required(4096),
140
140
  }),
@@ -190,9 +190,36 @@ describe('appwriteFunctions', () => {
190
190
  expect(v.safeParse(route().requestSchema, request).success).toBe(true);
191
191
  expect(v.safeParse(route().responseSchema, response).success).toBe(true);
192
192
  });
193
- it(`rejects caller ownership in the ${name} request and response`, () => {
194
- expect(v.safeParse(route().requestSchema, { ...request, userId: 'another-user' }).success).toBe(false);
195
- expect(v.safeParse(route().responseSchema, { ...response, userId: 'another-user' }).success).toBe(false);
193
+ if (name !== 'OAuth webhook') {
194
+ it(`rejects caller ownership in the ${name} request and response`, () => {
195
+ expect(v.safeParse(route().requestSchema, { ...request, userId: 'another-user' }).success).toBe(false);
196
+ expect(v.safeParse(route().responseSchema, { ...response, userId: 'another-user' }).success).toBe(false);
197
+ });
198
+ }
199
+ }
200
+ it('accepts provider-owned OAuth callback parameters without passing them to the handler', () => {
201
+ const result = v.safeParse(appwriteFunctions.api.routes.oauthWebhook.requestSchema, {
202
+ authuser: '0',
203
+ code: 'test-authorisation-code-1',
204
+ iss: 'https://accounts.google.com',
205
+ scope: 'openid email profile',
206
+ state: 'test-state-1',
207
+ });
208
+ expect(result.success).toBe(true);
209
+ if (result.success) {
210
+ expect(result.output).toEqual({ code: 'test-authorisation-code-1', state: 'test-state-1' });
211
+ }
212
+ });
213
+ for (const { description, request } of [
214
+ { description: 'missing code', request: { state: 'test-state-1' } },
215
+ { description: 'empty code', request: { code: '', state: 'test-state-1' } },
216
+ { description: 'oversized code', request: { code: 'a'.repeat(4097), state: 'test-state-1' } },
217
+ { description: 'missing state', request: { code: 'test-authorisation-code-1' } },
218
+ { description: 'empty state', request: { code: 'test-authorisation-code-1', state: '' } },
219
+ { description: 'oversized state', request: { code: 'test-authorisation-code-1', state: 'a'.repeat(4097) } },
220
+ ]) {
221
+ it(`rejects an OAuth callback with ${description}`, () => {
222
+ expect(v.safeParse(appwriteFunctions.api.routes.oauthWebhook.requestSchema, request).success).toBe(false);
196
223
  });
197
224
  }
198
225
  it('rejects caller-selected accounts for manual polling', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marcoappio/marco-config",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "author": "team@marcoapp.io",
5
5
  "main": "dist/index.js",
6
6
  "repository": "git@github.com:marcoappio/marco-config.git",