react-native-update-cli 2.27.1 → 2.28.0
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,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replace the parts of a detail line that can only come from the user's code:
|
|
3
|
+
* quoted string operands (property names, string literals), function names,
|
|
4
|
+
* and filesystem paths that reach the line through a compiler's stderr. What
|
|
5
|
+
* stays is the shape a fix is reasoned about -- opcodes, registers, counts,
|
|
6
|
+
* literal kinds -- plus each redacted value's length and character class.
|
|
7
|
+
*
|
|
8
|
+
* This is redaction by class, not a proof: it covers the shapes the comparison
|
|
9
|
+
* and the compilers are known to emit. Anything that arrives in an unknown
|
|
10
|
+
* shape still has its paths and quoted runs stripped, so a new detail format
|
|
11
|
+
* cannot silently start leaking identifiers.
|
|
12
|
+
*/
|
|
13
|
+
export declare function redactFailureDetail(detail: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* The grouping key: a redacted detail with everything that varies between two
|
|
16
|
+
* occurrences of the same defect removed -- registers, ids, offsets, labels,
|
|
17
|
+
* counts and the redaction tokens themselves. Sixteen bytes; the server stores
|
|
18
|
+
* it as 32 hex characters.
|
|
19
|
+
*/
|
|
20
|
+
export declare function failureFingerprint(detail: string): string;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.redactFailureDetail = redactFailureDetail;
|
|
4
|
+
exports.failureFingerprint = failureFingerprint;
|
|
5
|
+
/**
|
|
6
|
+
* One implementation of the failure fingerprint, shared by everything that
|
|
7
|
+
* groups the same failure: the version/create report, the fuzzer's dedup of
|
|
8
|
+
* its findings, and (later) the replay of the stored corpus. Two
|
|
9
|
+
* implementations would mean the counts behind "how often does this happen"
|
|
10
|
+
* are fiction, so callers import from here rather than writing their own
|
|
11
|
+
* regexes.
|
|
12
|
+
*
|
|
13
|
+
* Redaction is the other half. A detail line carries whatever hermesc printed,
|
|
14
|
+
* which is the user's own code: the first rejection seen in production named
|
|
15
|
+
* the property `promotionRequestItemId`. Details travel to the server, into
|
|
16
|
+
* issue lists and -- once the fix loop runs -- into public pull requests and CI
|
|
17
|
+
* fixtures, so the identifiers are replaced by tokens *before* the report
|
|
18
|
+
* leaves the machine. The local console keeps the unredacted text: that is
|
|
19
|
+
* where the name is actually useful.
|
|
20
|
+
*/
|
|
21
|
+
const node_crypto_1 = require("node:crypto");
|
|
22
|
+
const sha = (value) => (0, node_crypto_1.createHash)('sha256').update(value).digest('hex');
|
|
23
|
+
/** stable stand-in for one redacted value; the same input always yields it */
|
|
24
|
+
const token = (kind, value) => `${kind}#${sha(value).slice(0, 8)}`;
|
|
25
|
+
/**
|
|
26
|
+
* Replace the parts of a detail line that can only come from the user's code:
|
|
27
|
+
* quoted string operands (property names, string literals), function names,
|
|
28
|
+
* and filesystem paths that reach the line through a compiler's stderr. What
|
|
29
|
+
* stays is the shape a fix is reasoned about -- opcodes, registers, counts,
|
|
30
|
+
* literal kinds -- plus each redacted value's length and character class.
|
|
31
|
+
*
|
|
32
|
+
* This is redaction by class, not a proof: it covers the shapes the comparison
|
|
33
|
+
* and the compilers are known to emit. Anything that arrives in an unknown
|
|
34
|
+
* shape still has its paths and quoted runs stripped, so a new detail format
|
|
35
|
+
* cannot silently start leaking identifiers.
|
|
36
|
+
*/
|
|
37
|
+
function redactFailureDetail(detail) {
|
|
38
|
+
return (detail
|
|
39
|
+
// Paths first: a compiler's stderr reaches the line with them, and
|
|
40
|
+
// running this pass after the others would eat the `/<length>` suffix
|
|
41
|
+
// the string pass writes.
|
|
42
|
+
.replace(/(?:\.{0,2}\/)[^\s:,)"']*/g, (path) => {
|
|
43
|
+
const ext = /\.([A-Za-z0-9]+)$/.exec(path);
|
|
44
|
+
return `${token('path', path)}${ext ? `.${ext[1]}` : ''}`;
|
|
45
|
+
})
|
|
46
|
+
// Function<name>(…) headers, including the raw-audit variants
|
|
47
|
+
.replace(/\b(Function|NCFunction|Constructor)<([^>]*)>/g, (_all, kind, name) => `${kind}<${name ? token('fn', name) : ''}>`)
|
|
48
|
+
// Quoted operands. hermesc does not escape quotes inside strings, so the
|
|
49
|
+
// run is taken as-is up to the next quote; a stray tail keeps whatever
|
|
50
|
+
// the earlier passes left rather than being reconstructed.
|
|
51
|
+
.replace(/"([^"\n]*)"/g, (_all, value) => {
|
|
52
|
+
const units = Array.from(value);
|
|
53
|
+
const ascii = units.every((char) => char.charCodeAt(0) < 0x80);
|
|
54
|
+
return `"${token('str', value)}/${units.length}${ascii ? '' : '/u16'}"`;
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The grouping key: a redacted detail with everything that varies between two
|
|
59
|
+
* occurrences of the same defect removed -- registers, ids, offsets, labels,
|
|
60
|
+
* counts and the redaction tokens themselves. Sixteen bytes; the server stores
|
|
61
|
+
* it as 32 hex characters.
|
|
62
|
+
*/
|
|
63
|
+
function failureFingerprint(detail) {
|
|
64
|
+
const shape = redactFailureDetail(detail)
|
|
65
|
+
.replace(/#[0-9a-f]{8}/g, '#')
|
|
66
|
+
.replace(/\br\d+\b/g, 'r')
|
|
67
|
+
.replace(/\bL\d+\b/g, 'L')
|
|
68
|
+
.replace(/\d+/g, 'N')
|
|
69
|
+
.replace(/\s+/g, ' ')
|
|
70
|
+
.trim();
|
|
71
|
+
return sha(shape).slice(0, 32);
|
|
72
|
+
}
|
|
@@ -40,8 +40,17 @@ export interface HermesBaseMeta {
|
|
|
40
40
|
baseHash: string | null;
|
|
41
41
|
/** absent (never null) when the bundle step did not run hermesc */
|
|
42
42
|
hermesBaseOutcome?: HermesBaseOutcome;
|
|
43
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* First difference / failure reason, redacted (see redactFailureDetail):
|
|
45
|
+
* the raw text carries the user's own property and string names. Absent
|
|
46
|
+
* when there is none.
|
|
47
|
+
*/
|
|
44
48
|
hermesBaseDetail?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Grouping key for the same defect across builds and apps, computed from
|
|
51
|
+
* the unredacted detail. Absent with the detail.
|
|
52
|
+
*/
|
|
53
|
+
hermesBaseFingerprint?: string;
|
|
45
54
|
}
|
|
46
55
|
/**
|
|
47
56
|
* Hermes V1 (static_h) builds before 2025-07-11 carried a delta-mode bug when a
|
package/lib/utils/hermes-base.js
CHANGED
|
@@ -81,6 +81,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
81
81
|
const stream_1 = require("stream");
|
|
82
82
|
const promises_1 = require("stream/promises");
|
|
83
83
|
const constants_1 = require("./constants");
|
|
84
|
+
const failure_fingerprint_1 = require("./failure-fingerprint");
|
|
84
85
|
const hbcTransform_1 = require("./hbcTransform");
|
|
85
86
|
const hermes_cached_object_1 = require("./hermes-cached-object");
|
|
86
87
|
const hermes_literals_1 = require("./hermes-literals");
|
|
@@ -817,9 +818,13 @@ function hermesBaseMeta(selection, bytecodeVersion, check) {
|
|
|
817
818
|
};
|
|
818
819
|
if (check) {
|
|
819
820
|
meta.hermesBaseOutcome = check.outcome;
|
|
820
|
-
|
|
821
|
-
|
|
821
|
+
// The console above keeps the real text -- that is where the property
|
|
822
|
+
// name helps. What leaves the machine is redacted and fingerprinted.
|
|
823
|
+
const detail = truncateHermesBaseDetail((0, failure_fingerprint_1.redactFailureDetail)(check.detail ?? ''));
|
|
824
|
+
if (detail) {
|
|
822
825
|
meta.hermesBaseDetail = detail;
|
|
826
|
+
meta.hermesBaseFingerprint = (0, failure_fingerprint_1.failureFingerprint)(check.detail ?? '');
|
|
827
|
+
}
|
|
823
828
|
}
|
|
824
829
|
return meta;
|
|
825
830
|
}
|
package/package.json
CHANGED