breakaway 2.0.0-main.70 → 2.0.0-main.71

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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "breakaway",
3
- "version": "2.0.0-main.70",
3
+ "version": "2.0.0-main.71",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "breakaway",
9
- "version": "2.0.0-main.70",
9
+ "version": "2.0.0-main.71",
10
10
  "license": "FSL-1.1-Apache-2.0",
11
11
  "bin": {
12
12
  "breakaway": "scripts/tasks.mjs"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "breakaway",
3
- "version": "2.0.0-main.70",
3
+ "version": "2.0.0-main.71",
4
4
  "description": "The task board for you and your coding agents: a Cloudflare Worker, its web app, Taskwarrior sync, and the CLI (npx breakaway).",
5
5
  "license": "FSL-1.1-Apache-2.0",
6
6
  "type": "module",
@@ -57,12 +57,21 @@ const ENVELOPE = {
57
57
  container: { changes: ['scale', 'restart'], scales: 'maxInstances' },
58
58
  queue: { changes: ['scale'], scales: 'maxConcurrency' },
59
59
  };
60
+ /**
61
+ * The kinds that decide what reaches a Worker: a route or a custom domain can send a hostname somewhere else, so every
62
+ * change to one asks the owner, whatever a repository's allow rules say (the policy's access guard; BRK-229).
63
+ */
64
+ const ACCESS = ['route', 'custom-domain'];
65
+
60
66
  export const CLOUDFLARE_KINDS = Object.fromEntries(
61
67
  Object.entries(MANAGED).map(([k, settings]) => [
62
68
  k,
63
- ENVELOPE[k]
64
- ? { changes: [...BASE, ...ENVELOPE[k].changes], scales: ENVELOPE[k].scales, settings: [...settings] }
65
- : { changes: [...BASE], settings: [...settings] },
69
+ {
70
+ ...(ENVELOPE[k]
71
+ ? { changes: [...BASE, ...ENVELOPE[k].changes], scales: ENVELOPE[k].scales, settings: [...settings] }
72
+ : { changes: [...BASE], settings: [...settings] }),
73
+ ...(ACCESS.includes(k) ? { access: true } : {}),
74
+ },
66
75
  ]),
67
76
  );
68
77
 
@@ -29,6 +29,8 @@ export const DESIRED_MAX_BYTES = 256 * 1024;
29
29
  export const DESIRED_MAX_RESOURCES = 500;
30
30
  /** How many files one read takes from the folder: an environment per file, and a repository has at most 50. */
31
31
  export const DESIRED_MAX_FILES = 60;
32
+ /** How deep a file may nest: far more than any real one, and well inside the stack. */
33
+ export const MAX_DEPTH = 64;
32
34
 
33
35
  const TOP = ['version', 'provider', 'resources'];
34
36
  const RESOURCE = ['id', 'kind', 'name', 'attrs'];
@@ -115,8 +117,10 @@ export function parseWithLines(text) {
115
117
  i += match[0].length;
116
118
  return JSON.parse(match[0]);
117
119
  };
118
- /** @param {string} path */
119
- const value = (path) => {
120
+ /** @param {string} path @param {number} depth */
121
+ const value = (path, depth = 0) => {
122
+ // A file nested deeper than any real one would overflow the stack: it's refused with its line (BRK-229).
123
+ if (depth > MAX_DEPTH) fail(`it’s nested more than ${MAX_DEPTH} deep`);
120
124
  space();
121
125
  lines.set(path, line);
122
126
  const c = src[i];
@@ -137,7 +141,13 @@ export function parseWithLines(text) {
137
141
  space();
138
142
  if (src[i] !== ':') fail(`expected : after “${key}”, and found ${shown()}`);
139
143
  i += 1;
140
- out[key] = value(path ? `${path}.${key}` : key);
144
+ // Defined, never assigned, so a key like __proto__ is a plain key and never the object's prototype.
145
+ Object.defineProperty(out, key, {
146
+ value: value(path ? `${path}.${key}` : key, depth + 1),
147
+ enumerable: true,
148
+ writable: true,
149
+ configurable: true,
150
+ });
141
151
  space();
142
152
  if (src[i] === ',') {
143
153
  i += 1;
@@ -159,7 +169,7 @@ export function parseWithLines(text) {
159
169
  return out;
160
170
  }
161
171
  for (;;) {
162
- out.push(value(`${path}[${out.length}]`));
172
+ out.push(value(`${path}[${out.length}]`, depth + 1));
163
173
  space();
164
174
  if (src[i] === ',') {
165
175
  i += 1;