@atlaskit/media-client 37.1.0 → 37.1.1
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/CHANGELOG.md +8 -0
- package/dist/cjs/client/media-store/resolveAuth.js +7 -1
- package/dist/es2019/client/media-store/resolveAuth.js +8 -0
- package/dist/esm/client/media-store/resolveAuth.js +7 -1
- package/dist/types/client/media-store/error.d.ts +1 -1
- package/dist/types/models/errors/types.d.ts +1 -1
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/media-client
|
|
2
2
|
|
|
3
|
+
## 37.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`8bac4be486285`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8bac4be486285) -
|
|
8
|
+
Adds a client-side validation guard in media-client's resolveAuth that rejects an auth resolving
|
|
9
|
+
to neither a valid clientId nor a valid asapIssuer, behind the platform_media_validate_client_id
|
|
10
|
+
|
|
3
11
|
## 37.1.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -87,8 +87,14 @@ var resolveAuth = exports.resolveAuth = /*#__PURE__*/function () {
|
|
|
87
87
|
}
|
|
88
88
|
throw new _error.MediaStoreError('emptyAuth');
|
|
89
89
|
case 6:
|
|
90
|
-
|
|
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
|
}
|
|
@@ -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!
|
|
@@ -80,8 +80,14 @@ export var resolveAuth = /*#__PURE__*/function () {
|
|
|
80
80
|
}
|
|
81
81
|
throw new MediaStoreError('emptyAuth');
|
|
82
82
|
case 6:
|
|
83
|
-
|
|
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.
|
|
3
|
+
"version": "37.1.1",
|
|
4
4
|
"description": "Media API Web Client Library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -85,6 +85,9 @@
|
|
|
85
85
|
"platform_media_auth_provider_analytics": {
|
|
86
86
|
"type": "boolean"
|
|
87
87
|
},
|
|
88
|
+
"platform_media_validate_client_id": {
|
|
89
|
+
"type": "boolean"
|
|
90
|
+
},
|
|
88
91
|
"confluence_watermark_admin_ui": {
|
|
89
92
|
"type": "boolean"
|
|
90
93
|
},
|