@automattic/vip 4.0.10 → 4.0.11

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.
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.RECHALLENGE_VERSION = exports.ELEVATED_PERMISSION_ERROR_CODE = exports.CLIENT_TYPE = void 0;
5
+ const ELEVATED_PERMISSION_ERROR_CODE = exports.ELEVATED_PERMISSION_ERROR_CODE = 'elevated-permission-required';
6
+ const RECHALLENGE_VERSION = exports.RECHALLENGE_VERSION = 'v2';
7
+ const CLIENT_TYPE = exports.CLIENT_TYPE = 'cli';
8
+
9
+ /** Shape of `errors[0].extensions.rechallenge` from the API. */
10
+
11
+ /** Response from POST {createSessionPath}. */
12
+
13
+ /** Response from GET {statusPathTemplate}. */
14
+
15
+ /** Response from POST {exchangePathTemplate}. */
package/dist/lib/token.js CHANGED
@@ -4,7 +4,7 @@ exports.__esModule = true;
4
4
  exports.default = exports.SERVICE = void 0;
5
5
  var _jwtDecode = require("jwt-decode");
6
6
  var _nodeCrypto = require("node:crypto");
7
- var _api = require("./api");
7
+ var _constants = require("./api/constants");
8
8
  var _keychain = require("./keychain");
9
9
  // Config
10
10
  const SERVICE = exports.SERVICE = 'vip-go-cli';
@@ -92,8 +92,8 @@ class Token {
92
92
  }
