@atlaskit/media-client 37.1.0 → 37.1.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.
package/AGENTS.md CHANGED
@@ -26,11 +26,11 @@
26
26
  > codebase and the docs after any code change. Use the `generate` subcommand to bootstrap the index
27
27
  > in a new repository.
28
28
 
29
- **Entry point:** `.agents/knowledge-index/INDEX.md` **Unit doc:**
30
- `.agents/knowledge-index/domains/media/units/atlaskit-media-client.md` **CLI:**
31
- `python3 .agents/skills/knowledge-index/scripts/kg.py {find,read,edit,investigate,validate,init,explore,generate} …`
32
- **Refresh protocol:** never silently bump `Last verified` — always re-read the listed `Sources`
33
- first, edit, then `kg.py edit <path> --message "<reason>"`.
29
+ **Entry point:** `.agents/knowledge-index/INDEX.md`
30
+ **Unit doc:** `.agents/knowledge-index/domains/media/units/atlaskit-media-client.md`
31
+ **Standards page:** `.agents/knowledge-index/domains/media/units/atlaskit-media-client/standards-and-patterns.md`
32
+ **CLI:** `python3 .agents/skills/knowledge-index/scripts/kg.py {find,read,edit,investigate,validate,init,explore,generate} …`
33
+ **Refresh protocol:** never silently bump `Last verified` — always re-read the listed `Sources` first, edit, then `kg.py edit <path> --message "<reason>"`.
34
34
 
35
35
  ## Key source files
36
36
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/media-client
2
2
 
3
+ ## 37.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c16e1619c15f1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c16e1619c15f1) -
8
+ Clean up platform_media_upload_external_anonymize_filename feature flag; anonymizing the external
9
+ upload filename is now controlled solely by the anonymizeFilename argument
10
+
11
+ ## 37.1.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [`8bac4be486285`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8bac4be486285) -
16
+ Adds a client-side validation guard in media-client's resolveAuth that rejects an auth resolving
17
+ to neither a valid clientId nor a valid asapIssuer, behind the platform_media_validate_client_id
18
+
3
19
  ## 37.1.0
4
20
 
5
21
  ### Minor Changes
@@ -26,7 +26,6 @@ var _Subscription = require("rxjs/Subscription");
26
26
  var _map = require("rxjs/operators/map");
27
27
  var _v = _interopRequireDefault(require("uuid/v4"));
28
28
  var _mediaCore = require("@atlaskit/media-core");
29
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
30
29
  var _isValidUuid = require("@atlaskit/media-common/isValidUuid");
31
30
  var _downloadUrl = require("@atlaskit/media-common/downloadUrl");
32
31
  var _mediaStore = require("../media-store");
@@ -599,7 +598,7 @@ var FileFetcherImpl = exports.FileFetcherImpl = /*#__PURE__*/function () {
599
598
  return _ref0.apply(this, arguments);
600
599
  };
601
600
  }());
602
- name = anonymizeFilename && (0, _platformFeatureFlags.fg)('platform_media_upload_external_anonymize_filename') ? crypto.randomUUID() : url.split('/').pop() || ''; // we create a initial fileState with the minimum info that we have at this point
601
+ name = anonymizeFilename ? crypto.randomUUID() : url.split('/').pop() || ''; // we create a initial fileState with the minimum info that we have at this point
603
602
  fileState = {
604
603
  status: 'processing',
605
604
  name: name,
@@ -87,8 +87,14 @@ var resolveAuth = exports.resolveAuth = /*#__PURE__*/function () {
87
87
  }
88
88
  throw new _error.MediaStoreError('emptyAuth');
89
89
  case 6:
90
- return _context.abrupt("return", auth);
90
+ if (!('clientId' in auth && !auth.clientId && (0, _platformFeatureFlags.fg)('platform_media_validate_client_id'))) {
91
+ _context.next = 7;
92
+ break;
93
+ }
94
+ throw new _error.MediaStoreError('emptyClientId');
91
95
  case 7:
96
+ return _context.abrupt("return", auth);
97
+ case 8:
92
98
  case "end":
93
99
  return _context.stop();
94
100
  }
