@runeditrun/rer 0.2.118 → 0.2.120
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/cli/README.md +40 -0
- package/cli/business/agent-args.mjs +60 -0
- package/cli/business/agent-help.mjs +53 -0
- package/cli/business/agent-output.mjs +38 -0
- package/cli/business/agent-table.mjs +32 -0
- package/cli/business/agent-verbs.mjs +132 -0
- package/cli/business/agent-wait.mjs +28 -0
- package/cli/business/command.mjs +18 -2
- package/cli/business/mcp-bridge.mjs +58 -0
- package/cli/business/questions.mjs +32 -9
- package/cli/business/run-child.mjs +42 -0
- package/cli/business/run-grant.mjs +65 -0
- package/cli/business/run-mask.mjs +21 -0
- package/cli/deploy-command.mjs +13 -7
- package/cli/deploy-inputs.mjs +1 -4
- package/cli/deploy-settings.mjs +15 -9
- package/cli/deploy.mjs +1 -1
- package/cli/managed-data-schema.mjs +2 -0
- package/cli/portability-worker.mjs +3 -1
- package/cli/portability.mjs +1 -1
- package/global/CHANGELOG.md +34 -0
- package/modules/portability/README.md +8 -0
- package/modules/portability/archive-step.mjs +11 -0
- package/modules/portability/export.mjs +34 -25
- package/modules/portability/import-safety.mjs +4 -3
- package/modules/portability/import-staging.mjs +4 -4
- package/modules/portability/import.mjs +14 -5
- package/modules/portability/index.mjs +2 -1
- package/modules/portability/object-inventory.mjs +45 -0
- package/modules/portability/storage.mjs +4 -3
- package/package.json +1 -1
- package/scripts/publish-check/README.md +5 -1
- package/scripts/publish-check/checksum_maps.py +9 -5
- package/scripts/publish-check/hit_location.py +20 -9
- package/scripts/publish-check/json_identity.py +15 -14
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { metadataJson, loadInventory, clearInventory } from './object-inventory.mjs';
|
|
1
2
|
import { canonicalJson } from './hash.mjs';
|
|
2
3
|
// Installed helpers and copied runtimes can coexist in one Worker. Share only
|
|
3
4
|
// constructor-issued identities, so arbitrary objects with code/status fields
|
|
@@ -26,10 +27,10 @@ export async function state(db) {
|
|
|
26
27
|
export async function job(db,id,kind) {
|
|
27
28
|
const row=await statement(db,'SELECT * FROM rer_portability_jobs WHERE id=?',id).first();
|
|
28
29
|
insist(row && (!kind || row.kind===kind),'job_not_found',404);
|
|
29
|
-
return {...row, metadata:JSON.parse(row.metadata)};
|
|
30
|
+
return loadInventory(db,{...row, metadata:JSON.parse(row.metadata)});
|
|
30
31
|
}
|
|
31
32
|
export function save(db,row) {
|
|
32
|
-
return statement(db,'UPDATE rer_portability_jobs SET phase=?,completed=?,metadata=? WHERE id=?',row.phase,row.completed,
|
|
33
|
+
return statement(db,'UPDATE rer_portability_jobs SET phase=?,completed=?,metadata=? WHERE id=?',row.phase,row.completed,metadataJson(row.metadata),row.id);
|
|
33
34
|
}
|
|
34
35
|
export function partStatements(db,id,part) {
|
|
35
36
|
return partQueries(id,part).map(({sql,params})=>statement(db,sql,...params));
|
|
@@ -64,7 +65,7 @@ export function dropCopyStatements(db,row) {
|
|
|
64
65
|
return transferTables(row).map(name=>db.prepare(`DROP TABLE IF EXISTS ${quote(name)}`));
|
|
65
66
|
}
|
|
66
67
|
export function cleanCopyStatements(db,row) {
|
|
67
|
-
return [...dropCopyStatements(db,row),statement(db,'DELETE FROM rer_portability_parts WHERE job=?',row.id),
|
|
68
|
+
return [...dropCopyStatements(db,row),...clearInventory(db,row),statement(db,'DELETE FROM rer_portability_parts WHERE job=?',row.id),
|
|
68
69
|
statement(db,'DELETE FROM rer_portability_segments WHERE job=?',row.id)];
|
|
69
70
|
}
|
|
70
71
|
export async function cleanCopies(db,row) {
|
package/package.json
CHANGED
|
@@ -148,7 +148,11 @@ entry that does not prove, a 40-hex value, a key that names no tree file, or a h
|
|
|
148
148
|
value with no file-name key keeps the native finding. Historical matches use only
|
|
149
149
|
that commit's blobs and working-tree preimages reject linked paths. There is no
|
|
150
150
|
path, filename, hash-value or repository exemption. `hit_location.py` resolves
|
|
151
|
-
the native match's exact bytes for both proofs.
|
|
151
|
+
the native match's exact bytes for both proofs. Gitleaks directory fragments can
|
|
152
|
+
start mid-line without reporting their starting column. The resolver therefore
|
|
153
|
+
locates full matches within the reported LF-delimited lines. An unresolved match
|
|
154
|
+
retains its finding; repeated matches must all satisfy the structural and digest
|
|
155
|
+
proofs above, even if a reported column appears to identify just one of them.
|
|
152
156
|
|
|
153
157
|
`trust_bundle.py` classifies an email match as public CA certificate metadata
|
|
154
158
|
only when all of these hold: the file's path is an artifact listed by a committed
|
|
@@ -35,18 +35,22 @@ class ChecksumMaps:
|
|
|
35
35
|
def matches(self, data, hit):
|
|
36
36
|
if hit.get('RuleID') not in ('generic-api-key', 'hex-api-key'):
|
|
37
37
|
return False
|
|
38
|
+
spans = match_spans(data, hit)
|
|
39
|
+
if not spans:
|
|
40
|
+
return False
|
|
38
41
|
entries = list(ENTRY.finditer(data))
|
|
39
|
-
for left, right in
|
|
42
|
+
for left, right in spans:
|
|
40
43
|
keyed = [i for i, e in enumerate(entries)
|
|
41
44
|
if left <= e.start('digest') and e.end('digest') <= right
|
|
42
45
|
and e.group('digest').decode() == hit.get('Secret')]
|
|
43
46
|
if len(keyed) != 1:
|
|
44
|
-
|
|
47
|
+
return False
|
|
45
48
|
first = last = keyed[0]
|
|
46
49
|
while first > 0 and SEPARATOR.fullmatch(data, entries[first - 1].end(), entries[first].start()):
|
|
47
50
|
first -= 1
|
|
48
51
|
while last + 1 < len(entries) and SEPARATOR.fullmatch(data, entries[last].end(), entries[last + 1].start()):
|
|
49
52
|
last += 1
|
|
50
|
-
|
|
51
|
-
e.group('digest').decode()) for e in entries[first:last + 1])
|
|
52
|
-
|
|
53
|
+
if not all(self.names_file((e.group('quoted') or e.group('bare')).decode('utf-8', 'replace'),
|
|
54
|
+
e.group('digest').decode()) for e in entries[first:last + 1]):
|
|
55
|
+
return False
|
|
56
|
+
return True
|
|
@@ -1,18 +1,29 @@
|
|
|
1
|
-
"""Resolve a native Gitleaks hit to
|
|
1
|
+
"""Resolve a native Gitleaks hit to its possible full-match byte spans."""
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
def match_spans(data, hit):
|
|
5
|
-
lines = data.splitlines(keepends=True)
|
|
6
5
|
try:
|
|
6
|
+
# Gitleaks counts LF bytes, not Python's broader set of line breaks.
|
|
7
|
+
lines = data.split(b'\n')
|
|
7
8
|
first, last = hit['StartLine'] - 1, hit['EndLine'] - 1
|
|
8
9
|
if not (0 <= first <= last < len(lines)):
|
|
9
10
|
return []
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
match = hit['Match'].encode('utf-8')
|
|
12
|
+
if not match:
|
|
13
|
+
return []
|
|
14
|
+
left = sum(len(line) + 1 for line in lines[:first])
|
|
15
|
+
right = left + sum(len(line) + 1 for line in lines[first:last + 1])
|
|
16
|
+
# Directory fragments can start mid-line. Their columns are relative
|
|
17
|
+
# to that fragment, whose starting column is absent from the report.
|
|
18
|
+
# Later fragment lines also count the preceding LF in their columns.
|
|
19
|
+
# Bind the full match within the reported lines instead. Even an
|
|
20
|
+
# apparently exact column cannot disambiguate repeated occurrences.
|
|
21
|
+
# Callers must prove every candidate, never just the first one.
|
|
22
|
+
spans = []
|
|
23
|
+
start = data.find(match, left, right)
|
|
24
|
+
while start >= 0:
|
|
25
|
+
spans.append((start, start + len(match)))
|
|
26
|
+
start = data.find(match, start + 1, right)
|
|
27
|
+
return spans
|
|
17
28
|
except (KeyError, TypeError, IndexError, UnicodeError):
|
|
18
29
|
return []
|
|
@@ -80,19 +80,20 @@ class Document:
|
|
|
80
80
|
secret = hit.get('Secret', '').encode('utf-8')
|
|
81
81
|
if not secret:
|
|
82
82
|
return False
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
spans = match_spans(self.data, hit)
|
|
84
|
+
if not spans:
|
|
85
|
+
return False
|
|
86
|
+
allowed = [self.spans[pointer] for pointer in pointers if pointer in self.spans]
|
|
87
|
+
for left, right in spans:
|
|
85
88
|
start = self.data.find(secret, left, right)
|
|
86
89
|
if start < 0 or self.data.find(secret, start + 1, right) >= 0:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
located.add((a, b))
|
|
98
|
-
return len(located) == 1
|
|
90
|
+
return False
|
|
91
|
+
# Location alone is not proof. Every possible native occurrence
|
|
92
|
+
# must bind its captured bytes (even a truncated capture) to an
|
|
93
|
+
# exact unescaped JSON value at a proved pointer. An identical
|
|
94
|
+
# credential elsewhere on the line therefore retains the finding.
|
|
95
|
+
if not any(a + 1 <= start and start + len(secret) <= b - 1
|
|
96
|
+
and self.data[a + 1:b - 1] == value.encode('ascii')
|
|
97
|
+
for a, b, value in allowed):
|
|
98
|
+
return False
|
|
99
|
+
return True
|