@commonlyai/cli 0.1.311 → 0.1.312

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commonlyai/cli",
3
- "version": "0.1.311",
3
+ "version": "0.1.312",
4
4
  "license": "Apache-2.0",
5
5
  "description": "The Commonly CLI — connect agents, manage pods, iterate fast",
6
6
  "type": "module",
@@ -323,13 +323,18 @@ const subpath = (path) => `(subpath "${escapeSbplString(path)}")`;
323
323
  // inside a directory of that name: a real project keeps one beside each
324
324
  // package, not only at its root (TASK-294). An SBPL regex literal takes no
325
325
  // escapes, so a path it cannot hold is refused.
326
- const envFilesUnder = (workspace) => {
326
+ const regexUnder = (workspace, tail) => {
327
327
  if (/["\r\n]/.test(workspace)) {
328
328
  throw new Error('Seatbelt workspacePath must not contain a quote or a line break');
329
329
  }
330
330
  const pattern = workspace.replace(/[\\^$.|?*+()[\]{}]/g, '\\$&');
331
- return `(regex #"^${pattern}/(.*/)?\\.env([./].*)?$")`;
331
+ return `(regex #"^${pattern}/(.*/)?${tail}")`;
332
332
  };
333
+ const envFilesUnder = (workspace) => regexUnder(workspace, '\\.env([./].*)?$');
334
+ // Every .npmrc and .yarnrc* (.yarnrc, .yarnrc.yml) under the workspace, at any
335
+ // depth, and everything inside a directory of that name: they hold registry
336
+ // tokens. Opt-in, since a seat that installs packages reads its project's.
337
+ const registryConfigUnder = (workspace) => regexUnder(workspace, '(\\.npmrc|\\.yarnrc[^/]*)(/.*)?$');
333
338
 
334
339
  const assertAbsolutePath = (path, label) => {
335
340
  if (!path || !isAbsolute(path)) {
@@ -459,6 +464,10 @@ export const buildSeatbeltProfile = ({
459
464
  // Folders no rule here may let the jail write, however a grant above is
460
465
  // shaped: a workspace seat's own record of its folder (F200).
461
466
  denyWritePaths = [],
467
+ // Deny .npmrc and .yarnrc* under the workspace, as .env files are: for a
468
+ // process that only reads the workspace and installs nothing, such as a
469
+ // public Codex seat's git tool.
470
+ denyRegistryConfig = false,
462
471
  }) => {
463
472
  for (const [path, label] of [
464
473
  [workspacePath, 'workspacePath'],
@@ -590,6 +599,7 @@ export const buildSeatbeltProfile = ({
590
599
  `(deny file-read* file-write* ${subpath(join(resolvedWorkspace, '.commonly'))})`,
591
600
  `(deny file-read* file-write* ${subpath(join(resolvedWorkspace, '.codex'))})`,
592
601
  `(deny file-read* file-write* ${envFilesUnder(resolvedWorkspace)})`,
602
+ denyRegistryConfig ? `(deny file-read* file-write* ${registryConfigUnder(resolvedWorkspace)})` : '',
593
603
  readOnlyWorkspaceRules,
594
604
  // After every allow above, so a workspace that contained one of these
595
605
  // folders still could not write it (later rules win).
@@ -53,8 +53,9 @@ export const workspaceGitAttachment = (root, { git = resolveRealGit() } = {}) =>
53
53
  // For a public Codex seat. Codex starts its MCP servers outside the seat's
54
54
  // permission profile, so a bare server would run git as the operator, with the
55
55
  // network on and every file the profile denies in reach. This one runs under a
56
- // Seatbelt of its own: the workspace read-only, no network, its code and git
57
- // readable, and nothing writable but `stateDir`, an empty folder of its own (not
56
+ // Seatbelt of its own: the workspace read-only with its .env, .npmrc and
57
+ // .yarnrc* files unreadable, as the profile has them, no network, its code and
58
+ // git readable, and nothing writable but `stateDir`, an empty folder of its own (not
58
59
  // the folder that holds the seat's credential). macOS only: elsewhere there is
59
60
  // no wrapper here yet, so the seat gets no tool rather than an unconfined one.
60
61
  export const confinedWorkspaceGitServer = (root, {
@@ -74,6 +75,7 @@ export const confinedWorkspaceGitServer = (root, {
74
75
  readOnlyPaths: attachment.readPaths,
75
76
  network: 'loopback',
76
77
  processInfo: 'self',
78
+ denyRegistryConfig: true,
77
79
  });
78
80
  return { ...attachment.server, command };
79
81
  };