@@ -4,7 +4,6 @@ import { map } from 'rxjs/operators/map';
4
4
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
5
5
  import uuid from 'uuid/v4';
6
6
  import { authToOwner } from '@atlaskit/media-core';
7
- import { fg } from '@atlaskit/platform-feature-flags';
8
7
  import { isValidUuid } from '@atlaskit/media-common/isValidUuid';
9
8
  import { downloadUrl } from '@atlaskit/media-common/downloadUrl';
10
9
  import { MediaStore as MediaApi } from '../media-store';
@@ -369,7 +368,7 @@ export class FileFetcherImpl {
369
368
  origin: 'remote'
370
369
  });
371
370
  });
372
- const name = anonymizeFilename && fg('platform_media_upload_external_anonymize_filename') ? crypto.randomUUID() : url.split('/').pop() || '';
371
+ const name = anonymizeFilename ? crypto.randomUUID() : url.split('/').pop() || '';
373
372
  // we create a initial fileState with the minimum info that we have at this point
374
373
  const fileState = {
375
374
  status: 'processing',
@@ -58,6 +58,14 @@ export const resolveAuth = async (authProvider, authContext, authProviderTimeout
58
58
  throw new MediaStoreError('emptyAuth');
59
59
  }
60
60
 
61
+ /*
62
+ Only client-based auth carries a clientId. Fail fast when it is present but empty, instead of
63
+ letting the request reach dt-auth and get rejected with `Client id "" is invalid`.
64
+ */
65
+ if ('clientId' in auth && !auth.clientId && fg('platform_media_validate_client_id')) {
66
+ throw new MediaStoreError('emptyClientId');
67
+ }
68
+
61
69
  /*
62
70
  We added a token expiration check here in the past, and then we had to revert due to edge cases in the client that we can't control.
63
71
  Token expiration check in the frontend is a bad idea. Don't do it!
@@ -10,7 +10,6 @@ import { map } from 'rxjs/operators/map';
10
10
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
11
11
  import uuid from 'uuid/v4';
12
12
  import { authToOwner } from '@atlaskit/media-core';
13
- import { fg } from '@atlaskit/platform-feature-flags';
14
13
  import { isValidUuid } from '@atlaskit/media-common/isValidUuid';
15
14
  import { downloadUrl } from '@atlaskit/media-common/downloadUrl';
16
15
  import { MediaStore as MediaApi } from '../media-store';
@@ -582,7 +581,7 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
582
581
  return _ref0.apply(this, arguments);
583
582
  };
584
583
  }());
585
- name = anonymizeFilename && fg('platform_media_upload_external_anonymize_filename') ? crypto.randomUUID() : url.split('/').pop() || ''; // we create a initial fileState with the minimum info that we have at this point
584
+ name = anonymizeFilename ? crypto.randomUUID() : url.split('/').pop() || ''; // we create a initial fileState with the minimum info that we have at this point
586
585
  fileState = {
587
586
  status: 'processing',
588
587
  name: name,
@@ -80,8 +80,14 @@ export var resolveAuth = /*#__PURE__*/function () {
80
80
  }
81
81
  throw new MediaStoreError('emptyAuth');
82
82
  case 6:
83
- return _context.abrupt("return", auth);
83
+ if (!('clientId' in auth && !auth.clientId && fg('platform_media_validate_client_id'))) {
84
+ _context.next = 7;
85
+ break;
86
+ }
87
+ throw new MediaStoreError('emptyClientId');
84
88
  case 7:
89
+ return _context.abrupt("return", auth);
90
+ case 8:
85
91
  case "end":
86
92
  return _context.stop();
87
93
  }
@@ -1,5 +1,5 @@
1
1
  import { BaseMediaClientError } from '../../models/errors';
