@cloudcrane/app-spec 0.1.0 → 0.1.1
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/dist/src/leak.js +5 -2
- package/package.json +1 -1
package/dist/src/leak.js
CHANGED
|
@@ -94,6 +94,9 @@ const RULES = [
|
|
|
94
94
|
const EXEMPT = new Set(["/manifest/source/fingerprint"]);
|
|
95
95
|
/** Where CEL lives: rules may look like code there, but nothing else may. */
|
|
96
96
|
const CEL_AT = [/^\/logic\/functions\/[^/]+\/cel$/, /^\/logic\/computed\/.+$/, /^\/data\/migrations\/\d+\/cel$/];
|
|
97
|
+
/** A test step's state path: a dotted path into what the app exposes (CloudCrane's form), which reads like a member access by design. */
|
|
98
|
+
const STATE_PATH_AT = /^\/tests\/\d+\/(steps|setup|check)\/\d+\/path$/;
|
|
99
|
+
const STATE_PATH = /^[A-Za-z0-9_$]+(\.[A-Za-z0-9_$]+)*$/;
|
|
97
100
|
const escape = (k) => k.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
98
101
|
/** Every string in a value, with its JSON Pointer (object keys count as strings too). */
|
|
99
102
|
function* strings(v, at = "") {
|
|
@@ -122,11 +125,11 @@ export function leakProblems(spec) {
|
|
|
122
125
|
continue;
|
|
123
126
|
// A2UI's bindings inside text (${/path}, ${fn(…)}) are the standard's syntax.
|
|
124
127
|
const s = at.startsWith("/surface/") || at.startsWith("/data/views/") ? raw.replace(/\$\{[^}]*\}/g, " ") : raw;
|
|
125
|
-
const
|
|
128
|
+
const codeShaped = CEL_AT.some((r) => r.test(at)) || (STATE_PATH_AT.test(at) && STATE_PATH.test(raw));
|
|
126
129
|
// Web addresses are checked as addresses (hosts, secrets), never as code.
|
|
127
130
|
const withoutUrls = s.replace(/https?:\/\/[^\s"'<>]+/g, " ");
|
|
128
131
|
for (const rule of RULES) {
|
|
129
|
-
if (
|
|
132
|
+
if (codeShaped && rule.kind === "code")
|
|
130
133
|
continue;
|
|
131
134
|
if (rule.test(rule.kind === "code" ? withoutUrls : s)) {
|
|
132
135
|
problems.push({ at: at || "/", problem: `looks like ${rule.why} (${rule.kind})` });
|
package/package.json
CHANGED