93
93
  static getServiceName(modifier = '') {
94
94
  let service = SERVICE;
95
- if (_api.PRODUCTION_API_HOST !== _api.API_HOST) {
96
- const sanitized = _api.API_HOST.replace(/[^a-z0-9]/gi, '-');
95
+ if (_constants.PRODUCTION_API_HOST !== _constants.API_HOST) {
96
+ const sanitized = _constants.API_HOST.replace(/[^a-z0-9]/gi, '-');
97
97
  service = `${SERVICE}:${sanitized}`;
98
98
  }
99
99
  return `${service}${modifier}`;
package/docs/SETUP.md CHANGED
@@ -63,7 +63,7 @@ npm run build
63
63
 
64
64
  ## Usage
65
65
 
66
- The software runs as standalone CLI and relies on environmental variables for configuration and a few configuration files.
66
+ The software runs as standalone CLI and relies on environment variables for configuration and a few configuration files.
67
67
 
68
68
  ### Starting up locally
69
69
 
@@ -85,15 +85,15 @@ By default, we record information about the usage of this tool using an in-house
85
85
 
86
86
  Install the software locally, run and follow the instructions to configure the access token.
87
87
 
88
- ### Environmental variables
88
+ ### Environment variables
89
89
 
90
- #### Configuring environmental variables
90
+ #### Configuring environment variables
91
91
 
92
- Environmental variables are configured in the shell. Use normal shell commands to set them.
92
+ Environment variables are configured in the shell. Use normal shell commands to set them.
93
93
 
94
- #### List of environmental variables
94
+ #### List of environment variables
95
95
 
96
- This application uses environmental variables for vital configuration information. Find a partial list below.
96
+ This application uses environment variables for vital configuration information. Find a partial list below.
97
97
 
98
98
  TODO: Update description of the variables.
99
99
 
@@ -108,6 +108,7 @@ TODO: Update description of the variables.
108
108
  - `HTTP_PROXY`:
109
109
  - `NO_PROXY`:
110
110
  - `VIP_PROXY`: [For internal VIP use](TESTING.md#local-testing).
111
+ - `VIP_RECHALLENGE_WAIT`: set to `1` to print the verification URL and wait for rechallenge completion on another device.
111
112
  - `VIP_USE_SYSTEM_PROXY`:
112
113
  - `WPVIP_DEPLOY_TOKEN`: For use with `vip app deploy` on sites that have custom deploys enabled.
113
114
 
@@ -0,0 +1,87 @@
1
+ ---
2
+ status: accepted
3
+ date: 2026-07-01
4
+ ---
5
+
6
+ # Accept Operation-Scoped Elevated Token Reuse
7
+
8
+ ## Context and Problem Statement
9
+
10
+ Step-up rechallenge currently issues elevated tokens scoped by GraphQL `requestedOperation` (mutation field name or operation domain), not by app, environment, or payload details.
11
+
12
+ The team must decide whether this behavior should be treated as a defect that requires per-resource rebinding, or as intended product behavior.
13
+
14
+ Primary workflow motivation: users may need to perform the same protected operation repeatedly across many targets, such as adding many domains to multiple environments. Requiring a new rechallenge for every target would add significant friction.
15
+
16
+ ## Decision Drivers
17
+
18
+ - Reduce repeated operator friction in bulk workflows.
19
+ - Preserve baseline authorization enforcement at resolver level.
20
+ - Keep step-up semantics understandable: user confirms an operation class, not one specific payload.
21
+ - Avoid unnecessary complexity in token minting, validation, and client caching.
22
+ - Keep room for future hardening if product intent changes.
23
+
24
+ ## Considered Options
25
+
26
+ - Option 1: Keep operation-scoped elevated token reuse.
27
+ - Option 2: Require per-resource scoped elevated tokens (bind to app/environment/payload).
28
+ - Option 3: Disable reuse and force fresh rechallenge on every protected mutation.
29
+
30
+ ## Decision Outcome
31
+
32
+ Chosen option: Option 1, keep operation-scoped elevated token reuse.
33
+
34
+ Accepted behavior: a valid elevated token for a protected operation may be reused across app/environment targets while token validity holds.
35
+
36
+ This is intentional because it removes repeated rechallenge prompts in high-volume administrative workflows, including adding many domains across multiple environments.
37
+
38
+ ### Consequences
39
+
40
+ Good, because:
41
+
42
+ - Bulk operations become materially faster and less error-prone for users.
43
+ - Behavior aligns with current implementation and avoids disruptive contract changes.
44
+ - Security posture remains layered: resolver authorization still enforces target access for the authenticated user.
45
+
46
+ Bad, because:
47
+
48
+ - Some readers may incorrectly assume step-up approval is resource-bound.
49
+ - If future product intent requires per-resource confirmation, this decision will need to be superseded and implementation changed.
50
+
51
+ Neutral, because:
52
+
53
+ - This decision does not change which mutations are protected; it defines scope behavior once a mutation is protected.
54
+
55
+ ### Confirmation
56
+
57
+ The decision is considered correctly implemented when all of the following hold:
58
+
59
+ - Rechallenge token scope is derived from `requestedOperation`.
60
+ - Elevated token validation checks operation/operationDomain compatibility.
61
+ - Resolver-level authorization remains enforced independently of elevated token scope.
62
+ - Documentation and support guidance describe operation-scoped reuse as intended behavior.
63
+
64
+ ## Pros and Cons of the Options
65
+
66
+ ### Option 1: Keep operation-scoped elevated token reuse
67
+
68
+ - Good, because it optimizes repeated protected actions across many targets.
69
+ - Good, because it matches existing VIP CLI and GOOP behavior.
70
+ - Bad, because it may be perceived as broader than least-privilege if readers expect resource scoping.
71
+
72
+ ### Option 2: Require per-resource scoped elevated tokens
73
+
74
+ - Good, because it enforces tighter binding between step-up and target resource.
75
+ - Bad, because it increases user friction and rechallenge frequency in bulk workflows.
76
+ - Bad, because it introduces higher implementation and rollout complexity.
77
+
78
+ ### Option 3: Disable reuse and force fresh rechallenge every time
79
+
80
+ - Good, because the model is simple and strict.
81
+ - Bad, because it has the worst user experience for repetitive operations.
82
+ - Bad, because it provides limited practical security gain beyond existing authorization checks.
83
+
84
+ ## More Information
85
+
86
+ - Source validation and rationale: https://github.com/Automattic/vip-cli/pull/2869
87
+ - Revisit trigger: if product/security policy explicitly requires per-resource step-up approval, supersede this ADR with a new decision and migration plan.
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@automattic/vip",
3
- "version": "4.0.10",
3
+ "version": "4.0.11",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@automattic/vip",
9
- "version": "4.0.10",
9
+ "version": "4.0.11",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
- "@apollo/client": "4.2.3",
13
+ "@apollo/client": "4.2.5",
14
14
  "@automattic/vip-search-replace": "^2.0.0",
15
15
  "@json2csv/plainjs": "^7.0.3",
16
16
  "@wwa/single-line-log": "^1.1.4",
@@ -145,9 +145,9 @@
145
145
  }
146
146
  },
147
147
  "node_modules/@apollo/client": {
148
- "version": "4.2.3",
149
- "resolved": "https://registry.npmjs.org/@apollo/client/-/client-4.2.3.tgz",
150
- "integrity": "sha512-+auRYBXow2v7cT+wKzvjyMyyEojq+G7Sf80vIR57rtEPcxRFuMXuU9IKjwxZ3muclUgdGKwZXNeuki+g0GabgQ==",
148
+ "version": "4.2.5",
149
+ "resolved": "https://registry.npmjs.org/@apollo/client/-/client-4.2.5.tgz",
150
+ "integrity": "sha512-1VyJ4eAriUFCfK2Btc09PQtxxgrnmoO1Dbg2A1O7MQbsK1ri5GSWBzc7/P6A0KJrkWll/Ojf9HC6ptIET8yv3g==",
151
151
  "license": "MIT",
152
152
  "dependencies": {
153
153
  "@graphql-typed-document-node/core": "^3.1.1",
@@ -4594,9 +4594,9 @@
4594
4594
  "license": "MIT"
4595
4595
  },
4596
4596
  "node_modules/@types/node": {
4597
- "version": "26.0.0",
4598
- "resolved": "https://registry.npmjs.org/@types/node/-/node-26.0.0.tgz",
4599
- "integrity": "sha512-vf2YFi1iY9lHGwNJMs01biZFbKJkrZR1T6/MlzjhJLPdntOHLhTrDSnSVcdtvjihi4VQNlrFRIxLsDBlQpAipA==",
4597
+ "version": "26.1.0",
4598
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-26.1.0.tgz",
4599
+ "integrity": "sha512-O0A1G3xPGy4w7AgQdAQYUlQ+BKk2Oovw8eRpofyp5KdBZULnbe+WqaOVNrm705SHphCiG4XHsACrSmPu1f+Kgw==",
4600
4600
  "license": "MIT",
4601
4601
  "dependencies": {
4602
4602
  "undici-types": "~8.3.0"
@@ -6914,9 +6914,9 @@
6914
6914
  }
6915
6915
  },
6916
6916
  "node_modules/dockerode": {
6917
- "version": "5.0.0",
6918
- "resolved": "https://registry.npmjs.org/dockerode/-/dockerode-5.0.0.tgz",
6919
- "integrity": "sha512-C52mvJ+7lcyhWNfrzVfFsbTrBfy/ezE9FGEYLpu17FUeBcCkxERk9nN7uDl/478ynDiQ4U+5DbQC2vENHkVEtQ==",
6917
+ "version": "5.0.1",
6918
+ "resolved": "https://registry.npmjs.org/dockerode/-/dockerode-5.0.1.tgz",
6919
+ "integrity": "sha512-avsq/xk4YPIrn0CgleX5bjT9Y8IT1p9PxrNQ++RBQ2WEyFfHCTDsT9kmyxz+H/axnjAwg8wJWEIuPGOUuNupiA==",
6920
6920
  "license": "Apache-2.0",
6921
6921
  "dependencies": {
6922
6922
  "@balena/dockerignore": "^1.0.2",
@@ -11418,9 +11418,9 @@
11418
11418
  "license": "MIT"
11419
11419
  },
11420
11420
  "node_modules/js-yaml": {
11421
- "version": "5.2.0",
11422
- "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.2.0.tgz",
11423
- "integrity": "sha512-YeLUMlvR4Ou1B119LIaM0r65JvbOBooJDc9yEu0dClb/uSC5P4FrLU8OCCz/HXWvtPoIrR0dRzABTjo1sTN9Bw==",
11421
+ "version": "5.2.1",
11422
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.2.1.tgz",
11423
+ "integrity": "sha512-zfLtNfQqxVqq3uaTqSkh4x4hZw3KHobGUA0fJUj4wawW8bsQLTVqpHdXSIzidh7o+4lEW36tANuAGdaFx6Zgnw==",
11424
11424
  "funding": [
11425
11425
  {
11426
11426
  "type": "github",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip",
3
- "version": "4.0.10",
3
+ "version": "4.0.11",
4
4
  "description": "The VIP Javascript library & CLI",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -27,6 +27,10 @@
27
27
  "vip-config-software-update": "dist/bin/vip-config-software-update.js",
28
28
  "vip-db": "dist/bin/vip-db.js",
29
29
  "vip-db-phpmyadmin": "dist/bin/vip-db-phpmyadmin.js",
30
+ "vip-defensive-mode": "dist/bin/vip-defensive-mode.js",
31
+ "vip-defensive-mode-configure": "dist/bin/vip-defensive-mode-configure.js",
32
+ "vip-defensive-mode-disable": "dist/bin/vip-defensive-mode-disable.js",
33
+ "vip-defensive-mode-enable": "dist/bin/vip-defensive-mode-enable.js",
30
34
  "vip-dev-env": "dist/bin/vip-dev-env.js",
31
35
  "vip-dev-env-create": "dist/bin/vip-dev-env-create.js",
32
36
  "vip-dev-env-update": "dist/bin/vip-dev-env-update.js",
@@ -141,7 +145,7 @@
141
145
  "typescript": "^6.0.2"
142
146
  },
143
147
  "dependencies": {
144
- "@apollo/client": "4.2.3",
148
+ "@apollo/client": "4.2.5",
145
149
  "@automattic/vip-search-replace": "^2.0.0",
146
150
  "@json2csv/plainjs": "^7.0.3",
147
151
  "@wwa/single-line-log": "^1.1.4",