You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/configuration.md
+91-51Lines changed: 91 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,73 +1,51 @@
1
1
# Configuration
2
2
3
-
The B2C CLI supports multiple authentication methods and configuration options.
3
+
The B2C CLI automatically detects and uses available credentials. You can provide credentials via CLI flags, environment variables, or configuration files.
4
4
5
5
::: tip
6
6
For detailed setup instructions including Account Manager API client creation and OCAPI configuration, see the [Authentication Setup](./authentication) guide.
7
7
:::
8
8
9
-
## Authentication Methods
9
+
## CLI Flags
10
10
11
-
The CLI supports multiple auth methods that can be specified via the `--auth-methods` flag:
11
+
### OAuth (SCAPI/OCAPI)
12
12
13
-
-`client-credentials` - OAuth 2.0 client credentials flow (requires client ID and secret)
14
-
-`implicit` - OAuth 2.0 implicit flow (requires client ID only, opens browser for login)
OAuth is required for SCAPI and OCAPI operations (jobs, sites, SLAS, etc.) and can also be used for WebDAV operations when basic auth credentials are not provided.
17
14
18
-
### Specifying Auth Methods
19
-
20
-
You can specify allowed auth methods in priority order using comma-separated values or multiple flags:
For development and testing, you can use basic authentication with Business Manager credentials:
39
+
Basic authentication uses your B2C instance username and access key. This method is only used for WebDAV operations (code deployment, file uploads, log access).
See [Configure WebDAV File Access](https://help.salesforce.com/s/articleView?id=cc.b2c_account_manager_sso_use_webdav_file_access.htm&type=5) for instructions on setting up your access key.
71
49
72
50
## Environment Variables
73
51
@@ -92,10 +70,12 @@ You can create a `dw.json` file to store instance settings. The CLI searches for
|`oauth-scopes`| OAuth scopes (array of strings) |
130
+
|`auth-methods`| Authentication methods in priority order (array of strings) |
131
+
|`shortCode`| SCAPI short code. Also accepts `short-code` or `scapi-shortcode`. |
132
+
133
+
::: tip MRT Configuration
134
+
Managed Runtime API key is not stored in `dw.json`. It is loaded from `~/.mobify`. You can specify `mrtProject` and `mrtEnvironment` in `dw.json` for project/environment selection.
135
+
:::
136
+
137
+
For multi-instance configurations, each config object also supports:
138
+
139
+
| Field | Description |
140
+
|-------|-------------|
141
+
|`name`| Instance name for selection with `-i`/`--instance`|
142
+
|`active`| Set to `true` to use this config by default |
149
143
150
144
### Resolution Priority
151
145
@@ -179,6 +173,52 @@ If any field in a group is set by a higher-priority source, all fields in that g
179
173
When you explicitly specify a hostname that differs from the `dw.json` hostname, the CLI ignores all other values from `dw.json` and only uses your explicit overrides. This prevents accidentally using credentials from one instance with a different server.
180
174
:::
181
175
176
+
## MRT API Key
177
+
178
+
Managed Runtime (MRT) commands use an API key for authentication. The API key is resolved in this order:
179
+
180
+
1.`--api-key` flag
181
+
2.`SFCC_MRT_API_KEY` environment variable
182
+
3.`~/.mobify` config file
183
+
184
+
The `~/.mobify` file format:
185
+
186
+
```json
187
+
{
188
+
"api_key": "your-mrt-api-key"
189
+
}
190
+
```
191
+
192
+
When using the `--cloud-origin` flag to specify a different MRT endpoint, the CLI looks for `~/.mobify--{hostname}` instead. For example, `--cloud-origin https://custom.example.com` loads from `~/.mobify--custom.example.com`.
193
+
194
+
## Overriding Authentication Behavior
195
+
196
+
By default, the CLI automatically detects available credentials and tries authentication methods in this order: `client-credentials`, then `implicit`. You can override this behavior to control which methods are used.
197
+
198
+
### Available Auth Methods
199
+
200
+
-`client-credentials` - OAuth 2.0 client credentials flow (requires client ID and secret). Used for SCAPI/OCAPI and WebDAV.
201
+
-`implicit` - OAuth 2.0 implicit flow (requires client ID only, opens browser for login). Used for SCAPI/OCAPI and WebDAV.
202
+
-`basic` - Basic authentication with username and access key. Used for WebDAV operations only.
203
+
-`api-key` - API key authentication. Used for MRT commands only.
204
+
205
+
### Specifying Auth Methods
206
+
207
+
You can specify allowed auth methods in priority order using comma-separated values or multiple flags:
This page covers security practices used in the B2C Developer Tooling project, with a focus on supply chain security.
4
+
5
+
## Supply Chain Security
6
+
7
+
The JavaScript/Node.js ecosystem is particularly vulnerable to supply chain attacks due to the large number of transitive dependencies in typical projects. This project uses several pnpm features to mitigate these risks.
8
+
9
+
### Minimum Release Age
10
+
11
+
New package versions are quarantined for 48 hours before they can be installed:
12
+
13
+
```yaml
14
+
# pnpm-workspace.yaml
15
+
minimumReleaseAge: 2880# minutes (48 hours)
16
+
```
17
+
18
+
This provides a buffer period during which:
19
+
- Malicious packages can be detected and removed from npm
20
+
- Security researchers can identify and report compromised packages
21
+
- The community can flag suspicious updates
22
+
23
+
If a package update is urgent, it can be added to the exclusion list:
24
+
25
+
```yaml
26
+
minimumReleaseAgeExclude:
27
+
- some-urgent-package
28
+
```
29
+
30
+
### Trust Policy
31
+
32
+
Dependency downgrades are prevented to protect against downgrade attacks:
33
+
34
+
```yaml
35
+
# pnpm-workspace.yaml
36
+
trustPolicy: no-downgrade
37
+
```
38
+
39
+
This ensures that once a package version is installed, it cannot be replaced with an older (potentially vulnerable) version without explicit action.
40
+
41
+
### Restricting Build Scripts
42
+
43
+
Only explicitly allowed packages can run build scripts (install/postinstall hooks):
44
+
45
+
```yaml
46
+
# pnpm-workspace.yaml
47
+
onlyBuiltDependencies:
48
+
- unrs-resolver
49
+
- yarn
50
+
```
51
+
52
+
Build scripts are a common attack vector because they execute arbitrary code during installation. By default, pnpm blocks all build scripts except for packages in this allowlist.
53
+
54
+
When adding a new dependency that requires build scripts:
55
+
1. Verify the package is legitimate and actively maintained
56
+
2. Review what the build script does
57
+
3. Add it to `onlyBuiltDependencies` if necessary
58
+
59
+
## Best Practices
60
+
61
+
### For Contributors
62
+
63
+
- Review dependency updates carefully, especially for packages with build scripts
64
+
- Be cautious when adding new dependencies
65
+
- Prefer packages with minimal transitive dependencies
66
+
- Check package health on npm before adding (download counts, maintenance activity, known vulnerabilities)
67
+
68
+
### For Users
69
+
70
+
- Keep the CLI updated to receive security patches
71
+
- Review the `pnpm-workspace.yaml` settings if you fork or modify this project
72
+
- Consider using similar protections in your own projects
0 commit comments