2
- export type MediaStoreErrorReason = 'failedAuthProvider' | 'tokenExpired' | 'missingInitialAuth' | 'emptyAuth' | 'authProviderTimedOut';
2
+ export type MediaStoreErrorReason = 'failedAuthProvider' | 'tokenExpired' | 'missingInitialAuth' | 'emptyAuth' | 'emptyClientId' | 'authProviderTimedOut';
3
3
  export type MediaStoreErrorAttributes = {
4
4
  readonly reason: MediaStoreErrorReason;
5
5
  readonly innerError?: Error;
@@ -2,7 +2,7 @@ import { type MediaTraceContext } from '@atlaskit/media-common';
2
2
  export interface SerializableObject {
3
3
  [key: string]: string | number | boolean | null | undefined | SerializableObject;
4
4
  }
5
- export type MediaClientErrorReason = 'clientOffline' | 'clientAbortedRequest' | 'clientTimeoutRequest' | 'serverInvalidBody' | 'serverBadRequest' | 'serverUnauthorized' | 'serverForbidden' | 'serverNotFound' | 'serverRateLimited' | 'serverInternalError' | 'serverBadGateway' | 'serverUnexpectedError' | 'serverUnprocessableEntity' | 'serverEntityLocked' | 'failedAuthProvider' | 'tokenExpired' | 'missingInitialAuth' | 'emptyAuth' | 'authProviderTimedOut' | 'invalidFileId' | 'emptyItems' | 'zeroVersionFile' | 'emptyFileName' | 'pollingMaxAttemptsExceeded' | 'fileSizeExceedsLimit' | 'deprecatedEndpoint';
5
+ export type MediaClientErrorReason = 'clientOffline' | 'clientAbortedRequest' | 'clientTimeoutRequest' | 'serverInvalidBody' | 'serverBadRequest' | 'serverUnauthorized' | 'serverForbidden' | 'serverNotFound' | 'serverRateLimited' | 'serverInternalError' | 'serverBadGateway' | 'serverUnexpectedError' | 'serverUnprocessableEntity' | 'serverEntityLocked' | 'failedAuthProvider' | 'tokenExpired' | 'missingInitialAuth' | 'emptyAuth' | 'authProviderTimedOut' | 'emptyClientId' | 'invalidFileId' | 'emptyItems' | 'zeroVersionFile' | 'emptyFileName' | 'pollingMaxAttemptsExceeded' | 'fileSizeExceedsLimit' | 'deprecatedEndpoint';
6
6
  export type MediaClientErrorMetadata = SerializableObject & {
7
7
  traceContext?: MediaTraceContext;
8
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "37.1.0",
3
+ "version": "37.1.2",
4
4
  "description": "Media API Web Client Library",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -44,8 +44,8 @@
44
44
  "@atlaskit/media-core": "^38.0.0",
45
45
  "@atlaskit/media-state": "^3.0.0",
46
46
  "@atlaskit/ssr": "workspace:^",
47
- "@atlaskit/tokens": "^14.0.0",
48
- "@atlassian/a11y-jest-testing": "^0.12.0",
47
+ "@atlaskit/tokens": "^15.0.0",
48
+ "@atlassian/a11y-jest-testing": "^0.13.0",
49
49
  "@atlassian/feature-flags-test-utils": "^1.1.0",
50
50
  "@emotion/react": "^11.7.1",
51
51
  "@types/deep-equal": "^1.0.1",
@@ -67,9 +67,6 @@
67
67
  }
68
68
  },
69
69
  "platform-feature-flags": {
70
- "platform_media_upload_external_anonymize_filename": {
71
- "type": "boolean"
72
- },
73
70
  "platform_media_cdn_single_host": {
74
71
  "type": "boolean"
75
72
  },
@@ -85,6 +82,9 @@
85
82
  "platform_media_auth_provider_analytics": {
86
83
  "type": "boolean"
87
84
  },
85
+ "platform_media_validate_client_id": {
86
+ "type": "boolean"
87
+ },
88
88
  "confluence_watermark_admin_ui": {
89
89
  "type": "boolean"
90
90
  },