@shipfox/client-auth 6.0.3 → 7.0.0
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +6 -0
- package/dist/continuation.d.ts +1 -1
- package/dist/continuation.d.ts.map +1 -1
- package/dist/continuation.js +1 -1
- package/dist/continuation.js.map +1 -1
- package/dist/pages/invitation-context.js +1 -1
- package/dist/pages/invitation-context.js.map +1 -1
- package/dist/redirect-context.d.ts.map +1 -0
- package/dist/{components/redirect-context.js → redirect-context.js} +1 -1
- package/dist/redirect-context.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +5 -1
- package/src/continuation.ts +1 -1
- package/src/pages/invitation-context.ts +1 -1
- package/src/{components/redirect-context.test.ts → redirect-context.test.ts} +13 -2
- package/src/{components/redirect-context.ts → redirect-context.ts} +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/dist/components/redirect-context.d.ts.map +0 -1
- package/dist/components/redirect-context.js.map +0 -1
- /package/dist/{components/redirect-context.d.ts → redirect-context.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipfox/client-auth",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "7.0.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/ShipfoxHQ/shipfox.git",
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
"types": "./dist/continuation.d.ts",
|
|
24
24
|
"default": "./dist/continuation.js"
|
|
25
25
|
},
|
|
26
|
+
"./redirect-context": {
|
|
27
|
+
"types": "./dist/redirect-context.d.ts",
|
|
28
|
+
"default": "./dist/redirect-context.js"
|
|
29
|
+
},
|
|
26
30
|
"./routes/*": {
|
|
27
31
|
"types": "./dist/routes/*.d.ts",
|
|
28
32
|
"default": "./dist/routes/*.js"
|
package/src/continuation.ts
CHANGED
|
@@ -3,4 +3,4 @@ export {
|
|
|
3
3
|
EmailCodeVerification,
|
|
4
4
|
type EmailCodeVerificationProps,
|
|
5
5
|
} from './components/email-code-verification.js';
|
|
6
|
-
export {parseRedirectContext, type RedirectContext} from './
|
|
6
|
+
export {parseRedirectContext, type RedirectContext} from './redirect-context.js';
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
pendingInvitation,
|
|
4
4
|
usePreviewInvitation,
|
|
5
5
|
} from '@shipfox/client-invitations';
|
|
6
|
-
import {parseRedirectContext} from '#/
|
|
6
|
+
import {parseRedirectContext} from '#/redirect-context.js';
|
|
7
7
|
|
|
8
8
|
export function extractInvitationToken(redirect: unknown): string | undefined {
|
|
9
9
|
return parseRedirectContext(redirect).invitationToken;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import {parseRedirectContext} from '
|
|
1
|
+
import {parseRedirectContext, type RedirectContext} from '@shipfox/client-auth/redirect-context';
|
|
2
|
+
|
|
3
|
+
describe('@shipfox/client-auth/redirect-context', () => {
|
|
4
|
+
test('imports the parser and its type through the Node-safe public subpath', () => {
|
|
5
|
+
const context: RedirectContext = parseRedirectContext('/workspaces/acme');
|
|
6
|
+
|
|
7
|
+
expect(context).toEqual({returnTo: '/workspaces/acme'});
|
|
8
|
+
});
|
|
2
9
|
|
|
3
|
-
describe('parseRedirectContext', () => {
|
|
4
10
|
test('returns an ordinary safe return path', () => {
|
|
5
11
|
const context = parseRedirectContext('/workspaces/acme?tab=runs');
|
|
6
12
|
|
|
@@ -25,6 +31,10 @@ describe('parseRedirectContext', () => {
|
|
|
25
31
|
test.each([
|
|
26
32
|
['/%2569nvitations/accept?token=double-encoded-token', 'double-encoded-token'],
|
|
27
33
|
['/%252569nvitations/accept?token=triple-encoded-token', 'triple-encoded-token'],
|
|
34
|
+
[
|
|
35
|
+
'/safe%255c..%255cinvitations/accept?token=encoded-backslash-token',
|
|
36
|
+
'encoded-backslash-token',
|
|
37
|
+
],
|
|
28
38
|
])('separates an invitation token from a deeply encoded path: %s', (redirect, token) => {
|
|
29
39
|
const context = parseRedirectContext(redirect);
|
|
30
40
|
|
|
@@ -41,6 +51,7 @@ describe('parseRedirectContext', () => {
|
|
|
41
51
|
'/%252561uth/login',
|
|
42
52
|
'/%E0%80%80',
|
|
43
53
|
'/safe/%25252e%25252e/auth/login',
|
|
54
|
+
'/safe%255c..%255cauth/login',
|
|
44
55
|
])('rejects malformed or unsafe redirect %s', (redirect) => {
|
|
45
56
|
const context = parseRedirectContext(redirect);
|
|
46
57
|
|