@pippit-dev/cli 1.0.43 → 1.0.44
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/checksums.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
8bf338b7fc4bb3de289778896059f364f91743e7fe3127380e193f29bb10fecf pippit-tool-cli-1.0.44-darwin-amd64.tar.gz
|
|
2
|
+
fd7aac74fda167481b76e3a7aa2f30e45271670cad11f0e969080db1b135411a pippit-tool-cli-1.0.44-darwin-arm64.tar.gz
|
|
3
|
+
526e3641047d7e997fb5c271d795337692b0a47c092622747f6e2b4e9d22e473 pippit-tool-cli-1.0.44-linux-amd64.tar.gz
|
|
4
|
+
6170436a3ec60dc2a2681e6f790c6a52d9daa4248ce8c3eede83136a62ccb4b6 pippit-tool-cli-1.0.44-linux-arm64.tar.gz
|
|
5
|
+
d3c7166314bb52deae5e0caf383ac7e3cdde27c61325d6556de43f8f46aa9963 pippit-tool-cli-1.0.44-windows-amd64.zip
|
|
6
|
+
9cb3d470688cd89a42a2267d9d181159dd624937c9590d3b744db25a66edbac9 pippit-tool-cli-1.0.44-windows-arm64.zip
|
package/cmd/auth/auth_test.go
CHANGED
|
@@ -75,7 +75,7 @@ func (manager *fakeAuthManager) CredentialScope(context.Context) (string, error)
|
|
|
75
75
|
|
|
76
76
|
func TestLoginCommandPrintsMetadataWithoutAccessKey(t *testing.T) {
|
|
77
77
|
const accessKey = "must-never-be-printed"
|
|
78
|
-
const loginURL = "https://
|
|
78
|
+
const loginURL = "https://www.xiaoyunque.com/cli/pippit-tool-login?callback=http%3A%2F%2F127.0.0.1%3A1234&random_secret_key=one-time-secret"
|
|
79
79
|
expiresAt := time.Now().Add(time.Hour).Unix()
|
|
80
80
|
manager := &fakeAuthManager{credential: &internal_auth.Credential{
|
|
81
81
|
AccessKey: accessKey, UID: "123", CredentialScope: "device-scope", ExpiredAt: expiresAt,
|
package/dist/checksums.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
8bf338b7fc4bb3de289778896059f364f91743e7fe3127380e193f29bb10fecf pippit-tool-cli-1.0.44-darwin-amd64.tar.gz
|
|
2
|
+
fd7aac74fda167481b76e3a7aa2f30e45271670cad11f0e969080db1b135411a pippit-tool-cli-1.0.44-darwin-arm64.tar.gz
|
|
3
|
+
526e3641047d7e997fb5c271d795337692b0a47c092622747f6e2b4e9d22e473 pippit-tool-cli-1.0.44-linux-amd64.tar.gz
|
|
4
|
+
6170436a3ec60dc2a2681e6f790c6a52d9daa4248ce8c3eede83136a62ccb4b6 pippit-tool-cli-1.0.44-linux-arm64.tar.gz
|
|
5
|
+
d3c7166314bb52deae5e0caf383ac7e3cdde27c61325d6556de43f8f46aa9963 pippit-tool-cli-1.0.44-windows-amd64.zip
|
|
6
|
+
9cb3d470688cd89a42a2267d9d181159dd624937c9590d3b744db25a66edbac9 pippit-tool-cli-1.0.44-windows-arm64.zip
|
|
@@ -96,7 +96,7 @@ func (s *memoryCredentialStore) Delete(ctx context.Context) error {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
func TestBrowserFlowUsesDedicatedPageAndStrictBoundCallback(t *testing.T) {
|
|
99
|
-
authURL, _ := url.Parse(config.
|
|
99
|
+
authURL, _ := url.Parse(config.DefaultAuthBaseURL)
|
|
100
100
|
deviceID, _ := randomEncoded(bytes.NewReader(bytes.Repeat([]byte{0x21}, deviceIDBytes)), deviceIDBytes)
|
|
101
101
|
flow, err := startBrowserFlow(
|
|
102
102
|
authURL, bytes.NewReader(bytes.Repeat([]byte{0x42}, 2*randomBindingBytes)),
|
|
@@ -111,7 +111,7 @@ func TestBrowserFlowUsesDedicatedPageAndStrictBoundCallback(t *testing.T) {
|
|
|
111
111
|
if err != nil {
|
|
112
112
|
t.Fatal(err)
|
|
113
113
|
}
|
|
114
|
-
if loginURL.Scheme+"://"+loginURL.Host != config.
|
|
114
|
+
if loginURL.Scheme+"://"+loginURL.Host != config.DefaultAuthBaseURL || loginURL.Path != loginPagePath {
|
|
115
115
|
t.Fatalf("login URL target = %s://%s%s", loginURL.Scheme, loginURL.Host, loginURL.Path)
|
|
116
116
|
}
|
|
117
117
|
query := loginURL.Query()
|
|
@@ -152,30 +152,30 @@ func TestBrowserFlowUsesDedicatedPageAndStrictBoundCallback(t *testing.T) {
|
|
|
152
152
|
}
|
|
153
153
|
wrongSecret := payload
|
|
154
154
|
wrongSecret.RandomSecretKey = "wrong-secret"
|
|
155
|
-
if status := sendCallback(t, callbackURL, config.
|
|
155
|
+
if status := sendCallback(t, callbackURL, config.DefaultAuthBaseURL, wrongSecret); status != http.StatusBadRequest {
|
|
156
156
|
t.Fatalf("wrong secret status = %d", status)
|
|
157
157
|
}
|
|
158
|
-
if status := postRawCallback(t, callbackURL, config.
|
|
158
|
+
if status := postRawCallback(t, callbackURL, config.DefaultAuthBaseURL, `{"type":"access_key","unknown":true}`); status != http.StatusBadRequest {
|
|
159
159
|
t.Fatalf("unknown field status = %d", status)
|
|
160
160
|
}
|
|
161
|
-
if status := sendCallback(t, callbackURL+"&state=duplicate", config.
|
|
161
|
+
if status := sendCallback(t, callbackURL+"&state=duplicate", config.DefaultAuthBaseURL, payload); status != http.StatusBadRequest {
|
|
162
162
|
t.Fatalf("duplicate state status = %d", status)
|
|
163
163
|
}
|
|
164
|
-
if status := sendCallback(t, callbackURL+"&unexpected=value", config.
|
|
164
|
+
if status := sendCallback(t, callbackURL+"&unexpected=value", config.DefaultAuthBaseURL, payload); status != http.StatusBadRequest {
|
|
165
165
|
t.Fatalf("unexpected transport query status = %d", status)
|
|
166
166
|
}
|
|
167
|
-
if status := sendPreflight(t, callbackURL, config.
|
|
167
|
+
if status := sendPreflight(t, callbackURL, config.DefaultAuthBaseURL); status != http.StatusNoContent {
|
|
168
168
|
t.Fatalf("preflight status = %d", status)
|
|
169
169
|
}
|
|
170
170
|
securityRuntimeCallback := callbackURL + "&a_bogus=signed-request&msToken=transport-token"
|
|
171
|
-
if status := sendCallback(t, securityRuntimeCallback, config.
|
|
171
|
+
if status := sendCallback(t, securityRuntimeCallback, config.DefaultAuthBaseURL, payload); status != http.StatusOK {
|
|
172
172
|
t.Fatalf("security-runtime callback status = %d", status)
|
|
173
173
|
}
|
|
174
174
|
got, err := flow.wait(context.Background())
|
|
175
175
|
if err != nil || got.AccessKey != payload.AccessKey || got.UID != payload.UID || got.TokenID != payload.TokenID {
|
|
176
176
|
t.Fatalf("callback payload = %#v, %v", credentialPayloadWithoutSecret(got), err)
|
|
177
177
|
}
|
|
178
|
-
if status := sendCallback(t, callbackURL, config.
|
|
178
|
+
if status := sendCallback(t, callbackURL, config.DefaultAuthBaseURL, payload); status != http.StatusConflict {
|
|
179
179
|
t.Fatalf("replayed callback status = %d", status)
|
|
180
180
|
}
|
|
181
181
|
}
|
|
@@ -185,6 +185,7 @@ func TestManagerLoginStoresPageIssuedCredentialWithoutServerExchange(t *testing.
|
|
|
185
185
|
store := &memoryCredentialStore{}
|
|
186
186
|
cfg := config.Load()
|
|
187
187
|
cfg.AccessKey = ""
|
|
188
|
+
cfg.BaseURL = "https://untrusted.invalid"
|
|
188
189
|
manager := NewManager(
|
|
189
190
|
cfg,
|
|
190
191
|
WithCredentialStore(store),
|
|
@@ -204,6 +205,9 @@ func TestManagerLoginStoresPageIssuedCredentialWithoutServerExchange(t *testing.
|
|
|
204
205
|
if parseErr != nil {
|
|
205
206
|
return parseErr
|
|
206
207
|
}
|
|
208
|
+
if loginURL.Scheme != "https" || loginURL.Host != "www.xiaoyunque.com" {
|
|
209
|
+
t.Errorf("login origin = %s://%s, want https://www.xiaoyunque.com", loginURL.Scheme, loginURL.Host)
|
|
210
|
+
}
|
|
207
211
|
if loginURL.Path != loginPagePath || loginURL.Query().Get("force") != "" {
|
|
208
212
|
return fmt.Errorf("unexpected login URL")
|
|
209
213
|
}
|
|
@@ -218,7 +222,7 @@ func TestManagerLoginStoresPageIssuedCredentialWithoutServerExchange(t *testing.
|
|
|
218
222
|
Source: loginSource,
|
|
219
223
|
CallbackURL: loginURL.Query().Get("callback"),
|
|
220
224
|
}
|
|
221
|
-
if status := sendCallback(t, payload.CallbackURL,
|
|
225
|
+
if status := sendCallback(t, payload.CallbackURL, loginURL.Scheme+"://"+loginURL.Host, payload); status != http.StatusOK {
|
|
222
226
|
return fmt.Errorf("callback status %d", status)
|
|
223
227
|
}
|
|
224
228
|
return nil
|
|
@@ -273,7 +277,7 @@ func TestManagerWaitsForCallbackWhenBrowserOpenFails(t *testing.T) {
|
|
|
273
277
|
Source: loginSource,
|
|
274
278
|
CallbackURL: loginURL.Query().Get("callback"),
|
|
275
279
|
}
|
|
276
|
-
if status := sendCallback(t, payload.CallbackURL, config.
|
|
280
|
+
if status := sendCallback(t, payload.CallbackURL, config.DefaultAuthBaseURL, payload); status != http.StatusOK {
|
|
277
281
|
return fmt.Errorf("callback status %d", status)
|
|
278
282
|
}
|
|
279
283
|
return errors.New("browser opener unavailable")
|
|
@@ -347,7 +351,7 @@ func TestManagerReauthenticationPinsAccountAndRequiresRotation(t *testing.T) {
|
|
|
347
351
|
}
|
|
348
352
|
|
|
349
353
|
func TestBrowserFlowRequiresExpectedAccountForForceAndNeverUsesRawUID(t *testing.T) {
|
|
350
|
-
authURL, _ := url.Parse(config.
|
|
354
|
+
authURL, _ := url.Parse(config.DefaultAuthBaseURL)
|
|
351
355
|
deviceID, _ := randomEncoded(bytes.NewReader(bytes.Repeat([]byte{0x22}, deviceIDBytes)), deviceIDBytes)
|
|
352
356
|
if _, err := startBrowserFlow(
|
|
353
357
|
authURL, bytes.NewReader(bytes.Repeat([]byte{0x42}, 2*randomBindingBytes)),
|
|
@@ -378,7 +382,7 @@ func TestBrowserFlowRequiresExpectedAccountForForceAndNeverUsesRawUID(t *testing
|
|
|
378
382
|
}
|
|
379
383
|
|
|
380
384
|
func TestBrowserFlowSendsStoredTokenIDOnNormalLogin(t *testing.T) {
|
|
381
|
-
authURL, _ := url.Parse(config.
|
|
385
|
+
authURL, _ := url.Parse(config.DefaultAuthBaseURL)
|
|
382
386
|
deviceID, _ := randomEncoded(bytes.NewReader(bytes.Repeat([]byte{0x23}, deviceIDBytes)), deviceIDBytes)
|
|
383
387
|
flow, err := startBrowserFlow(
|
|
384
388
|
authURL, bytes.NewReader(bytes.Repeat([]byte{0x44}, 2*randomBindingBytes)),
|
|
@@ -398,7 +402,7 @@ func TestBrowserFlowSendsStoredTokenIDOnNormalLogin(t *testing.T) {
|
|
|
398
402
|
}
|
|
399
403
|
|
|
400
404
|
func TestBrowserFlowAllowsLogoutIdentityTokenWithoutAccountBinding(t *testing.T) {
|
|
401
|
-
authURL, _ := url.Parse(config.
|
|
405
|
+
authURL, _ := url.Parse(config.DefaultAuthBaseURL)
|
|
402
406
|
deviceID, _ := randomEncoded(bytes.NewReader(bytes.Repeat([]byte{0x24}, deviceIDBytes)), deviceIDBytes)
|
|
403
407
|
flow, err := startBrowserFlow(
|
|
404
408
|
authURL, bytes.NewReader(bytes.Repeat([]byte{0x45}, 2*randomBindingBytes)),
|
|
@@ -464,7 +468,7 @@ func TestManagerDerivesExpectedAccountFromDurableScope(t *testing.T) {
|
|
|
464
468
|
Source: loginSource,
|
|
465
469
|
CallbackURL: loginURL.Query().Get("callback"),
|
|
466
470
|
}
|
|
467
|
-
if status := sendCallback(t, payload.CallbackURL, config.
|
|
471
|
+
if status := sendCallback(t, payload.CallbackURL, config.DefaultAuthBaseURL, payload); status != http.StatusOK {
|
|
468
472
|
return fmt.Errorf("callback status %d", status)
|
|
469
473
|
}
|
|
470
474
|
return nil
|
|
@@ -488,7 +492,7 @@ func TestResolveStatusLogoutAndAuthOrigin(t *testing.T) {
|
|
|
488
492
|
cfg.AccessKey = " env-ak "
|
|
489
493
|
cfg.BaseURL = "https://untrusted.invalid"
|
|
490
494
|
manager := NewManager(cfg, WithCredentialStore(store), withClockForTest(func() time.Time { return fixedNow }))
|
|
491
|
-
if manager.authBaseURL.String() != config.
|
|
495
|
+
if manager.authBaseURL.String() != config.DefaultAuthBaseURL {
|
|
492
496
|
t.Fatalf("browser login followed runtime business base URL: %q", manager.authBaseURL)
|
|
493
497
|
}
|
|
494
498
|
if key, err := manager.ResolveAccessKey(context.Background()); err != nil || key != "env-ak" {
|
|
@@ -738,7 +742,7 @@ func callbackOpener(t *testing.T, expiry time.Time, uid, tokenID, accessKey stri
|
|
|
738
742
|
Source: loginSource,
|
|
739
743
|
CallbackURL: loginURL.Query().Get("callback"),
|
|
740
744
|
}
|
|
741
|
-
if status := sendCallback(t, payload.CallbackURL, config.
|
|
745
|
+
if status := sendCallback(t, payload.CallbackURL, config.DefaultAuthBaseURL, payload); status != http.StatusOK {
|
|
742
746
|
return fmt.Errorf("callback status %d", status)
|
|
743
747
|
}
|
|
744
748
|
return nil
|
|
@@ -16,7 +16,7 @@ import (
|
|
|
16
16
|
|
|
17
17
|
func newOriginTestFlow(t *testing.T) (*browserFlow, accessKeyPayload) {
|
|
18
18
|
t.Helper()
|
|
19
|
-
authURL, _ := url.Parse(config.
|
|
19
|
+
authURL, _ := url.Parse(config.DefaultAuthBaseURL)
|
|
20
20
|
deviceID, _ := randomEncoded(bytes.NewReader(bytes.Repeat([]byte{0x21}, deviceIDBytes)), deviceIDBytes)
|
|
21
21
|
flow, err := startBrowserFlow(authURL, bytes.NewReader(bytes.Repeat([]byte{0x42}, 2*randomBindingBytes)), deviceID, "", "", false)
|
|
22
22
|
if err != nil {
|
package/internal/auth/manager.go
CHANGED
|
@@ -46,7 +46,7 @@ func WithCredentialStore(store CredentialStore) ManagerOption {
|
|
|
46
46
|
// API configuration does not affect the browser identity origin.
|
|
47
47
|
func NewManager(cfg *config.Config, options ...ManagerOption) *Manager {
|
|
48
48
|
serviceName := config.DefaultAuthStoreServiceName
|
|
49
|
-
authBaseURL, _ := url.Parse(config.
|
|
49
|
+
authBaseURL, _ := url.Parse(config.DefaultAuthBaseURL)
|
|
50
50
|
manager := &Manager{
|
|
51
51
|
localCredentialsEnabled: true,
|
|
52
52
|
cfg: cfg,
|