kryptheon 0.1.71 → 0.1.72
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/bin/kryptheon.js +9 -1
- package/kryptheon-aiapp.js +416 -0
- package/kryptheon-api.js +131 -5
- package/kryptheon-map.js +30 -0
- package/package.json +5 -3
package/bin/kryptheon.js
CHANGED
|
@@ -2935,7 +2935,15 @@ async function apiRecheckCommand(target, opened) {
|
|
|
2935
2935
|
console.log(' Reading ' + origin + ' again, read-only - nothing is added to your app...');
|
|
2936
2936
|
const run = await api.runLive(USER_DIR, { origin, packageDir: PACKAGE_DIR, say: () => {} });
|
|
2937
2937
|
if (!run.ran) attempt.why = run.why;
|
|
2938
|
-
else {
|
|
2938
|
+
else if (api.answerKindOf(target.headline)) {
|
|
2939
|
+
// a key or a quiz's answers in what the app sends: that page read again, and looked through again
|
|
2940
|
+
const kind = api.answerKindOf(target.headline);
|
|
2941
|
+
const still = run.findings.find((f) => f.where === target.where && f.kind === kind);
|
|
2942
|
+
const read = run.answers && run.answers.ran && run.answers.tried.some((x) => x.what === target.where && x.status === 200);
|
|
2943
|
+
if (still) { attempt.verdict = 'still open'; attempt.why = 'it is still sent: ' + still.headline; }
|
|
2944
|
+
else if (read) attempt.verdict = 'fixed';
|
|
2945
|
+
else attempt.why = 'that page could not be read again (it did not answer 200)';
|
|
2946
|
+
} else {
|
|
2939
2947
|
const still = run.findings.find((f) => f.where === target.where && f.kind === (String(target.headline).match(/another organization/i) ? 'tenant' : f.kind) && f.status === 'confirmed');
|
|
2940
2948
|
const tried = run.wall && run.wall.ran && run.wall.result.attempts.some((a) => a.method + ' ' + a.template === target.where && !a.notTried);
|
|
2941
2949
|
if (still) { attempt.verdict = 'still open'; attempt.why = 'it still answered: ' + still.headline; }
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// Apps built around an AI: a chat, an "add your API key and it answers your email" assistant, a study app with quizzes.
|
|
3
|
+
// Read from the code (no request is ever sent to an AI route - each one costs the owner money, and some send real
|
|
4
|
+
// email): which routes ask an AI provider, whether anyone at all may call them, whether one account may call them
|
|
5
|
+
// without end, and whether what the AI wrote is sent or fetched with no person approving it first.
|
|
6
|
+
// Read from the running app's answers (GET only): an AI provider's key, or a stored token, sent to the browser; and
|
|
7
|
+
// a quiz's answers sent along with its questions.
|
|
8
|
+
// Nothing here is an AI: these are fixed rules over the code and over the answers.
|
|
9
|
+
|
|
10
|
+
// The packages an app talks to an AI provider through.
|
|
11
|
+
const AI_PKG = /^(openai|@anthropic-ai\/sdk|@google\/generative-ai|@google\/genai|@google-cloud\/vertexai|ai|@ai-sdk\/[\w-]+|groq-sdk|@mistralai\/mistralai|cohere-ai|replicate|together-ai|@huggingface\/inference|ollama|@langchain\/[\w-]+|langchain(\/.*)?|@openrouter\/[\w-]+|@fal-ai\/[\w-]+|@aws-sdk\/client-bedrock-runtime)$/;
|
|
12
|
+
// ... and their addresses, for an app that calls them with fetch.
|
|
13
|
+
const AI_HOST = /\b(api\.openai\.com|api\.anthropic\.com|generativelanguage\.googleapis\.com|aiplatform\.googleapis\.com|openrouter\.ai\/api|api\.groq\.com|api\.mistral\.ai|api\.cohere\.(ai|com)|api\.together\.xyz|api\.deepseek\.com|api\.perplexity\.ai|api\.replicate\.com|api-inference\.huggingface\.co|api\.x\.ai|api\.fireworks\.ai)\b/;
|
|
14
|
+
// A method of a provider's client that asks the model for an answer (not one that lists models or counts tokens).
|
|
15
|
+
const CLIENT_METHOD = /^(create|stream|generateContent|generateContentStream|sendMessage|sendMessageStream|invoke|ainvoke|batch|run|chat|chatStream|complete|completion|generate|embedContent|parse|textGeneration|chatCompletion)$/;
|
|
16
|
+
// A function of the AI SDKs that asks the model: generateText({ model, prompt }).
|
|
17
|
+
const SDK_FN = /^(generate|stream)(Text|Object)$|^embed(Many)?$/;
|
|
18
|
+
// Strong enough on its own when the file imports an AI package: openai.chat.completions.create(...)
|
|
19
|
+
const STRONG = /(^|\.)chat\.completions\.(create|stream)$|(^|\.)responses\.create$|(^|\.)generateContent(Stream)?$/;
|
|
20
|
+
// Packages that send email, messages or posts in the app owner's name.
|
|
21
|
+
const SEND_PKG = /^(nodemailer|resend|@sendgrid\/mail|postmark|mailgun\.js|mailgun-js|@mailchimp\/mailchimp_transactional|twilio|@slack\/web-api|@slack\/bolt|googleapis|@googleapis\/gmail|@microsoft\/microsoft-graph-client|discord\.js|telegraf|node-telegram-bot-api)$/;
|
|
22
|
+
const SEND_CALL = /(^|\.)(sendMail|sendEmail|send_email|sendSms|sendSMS|sendWhatsapp|sendWhatsApp)$|(^|\.)emails\.send$|(^|\.)messages\.(send|create)$|(^|\.)chat\.postMessage$|(^|\.)drafts\.send$|(^|\.)users\.messages\.send$|(^|\.)sendMessage$/;
|
|
23
|
+
// A person's yes in front of the action: an approval, a review, a confirm step.
|
|
24
|
+
const APPROVAL = /approv|\breview|confirm|human[_-]?in[_-]?the[_-]?loop|awaiting[_-]?(user|owner)/i;
|
|
25
|
+
// A limit on how often one caller may ask.
|
|
26
|
+
const LIMIT = /rate[-_ ]?limit|ratelimit|limiter|throttl|slowDown|\bquota|\bcredits?\b|usage[_-]?(count|limit)|daily[_-]?limit|max[_-]?requests|tokens[_-]?used/i;
|
|
27
|
+
const LIMIT_PKG = /^(express-rate-limit|rate-limiter-flexible|@upstash\/ratelimit|express-slow-down|@nestjs\/throttler|koa-ratelimit|hono-rate-limiter|limiter|bottleneck)$/;
|
|
28
|
+
|
|
29
|
+
const unwrap = (n) => {
|
|
30
|
+
while (n && /^(AwaitExpression|TSAsExpression|TSNonNullExpression|ParenthesizedExpression|TSSatisfiesExpression)$/.test(n.type)) n = n.argument || n.expression;
|
|
31
|
+
return n;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** The AI package a module imports or requires, if any. */
|
|
35
|
+
function anyAiImport(mod) {
|
|
36
|
+
for (const i of mod.imports.values()) if (AI_PKG.test(i.source)) return i.source;
|
|
37
|
+
const m = /require\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
38
|
+
let x;
|
|
39
|
+
while ((x = m.exec(mod.source))) if (AI_PKG.test(x[1])) return x[1];
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// a file of the app's own: ./x, ../x, @/x, ~/x, #x - not a package
|
|
44
|
+
const ownFile = (spec) => /^\.{1,2}\//.test(spec) || /^[@~]\//.test(spec) || /^#/.test(spec) || spec.startsWith('/');
|
|
45
|
+
|
|
46
|
+
function importSource(mod, name) {
|
|
47
|
+
const imp = mod.imports.get(name);
|
|
48
|
+
if (imp) return imp.source;
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The AI package a name in this scope comes from: imported from it, made from its client (new OpenAI()), or made in
|
|
54
|
+
* another file of the app that does (import { openai } from '@/lib/openai'). null when it is not one.
|
|
55
|
+
*/
|
|
56
|
+
function rootSource(ctx, H, mod, scope, name, depth) {
|
|
57
|
+
if (depth > 4 || !scope) return null;
|
|
58
|
+
const b = scope.getBinding(name);
|
|
59
|
+
if (!b) return null;
|
|
60
|
+
const bp = b.path;
|
|
61
|
+
if (bp.isImportSpecifier() || bp.isImportDefaultSpecifier() || bp.isImportNamespaceSpecifier()) {
|
|
62
|
+
const imp = mod.imports.get(name);
|
|
63
|
+
if (!imp) return null;
|
|
64
|
+
if (AI_PKG.test(imp.source)) return imp.source;
|
|
65
|
+
// another package (express, pg) is not an AI one; a file of the app's own may make the client
|
|
66
|
+
return ownFile(imp.source) ? fromOtherFile(ctx, H, mod, imp.source, imp.imported, depth) : null;
|
|
67
|
+
}
|
|
68
|
+
if (bp.isVariableDeclarator()) {
|
|
69
|
+
const init = unwrap(bp.node.init);
|
|
70
|
+
if (!init) return null;
|
|
71
|
+
const req = H.requireOf(ctx.t, init) || (init.type === 'MemberExpression' && H.requireOf(ctx.t, init.object));
|
|
72
|
+
if (req) {
|
|
73
|
+
if (AI_PKG.test(req)) return req;
|
|
74
|
+
return ownFile(req) ? fromOtherFile(ctx, H, mod, req, 'default', depth) : null;
|
|
75
|
+
}
|
|
76
|
+
if ((init.type === 'NewExpression' || init.type === 'CallExpression') && init.callee) {
|
|
77
|
+
const c = H.memberChain(init.callee);
|
|
78
|
+
if (c && c.length) return rootSource(ctx, H, mod, bp.scope, c[0], depth + 1);
|
|
79
|
+
}
|
|
80
|
+
if (init.type === 'Identifier') return rootSource(ctx, H, mod, bp.scope, init.name, depth + 1);
|
|
81
|
+
if (init.type === 'MemberExpression') {
|
|
82
|
+
const c = H.memberChain(init);
|
|
83
|
+
if (c && c.length) return rootSource(ctx, H, mod, bp.scope, c[0], depth + 1);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** A file of the app's own that an import names, loaded - @/lib/x and ~/lib/x as a Next.js app names them too. */
|
|
90
|
+
function loadOwn(ctx, mod, spec) {
|
|
91
|
+
let abs = null;
|
|
92
|
+
try {
|
|
93
|
+
abs = ctx.resolveModule(mod.abs, spec);
|
|
94
|
+
if (!abs && /^[@~]\//.test(spec) && ctx.root) {
|
|
95
|
+
const anchor = require('path').join(ctx.root, 'kryptheon-anchor.js');
|
|
96
|
+
abs = ctx.resolveModule(anchor, './' + spec.slice(2)) || ctx.resolveModule(anchor, './src/' + spec.slice(2)) || null;
|
|
97
|
+
}
|
|
98
|
+
} catch (e) { abs = null; }
|
|
99
|
+
return abs ? ctx.load(abs) : null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** The function an import of the app's own names, when the map's own following could not reach it (an @/ path). */
|
|
103
|
+
function ownFunction(ctx, mod, name) {
|
|
104
|
+
const imp = mod.imports.get(name);
|
|
105
|
+
if (!imp || !ownFile(imp.source)) return null;
|
|
106
|
+
const other = loadOwn(ctx, mod, imp.source);
|
|
107
|
+
if (!other || !other.program) return null;
|
|
108
|
+
let e = imp.imported === 'default' ? other.exportDefault : other.exportsNamed.get(imp.imported);
|
|
109
|
+
if (e && e.local) { const b = other.program.scope.getBinding(e.local); e = b ? b.path : null; }
|
|
110
|
+
if (e && e.node && e.node.type === 'Identifier') { const b = other.program.scope.getBinding(e.node.name); e = b ? b.path : null; }
|
|
111
|
+
if (e && e.isVariableDeclarator && e.isVariableDeclarator()) e = e.get('init');
|
|
112
|
+
if (e && e.node && /Function/.test(e.node.type)) return { kind: 'fn', path: e, mod: other };
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function fromOtherFile(ctx, H, mod, spec, imported, depth) {
|
|
117
|
+
const other = loadOwn(ctx, mod, spec);
|
|
118
|
+
if (!other || !other.program) return null;
|
|
119
|
+
const e = imported === 'default' || imported === '*' ? other.exportDefault || other.cjsExports : other.exportsNamed.get(imported);
|
|
120
|
+
if (e && e.node) {
|
|
121
|
+
const n = unwrap(e.node.type === 'VariableDeclarator' ? e.node.init : e.node);
|
|
122
|
+
if (n && n.type === 'Identifier') return rootSource(ctx, H, other, other.program.scope, n.name, depth + 1);
|
|
123
|
+
if (n && (n.type === 'NewExpression' || n.type === 'CallExpression')) {
|
|
124
|
+
const c = H.memberChain(n.callee);
|
|
125
|
+
if (c && c.length) {
|
|
126
|
+
const s = rootSource(ctx, H, other, other.program.scope, c[0], depth + 1);
|
|
127
|
+
if (s) return s;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
} else if (e && e.local) {
|
|
131
|
+
return rootSource(ctx, H, other, other.program.scope, e.local, depth + 1);
|
|
132
|
+
}
|
|
133
|
+
// module.exports = { openai } or a function that makes the client: the file is about an AI provider
|
|
134
|
+
return anyAiImport(other);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** A string an argument is, when it can be read here: a literal, a template, or a constant holding one. */
|
|
138
|
+
function textOf(node, scope, depth) {
|
|
139
|
+
node = unwrap(node);
|
|
140
|
+
if (!node || depth > 3) return '';
|
|
141
|
+
if (node.type === 'StringLiteral') return node.value;
|
|
142
|
+
if (node.type === 'TemplateLiteral') return node.quasis.map((q) => q.value.cooked || '').join('{}');
|
|
143
|
+
if (node.type === 'BinaryExpression' && node.operator === '+') return textOf(node.left, scope, depth + 1) + textOf(node.right, scope, depth + 1);
|
|
144
|
+
if (node.type === 'Identifier' && scope) {
|
|
145
|
+
const b = scope.getBinding(node.name);
|
|
146
|
+
if (b && b.path.isVariableDeclarator()) return textOf(b.path.node.init, b.path.scope, depth + 1);
|
|
147
|
+
}
|
|
148
|
+
if (node.type === 'NewExpression' && node.callee.type === 'Identifier' && node.callee.name === 'URL') return textOf(node.arguments[0], scope, depth + 1);
|
|
149
|
+
return '';
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const FETCHERS = /^(fetch|axios|got|ky|request|ofetch|\$fetch|undiciRequest)$/;
|
|
153
|
+
|
|
154
|
+
/** The provider an AI call reaches, or null. */
|
|
155
|
+
function aiCallOf(ctx, H, mod, p) {
|
|
156
|
+
const chain = H.memberChain(p.node.callee);
|
|
157
|
+
if (!chain || !chain.length) return null;
|
|
158
|
+
const root = chain[0];
|
|
159
|
+
const last = chain[chain.length - 1];
|
|
160
|
+
if ((chain.length === 1 && FETCHERS.test(root)) || (chain.length === 2 && FETCHERS.test(root) && /^(get|post|put|request|create)$/.test(last))) {
|
|
161
|
+
const url = textOf(p.node.arguments[0], p.scope, 0);
|
|
162
|
+
const m = AI_HOST.exec(url);
|
|
163
|
+
return m ? m[1] : null;
|
|
164
|
+
}
|
|
165
|
+
const src = rootSource(ctx, H, mod, p.scope, root, 0);
|
|
166
|
+
if (src) {
|
|
167
|
+
if (chain.length === 1) return SDK_FN.test(root) ? src : null;
|
|
168
|
+
return CLIENT_METHOD.test(last) && !/^(countTokens|list|retrieve|del|delete)$/.test(last) ? src : null;
|
|
169
|
+
}
|
|
170
|
+
if (chain.length > 1 && STRONG.test(chain.join('.'))) return anyAiImport(mod);
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function sendOf(ctx, H, mod, p) {
|
|
175
|
+
const chain = H.memberChain(p.node.callee);
|
|
176
|
+
if (!chain || !chain.length) return null;
|
|
177
|
+
const joined = chain.join('.');
|
|
178
|
+
const src = importSource(mod, chain[0]) || (() => {
|
|
179
|
+
const b = p.scope.getBinding(chain[0]);
|
|
180
|
+
const init = b && b.path.isVariableDeclarator() ? unwrap(b.path.node.init) : null;
|
|
181
|
+
const req = init && H.requireOf(ctx.t, init);
|
|
182
|
+
if (req) return req;
|
|
183
|
+
if (init && (init.type === 'CallExpression' || init.type === 'NewExpression')) {
|
|
184
|
+
const c = H.memberChain(init.callee);
|
|
185
|
+
if (c && c.length) {
|
|
186
|
+
const cb = p.scope.getBinding(c[0]);
|
|
187
|
+
const ci = cb && cb.path.isVariableDeclarator() ? unwrap(cb.path.node.init) : null;
|
|
188
|
+
return importSource(mod, c[0]) || (ci && H.requireOf(ctx.t, ci)) || null;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return null;
|
|
192
|
+
})();
|
|
193
|
+
const fromSender = src && SEND_PKG.test(src) && /^(send|sendMail|create|postMessage|sendMessage)$/.test(chain[chain.length - 1]);
|
|
194
|
+
if (!SEND_CALL.test(joined) && !fromSender) return null;
|
|
195
|
+
return /mail|email|resend|sendgrid|postmark|mailgun|gmail|drafts/i.test(joined + ' ' + (src || '')) ? 'sends an email' : 'sends a message';
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const mentions = (t, node, names) => {
|
|
199
|
+
if (!node || !names.size) return false;
|
|
200
|
+
let hit = false;
|
|
201
|
+
t.traverseFast(node, (x) => { if (!hit && x.type === 'Identifier' && names.has(x.name)) hit = true; });
|
|
202
|
+
return hit;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
/** Names a pattern declares: const { text } = ..., const [a] = ..., const reply = ... */
|
|
206
|
+
function namesOf(id, out) {
|
|
207
|
+
if (!id) return out;
|
|
208
|
+
if (id.type === 'Identifier') out.add(id.name);
|
|
209
|
+
else if (id.type === 'ObjectPattern') for (const pr of id.properties) namesOf(pr.type === 'RestElement' ? pr.argument : pr.value, out);
|
|
210
|
+
else if (id.type === 'ArrayPattern') for (const el of id.elements) namesOf(el, out);
|
|
211
|
+
else if (id.type === 'AssignmentPattern') namesOf(id.left, out);
|
|
212
|
+
return out;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* One route's handler, read for AI: { calls: [{provider, file, line, code}], acts: [{what, file, line, code, tool}],
|
|
217
|
+
* limited: {file, line, code} | null, approval: bool }. Helpers of the app's own are followed two levels down.
|
|
218
|
+
*/
|
|
219
|
+
function readHandler(ctx, H, fnRef, depth, seen) {
|
|
220
|
+
depth = depth || 0;
|
|
221
|
+
seen = seen || new Set();
|
|
222
|
+
const out = { calls: [], acts: [], limited: null, approval: false };
|
|
223
|
+
if (!fnRef || !fnRef.path || !fnRef.path.node || depth > 2) return out;
|
|
224
|
+
const t = ctx.t;
|
|
225
|
+
const mod = fnRef.mod;
|
|
226
|
+
const key = mod.abs + ':' + fnRef.path.node.start;
|
|
227
|
+
if (seen.has(key)) return out;
|
|
228
|
+
seen.add(key);
|
|
229
|
+
const text = mod.source.slice(fnRef.path.node.start, fnRef.path.node.end);
|
|
230
|
+
if (APPROVAL.test(text)) out.approval = true;
|
|
231
|
+
const at = (n) => ({ file: mod.rel, line: n.loc.start.line, code: H.snippet(mod, n.loc.start.line) });
|
|
232
|
+
if (LIMIT.test(text)) {
|
|
233
|
+
const i = text.search(LIMIT);
|
|
234
|
+
const line = fnRef.path.node.loc.start.line + text.slice(0, i).split('\n').length - 1;
|
|
235
|
+
out.limited = { file: mod.rel, line, code: H.snippet(mod, line) };
|
|
236
|
+
}
|
|
237
|
+
const aiNodes = [];
|
|
238
|
+
const calls = [];
|
|
239
|
+
fnRef.path.traverse({
|
|
240
|
+
CallExpression(p) { calls.push(p); },
|
|
241
|
+
});
|
|
242
|
+
for (const p of calls) {
|
|
243
|
+
const provider = aiCallOf(ctx, H, mod, p);
|
|
244
|
+
if (provider) {
|
|
245
|
+
out.calls.push(Object.assign({ provider }, at(p.node)));
|
|
246
|
+
aiNodes.push(p);
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
// a helper of the app's own: an AI answer it returns is an AI answer here
|
|
250
|
+
const chain = H.memberChain(p.node.callee);
|
|
251
|
+
if (!chain || FETCHERS.test(chain[0]) || chain[0] === 'require') continue;
|
|
252
|
+
let r = null;
|
|
253
|
+
try { r = H.resolveRef(ctx, mod, p.get('callee')); } catch (e) { r = null; }
|
|
254
|
+
if ((!r || r.kind !== 'fn') && chain.length === 1) r = ownFunction(ctx, mod, chain[0]);
|
|
255
|
+
if (!r || r.kind !== 'fn' || !r.path || r.path.node === fnRef.path.node) continue;
|
|
256
|
+
const inner = readHandler(ctx, H, r, depth + 1, seen);
|
|
257
|
+
if (inner.approval) out.approval = true;
|
|
258
|
+
if (inner.limited && !out.limited) out.limited = inner.limited;
|
|
259
|
+
for (const a of inner.acts) out.acts.push(Object.assign({}, a, { via: chain.join('.') + '() at ' + mod.rel + ':' + p.node.loc.start.line }));
|
|
260
|
+
if (inner.calls.length) {
|
|
261
|
+
for (const c of inner.calls) out.calls.push(Object.assign({}, c, { via: chain.join('.') + '() at ' + mod.rel + ':' + p.node.loc.start.line }));
|
|
262
|
+
aiNodes.push(p);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (!aiNodes.length) return out;
|
|
266
|
+
// what holds the AI's answer: the names it is put in, and the names made from those
|
|
267
|
+
const held = new Set();
|
|
268
|
+
for (const p of aiNodes) {
|
|
269
|
+
// const reply = (await openai.chat.completions.create(...)).choices[0].message.content - the nearest name above it
|
|
270
|
+
const holder = p.findParent((x) => x.isVariableDeclarator() || x.isAssignmentExpression() || x.isStatement() || x.isFunction());
|
|
271
|
+
if (holder && holder.isVariableDeclarator()) namesOf(holder.node.id, held);
|
|
272
|
+
else if (holder && holder.isAssignmentExpression()) namesOf(holder.node.left, held);
|
|
273
|
+
}
|
|
274
|
+
for (let round = 0; round < 4; round++) {
|
|
275
|
+
const before = held.size;
|
|
276
|
+
fnRef.path.traverse({
|
|
277
|
+
VariableDeclarator(p) { if (p.node.init && mentions(t, p.node.init, held)) namesOf(p.node.id, held); },
|
|
278
|
+
AssignmentExpression(p) { if (mentions(t, p.node.right, held)) namesOf(p.node.left, held); },
|
|
279
|
+
ForOfStatement(p) { if (mentions(t, p.node.right, held) && p.node.left.type === 'VariableDeclaration') for (const d of p.node.left.declarations) namesOf(d.id, held); },
|
|
280
|
+
});
|
|
281
|
+
if (held.size === before) break;
|
|
282
|
+
}
|
|
283
|
+
const insideAi = (p) => aiNodes.some((a) => a.node !== p.node && p.node.start >= a.node.start && p.node.end <= a.node.end);
|
|
284
|
+
for (const p of calls) {
|
|
285
|
+
if (aiNodes.includes(p)) continue;
|
|
286
|
+
const chain = H.memberChain(p.node.callee);
|
|
287
|
+
const send = sendOf(ctx, H, mod, p);
|
|
288
|
+
const fetchesChosen = chain && chain.length <= 2 && FETCHERS.test(chain[0]) && p.node.arguments[0] && mentions(t, p.node.arguments[0], held);
|
|
289
|
+
if (!send && !fetchesChosen) continue;
|
|
290
|
+
// the AI's own tool: tools: { sendEmail: tool({ execute: (...) => sendMail(...) }) } - the model decides
|
|
291
|
+
const tool = insideAi(p);
|
|
292
|
+
const fed = p.node.arguments.some((a) => mentions(t, a, held) || aiNodes.some((n) => a.start <= n.node.start && a.end >= n.node.end));
|
|
293
|
+
if (!tool && !fed) continue;
|
|
294
|
+
out.acts.push(Object.assign({ what: fetchesChosen ? 'calls an address the AI chose' : send, tool }, at(p.node)));
|
|
295
|
+
}
|
|
296
|
+
return out;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/** The route's whole AI reading, or null when it asks no AI. */
|
|
300
|
+
function routeAi(ctx, H, fnRef, route) {
|
|
301
|
+
let r;
|
|
302
|
+
try { r = readHandler(ctx, H, fnRef); } catch (e) { return null; }
|
|
303
|
+
if (!r.calls.length) return null;
|
|
304
|
+
const mw = (route && route.middleware) || [];
|
|
305
|
+
const lim = mw.find((m) => LIMIT.test(m.name || '') || (m.source && LIMIT_PKG.test(m.source)));
|
|
306
|
+
if (lim && !r.limited) r.limited = { file: lim.usedFile || lim.file, line: lim.usedLine || lim.line, code: lim.name };
|
|
307
|
+
if (route && route.path && APPROVAL.test(route.path)) r.approval = true;
|
|
308
|
+
return {
|
|
309
|
+
calls: r.calls.slice(0, 5),
|
|
310
|
+
acts: r.acts.slice(0, 5),
|
|
311
|
+
limited: r.limited,
|
|
312
|
+
approval: r.approval,
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// --- answers of the running app -----------------------------------------------------
|
|
317
|
+
|
|
318
|
+
// Keys and tokens that are only ever the server's: shapes no other value has.
|
|
319
|
+
const KEY_SHAPES = [
|
|
320
|
+
{ re: /^sk-ant-(api|admin)\d{2}-[\w-]{20,}$/, label: 'an Anthropic API key' },
|
|
321
|
+
{ re: /^sk-(proj-|svcacct-|admin-)?[\w-]{20,}$/, label: 'an OpenAI API key' },
|
|
322
|
+
{ re: /^AIza[\w-]{35}$/, label: 'a Google API key' },
|
|
323
|
+
{ re: /^gsk_[\w]{20,}$/, label: 'a Groq API key' },
|
|
324
|
+
{ re: /^r8_[\w]{20,}$/, label: 'a Replicate API token' },
|
|
325
|
+
{ re: /^hf_[\w]{20,}$/, label: 'a Hugging Face token' },
|
|
326
|
+
{ re: /^sk-or-v1-[\w]{20,}$/, label: 'an OpenRouter API key' },
|
|
327
|
+
{ re: /^xai-[\w]{20,}$/, label: 'an xAI API key' },
|
|
328
|
+
{ re: /^(sk|rk)_live_[\w]{16,}$/, label: 'a Stripe live secret key' },
|
|
329
|
+
{ re: /^re_[A-Za-z0-9]{8,}_[\w]{16,}$/, label: 'a Resend API key' },
|
|
330
|
+
{ re: /^SG\.[\w-]{16,}\.[\w-]{16,}$/, label: 'a SendGrid API key' },
|
|
331
|
+
{ re: /^xox[bpas]-[\w-]{20,}$/, label: 'a Slack token' },
|
|
332
|
+
{ re: /^gh[pousr]_[\w]{30,}$/, label: 'a GitHub token' },
|
|
333
|
+
{ re: /^1\/\/0[\w-]{30,}$/, label: 'a Google refresh token' },
|
|
334
|
+
];
|
|
335
|
+
// A field that holds a key or a stored token by its name (a value too short or empty is not one).
|
|
336
|
+
const SECRET_FIELD = /^(api[_-]?key|apikey|secret[_-]?key|(openai|anthropic|gemini|google|groq|mistral|cohere|replicate|openrouter|claude|gpt|llm|ai|model|provider)[_-]?(api[_-]?)?(key|token|secret)|refresh[_-]?token|(gmail|google|outlook|slack|oauth|smtp|imap)[_-]?(refresh[_-]?)?(token|password|secret)|client[_-]?secret|private[_-]?key|smtp[_-]?pass(word)?|app[_-]?password)$/i;
|
|
337
|
+
const MASKED_VALUE = /^[•*x.\-_ ]*$|\*{3,}|•{3,}|\.{3}/i;
|
|
338
|
+
|
|
339
|
+
// A quiz item: a question and, beside it, which answer is right.
|
|
340
|
+
const QUESTION_FIELD = /^(question|question[_-]?text|prompt|stem|q|text|title|body)$/i;
|
|
341
|
+
const ANSWER_FIELD = /^(correct[_-]?(answer|answers|option|options|choice|choices|index|idx|key)|answer[_-]?(key|index|idx)?|right[_-]?answer|solution|is[_-]?correct|isCorrect|correct)$/i;
|
|
342
|
+
const OPTIONS_FIELD = /^(options|choices|answers|alternatives)$/i;
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Every key-shaped value and secret-named field in an answer, and every quiz item that carries its answer.
|
|
346
|
+
* { secrets: [{ path, field, label, value }], quiz: [{ path, field }] } - values are kept only to compare, never shown.
|
|
347
|
+
*/
|
|
348
|
+
function scanAnswer(json) {
|
|
349
|
+
const secrets = [];
|
|
350
|
+
const quiz = [];
|
|
351
|
+
const walk = (v, at, field, depth) => {
|
|
352
|
+
if (depth > 8 || v === null || v === undefined) return;
|
|
353
|
+
if (typeof v === 'string') {
|
|
354
|
+
const s = v.trim();
|
|
355
|
+
if (s.length < 16 || s.length > 400 || /\s/.test(s)) {
|
|
356
|
+
if (field && SECRET_FIELD.test(field) && s.length >= 12 && !/\s/.test(s) && !MASKED_VALUE.test(s)) secrets.push({ path: at, field, label: 'a stored ' + field.replace(/[_-]/g, ' '), value: s });
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
const shape = KEY_SHAPES.find((k) => k.re.test(s));
|
|
360
|
+
if (shape) secrets.push({ path: at, field, label: shape.label, value: s });
|
|
361
|
+
else if (field && SECRET_FIELD.test(field) && !MASKED_VALUE.test(s)) secrets.push({ path: at, field, label: 'a stored ' + field.replace(/[_-]/g, ' '), value: s });
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
if (Array.isArray(v)) {
|
|
365
|
+
v.slice(0, 200).forEach((x, i) => walk(x, at + '[' + i + ']', field, depth + 1));
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
if (typeof v === 'object') {
|
|
369
|
+
const keys = Object.keys(v);
|
|
370
|
+
const q = keys.find((k) => QUESTION_FIELD.test(k) && typeof v[k] === 'string');
|
|
371
|
+
const opts = keys.find((k) => OPTIONS_FIELD.test(k) && Array.isArray(v[k]));
|
|
372
|
+
const ans = keys.find((k) => ANSWER_FIELD.test(k) && v[k] !== null && v[k] !== undefined && v[k] !== '');
|
|
373
|
+
// a question is asked here: a key named for one, not a title or a body on its own
|
|
374
|
+
const asksQ = keys.some((k) => /question|prompt|stem/i.test(k) || /^q$/i.test(k));
|
|
375
|
+
// "answer" beside a question is the right answer only when there are options to choose from or it says "correct"
|
|
376
|
+
const isQuiz = q && ans && (opts || /correct|solution|right|key|index|idx/i.test(ans)) && asksQ;
|
|
377
|
+
if (isQuiz) quiz.push({ path: at, field: ans });
|
|
378
|
+
// options that each say whether they are the right one
|
|
379
|
+
if (q && opts && asksQ) {
|
|
380
|
+
const flagged = v[opts].find((o) => o && typeof o === 'object' && Object.keys(o).some((k) => /^(is[_-]?correct|isCorrect|correct|is[_-]?answer|right)$/i.test(k)));
|
|
381
|
+
if (flagged && !isQuiz) quiz.push({ path: at, field: opts + '[].' + Object.keys(flagged).find((k) => /^(is[_-]?correct|isCorrect|correct|is[_-]?answer|right)$/i.test(k)) });
|
|
382
|
+
}
|
|
383
|
+
for (const k of keys.slice(0, 200)) walk(v[k], at + '.' + k, k, depth + 1);
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
walk(json, '$', null, 0);
|
|
387
|
+
return { secrets, quiz };
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/** A path that is about results, answers given or a teacher's view: answers there are meant to be seen. */
|
|
391
|
+
const ANSWERS_MEANT = /result|attempt|submission|review|grade|graded|score|answer[-_]?key|teacher|instructor|admin|solution|explain|feedback|history|report/i;
|
|
392
|
+
/** A path where a person's own token is the point: signing in, a session, connecting an account. */
|
|
393
|
+
const TOKEN_MEANT = /auth|login|signin|sign-in|session|token|oauth|callback|connect/i;
|
|
394
|
+
|
|
395
|
+
/** A provider as a person knows it: 'openai' -> OpenAI, 'api.anthropic.com' -> Anthropic (Claude). */
|
|
396
|
+
function providerName(p) {
|
|
397
|
+
const s = String(p || '');
|
|
398
|
+
if (/openai/.test(s) && !/openrouter/.test(s)) return 'OpenAI';
|
|
399
|
+
if (/anthropic/.test(s)) return 'Anthropic (Claude)';
|
|
400
|
+
if (/google|gemini|generativelanguage|aiplatform|vertex/.test(s)) return 'Google Gemini';
|
|
401
|
+
if (/groq/.test(s)) return 'Groq';
|
|
402
|
+
if (/mistral/.test(s)) return 'Mistral';
|
|
403
|
+
if (/cohere/.test(s)) return 'Cohere';
|
|
404
|
+
if (/replicate/.test(s)) return 'Replicate';
|
|
405
|
+
if (/openrouter/.test(s)) return 'OpenRouter';
|
|
406
|
+
if (/huggingface/.test(s)) return 'Hugging Face';
|
|
407
|
+
if (/bedrock/.test(s)) return 'AWS Bedrock';
|
|
408
|
+
if (/deepseek/.test(s)) return 'DeepSeek';
|
|
409
|
+
return 'an AI provider';
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
module.exports = {
|
|
413
|
+
providerName,
|
|
414
|
+
AI_PKG, AI_HOST, LIMIT, LIMIT_PKG, APPROVAL, ANSWERS_MEANT, TOKEN_MEANT,
|
|
415
|
+
readHandler, routeAi, scanAnswer, aiCallOf,
|
|
416
|
+
};
|
package/kryptheon-api.js
CHANGED
|
@@ -27,6 +27,7 @@ const authz = require('./kryptheon-authz.js');
|
|
|
27
27
|
const webhook = require('./kryptheon-webhook.js');
|
|
28
28
|
const csv = require('./kryptheon-csv.js');
|
|
29
29
|
const witnessDb = require('./kryptheon-witness.js');
|
|
30
|
+
const aiapp = require('./kryptheon-aiapp.js');
|
|
30
31
|
|
|
31
32
|
const EMAIL = /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g;
|
|
32
33
|
const SIGN_IN = /(^|\/)(log-?in|sign-?in|session|auth\/(login|signin|token))$/i;
|
|
@@ -3161,6 +3162,10 @@ function verdictsFor(toCheck, wall, invalid, roleRun, forged, webhooks, steps, r
|
|
|
3161
3162
|
v.verdict = 'not tried';
|
|
3162
3163
|
v.why = (hook && hook.notTried ? hook.notTried : webhooks && !webhooks.ran ? webhooks.why : 'a webhook this run did not send to') + '; a provider\'s own webhook is the payments check\'s (npx kryptheon payments)';
|
|
3163
3164
|
}
|
|
3165
|
+
} else if (/^ai-/.test(t.kind)) {
|
|
3166
|
+
// a route that asks an AI is never sent to: each answer costs the owner money, and some send real email
|
|
3167
|
+
v.verdict = 'not tried';
|
|
3168
|
+
v.why = 'read from the code only: Kryptheon never sends a request to a route that asks an AI - each answer costs you money, and some send real messages';
|
|
3164
3169
|
} else if (kind === 'role') {
|
|
3165
3170
|
// "held" only when the roles run really tried this route as a role the policy forbids
|
|
3166
3171
|
// a try of a change no rule names (as the fewest permissions) is never "held" nor "confirmed": no rule says who may
|
|
@@ -3300,6 +3305,118 @@ async function runForged(root, options) {
|
|
|
3300
3305
|
return out;
|
|
3301
3306
|
}
|
|
3302
3307
|
|
|
3308
|
+
// --- what the app sends to the browser ------------------------------------------------
|
|
3309
|
+
|
|
3310
|
+
/**
|
|
3311
|
+
* Every page and list the app answers with no record in its address (and each one-record page, at a record the list
|
|
3312
|
+
* gave), read as each test account and with no session - GET only, nothing written - and looked through for:
|
|
3313
|
+
* a key or stored token that is only ever the server's (an AI provider's key, a Gmail refresh token), and a quiz sent
|
|
3314
|
+
* with its right answers. A key the same for two people, or sent to nobody signed in, is confirmed; one sent only to
|
|
3315
|
+
* the person it may belong to is a thing to check. No value is ever shown or saved: its kind and length only.
|
|
3316
|
+
* { ran, why, tried, findings }
|
|
3317
|
+
*/
|
|
3318
|
+
async function runAnswers(root, options) {
|
|
3319
|
+
const opts = options || {};
|
|
3320
|
+
const plan = planOf(root, opts);
|
|
3321
|
+
if (!plan.ran) return { ran: false, why: plan.why };
|
|
3322
|
+
const j = plan.journey;
|
|
3323
|
+
let origin;
|
|
3324
|
+
try {
|
|
3325
|
+
origin = authz.assertLocalTarget(opts.origin, null, { readOnly: opts.readOnly === true });
|
|
3326
|
+
} catch (err) {
|
|
3327
|
+
return { ran: false, why: 'the app must be on this computer (localhost or 127.0.0.1): ' + (opts.origin || 'no address was given') };
|
|
3328
|
+
}
|
|
3329
|
+
const signInPath = j.signIn ? normRoute(j.signIn.path || '') : null;
|
|
3330
|
+
const gets = [];
|
|
3331
|
+
for (const r of plan.map.routes || []) {
|
|
3332
|
+
if (r.unmounted || !r.path || r.method !== 'GET' || r.kind === 'webhook') continue;
|
|
3333
|
+
const template = normRoute(r.path);
|
|
3334
|
+
const params = (template.match(/\{[^}]+\}/g) || []).length;
|
|
3335
|
+
if (params > 1 || /\*/.test(template) || template === signInPath || /log-?out|sign-?out/i.test(template) || PLUMBING.test(template) || gets.some((g) => g.template === template)) continue;
|
|
3336
|
+
gets.push({ template, params });
|
|
3337
|
+
}
|
|
3338
|
+
gets.splice(30);
|
|
3339
|
+
if (!gets.length) return { ran: false, why: 'the map found no page or list to read' };
|
|
3340
|
+
const accounts = j.signIn ? j.accounts.usable.slice(0, 2) : [];
|
|
3341
|
+
const ctx = authz.makeContext({ baseUrl: origin, allowOrigins: [origin], fetch: opts.fetch, passwords: Object.fromEntries(accounts.map((a) => [a.email, a.password])),
|
|
3342
|
+
maxRequests: 10 + (accounts.length + 1) * gets.length * 2, readOnly: opts.readOnly === true,
|
|
3343
|
+
allowWrites: j.signIn && j.signIn.path && !j.signIn.bearer ? [String(j.signIn.method || 'POST').toUpperCase() + ' ' + j.signIn.path] : [] });
|
|
3344
|
+
const readers = [{ who: 'nobody signed in', session: authz.makeSession(ctx, 'nobody', 'nobody', '') }];
|
|
3345
|
+
for (const a of accounts) {
|
|
3346
|
+
const s = authz.makeSession(ctx, 'account', a.email, a.password);
|
|
3347
|
+
const f = { [j.signIn.emailField]: a.email, [j.signIn.passwordField]: a.password };
|
|
3348
|
+
const r = authz.replyOf(await s.send(j.signIn.method, j.signIn.path, j.signIn.encoding === 'form' ? { form: f } : { json: f }));
|
|
3349
|
+
if (r.kind !== 'refused' && r.kind !== 'server-error' && r.kind !== 'no-answer') readers.push({ who: a.email, session: s, account: true });
|
|
3350
|
+
}
|
|
3351
|
+
const listIn = (json) => (Array.isArray(json) ? json : json && typeof json === 'object' ? Object.values(json).find((v) => Array.isArray(v)) || null : null);
|
|
3352
|
+
const out = { ran: true, tried: [], findings: [] };
|
|
3353
|
+
const seenKeys = new Map(); // value -> [{ who, at, field, path, label, account }]
|
|
3354
|
+
const quiz = new Map(); // route -> { field, who }
|
|
3355
|
+
for (const rd of readers) {
|
|
3356
|
+
const lists = new Map();
|
|
3357
|
+
for (const a of gets) {
|
|
3358
|
+
let at = a.template;
|
|
3359
|
+
if (a.params) {
|
|
3360
|
+
const listing = a.template.slice(0, a.template.indexOf('/{'));
|
|
3361
|
+
const items = lists.get(listing);
|
|
3362
|
+
const first = items && items.find((it) => it && typeof it === 'object' && (it.id !== undefined || it.uuid !== undefined || it.slug !== undefined));
|
|
3363
|
+
if (!first) continue;
|
|
3364
|
+
at = a.template.replace(/\{[^}]+\}/, encodeURIComponent(String(first.id !== undefined ? first.id : first.uuid !== undefined ? first.uuid : first.slug)));
|
|
3365
|
+
}
|
|
3366
|
+
let res;
|
|
3367
|
+
try { res = await rd.session.send('GET', at, {}); } catch (err) { if (authz.isRequestLimit(err)) break; throw err; }
|
|
3368
|
+
out.tried.push({ what: 'GET ' + a.template, as: rd.who, status: res.status });
|
|
3369
|
+
if (res.status !== 200 || res.json === undefined) continue;
|
|
3370
|
+
if (!a.params) { const l = listIn(res.json); if (l) lists.set(a.template, l); }
|
|
3371
|
+
const found = aiapp.scanAnswer(res.json);
|
|
3372
|
+
for (const s of found.secrets) {
|
|
3373
|
+
// a person's own token where signing in or connecting an account is the point is not a leak by itself
|
|
3374
|
+
if (!/^an? (Anthropic|OpenAI|Google API|Groq|Replicate|Hugging|OpenRouter|xAI|Stripe|Resend|SendGrid|Slack|GitHub)/.test(s.label) && aiapp.TOKEN_MEANT.test(a.template)) continue;
|
|
3375
|
+
if (!seenKeys.has(s.value)) seenKeys.set(s.value, []);
|
|
3376
|
+
seenKeys.get(s.value).push({ who: rd.who, account: !!rd.account, at: 'GET ' + a.template, field: s.field, path: s.path, label: s.label, length: s.value.length });
|
|
3377
|
+
}
|
|
3378
|
+
if (found.quiz.length && !aiapp.ANSWERS_MEANT.test(a.template) && !quiz.has('GET ' + a.template)) quiz.set('GET ' + a.template, { field: found.quiz[0].field, path: found.quiz[0].path, who: rd.who, count: found.quiz.length });
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3381
|
+
const done = new Set();
|
|
3382
|
+
for (const sightings of seenKeys.values()) {
|
|
3383
|
+
const first = sightings[0];
|
|
3384
|
+
if (done.has(first.at + '|' + first.field)) continue;
|
|
3385
|
+
done.add(first.at + '|' + first.field);
|
|
3386
|
+
const people = Array.from(new Set(sightings.map((x) => x.who)));
|
|
3387
|
+
const shared = people.length > 1 || people.includes('nobody signed in');
|
|
3388
|
+
const f = {
|
|
3389
|
+
kind: 'secret-in-answer', where: first.at, field: first.field || null, status: shared ? 'confirmed' : 'verification required', severity: shared ? 'HIGH' : 'MEDIUM',
|
|
3390
|
+
headline: shared
|
|
3391
|
+
? first.at + ' sends ' + first.label + ' to the browser of ' + (people.includes('nobody signed in') ? 'anyone, signed in or not' : 'more than one person') + ': whoever has it can use it as if they were your server'
|
|
3392
|
+
: first.at + ' sends ' + first.label + ' to the browser - to check: even shown only to its owner, anything running in that page can take it; the server should keep it and send at most its last 4 characters',
|
|
3393
|
+
proof: sightings.slice(0, 3).map((x) => 'As ' + x.who + ': ' + x.at + ' answered with ' + x.label + ' in ' + x.path + ' (' + x.length + ' characters, not shown).'),
|
|
3394
|
+
};
|
|
3395
|
+
f.fixPrompt = ['Kryptheon read what my running app sends to the browser:', '', f.headline + '.', '', f.proof.join('\n'), '',
|
|
3396
|
+
'Keep this value on the server only: remove it from that answer (send at most its last 4 characters, to show which one is set). If it is an API key that has been sent like this, make a new one at the provider and delete the old one. Change nothing else.'].join('\n');
|
|
3397
|
+
out.findings.push(f);
|
|
3398
|
+
}
|
|
3399
|
+
for (const [where, q] of quiz) {
|
|
3400
|
+
const f = {
|
|
3401
|
+
kind: 'quiz-answers-sent', where, field: q.field, status: 'verification required', severity: 'MEDIUM',
|
|
3402
|
+
headline: where + ' sends each question\'s right answer (' + q.field + ') along with it - to check: a student can read the answers in the browser before answering; fine only after they answer, or for a teacher',
|
|
3403
|
+
proof: ['As ' + q.who + ': ' + where + ' answered with ' + q.count + ' question' + (q.count === 1 ? '' : 's') + ' that each carry ' + q.field + ' (values not shown).'],
|
|
3404
|
+
};
|
|
3405
|
+
f.fixPrompt = ['Kryptheon read what my running app sends to the browser:', '', f.headline + '.', '', f.proof[0], '',
|
|
3406
|
+
'First check whether students see this answer. If they do, leave the right answers out of it, and check each answer on the server when it is sent; send which ones were right only in the result after answering. Change nothing else.'].join('\n');
|
|
3407
|
+
out.findings.push(f);
|
|
3408
|
+
}
|
|
3409
|
+
return out;
|
|
3410
|
+
}
|
|
3411
|
+
|
|
3412
|
+
/** Which answer finding a headline is, for a re-check that has only the headline: 'secret-in-answer', 'quiz-answers-sent' or null. */
|
|
3413
|
+
function answerKindOf(headline) {
|
|
3414
|
+
const h = String(headline || '');
|
|
3415
|
+
if (/^GET \S+ sends .+ to the browser/.test(h)) return 'secret-in-answer';
|
|
3416
|
+
if (/^GET \S+ sends each question's right answer/.test(h)) return 'quiz-answers-sent';
|
|
3417
|
+
return null;
|
|
3418
|
+
}
|
|
3419
|
+
|
|
3303
3420
|
/**
|
|
3304
3421
|
* The whole run on an app on this computer: across organizations and without
|
|
3305
3422
|
* a session, then bad values, then (only with the owner's permissions file and
|
|
@@ -3329,6 +3446,8 @@ async function runApi(root, options) {
|
|
|
3329
3446
|
}
|
|
3330
3447
|
};
|
|
3331
3448
|
const jobsRun = await contained('Jobs run twice', () => runJobs(root, shared));
|
|
3449
|
+
// read-only, and before anything below changes a record: what the app sends to the browser
|
|
3450
|
+
const answersRun = await contained('Keys and answers in what the app sends', () => runAnswers(root, shared));
|
|
3332
3451
|
const wall = await contained('Across organizations and without a session', () => runWall(root, shared));
|
|
3333
3452
|
const forged = await contained('Who is calling, as the request says', () => runForged(root, shared));
|
|
3334
3453
|
const webhooks = await contained('Webhooks', () => webhook.run(root, shared));
|
|
@@ -3349,14 +3468,14 @@ async function runApi(root, options) {
|
|
|
3349
3468
|
if (witness.ok && !opts.witness) await witness.close();
|
|
3350
3469
|
const verdicts = verdictsFor(toCheck, wall, invalid, roleRun, forged, webhooks, stepsRun, redirectsRun);
|
|
3351
3470
|
const seen = new Set();
|
|
3352
|
-
const findings = (grantsRun.ran ? grantsRun.findings : []).concat(refsRun.ran ? refsRun.findings : []).concat(wall.ran ? wall.findings : []).concat(redirectsRun.ran ? redirectsRun.findings : []).concat(refundsRun.ran ? refundsRun.findings : []).concat(forged.ran ? forged.findings : []).concat(webhooks.ran ? webhooks.findings : []).concat(exportsRun.ran ? exportsRun.findings : []).concat(jobsRun.ran ? jobsRun.findings : []).concat(keptRun.ran ? keptRun.findings : []).concat(createsRun.ran ? createsRun.findings : []).concat(limitsRun.ran ? limitsRun.findings : []).concat(stepsRun.ran ? stepsRun.findings : []).concat(onceRun.ran ? onceRun.findings : []).concat(roleRun && roleRun.ran ? roleRun.findings : []).concat(invalid.ran ? invalid.findings : []).filter((f) => {
|
|
3471
|
+
const findings = (grantsRun.ran ? grantsRun.findings : []).concat(answersRun.ran ? answersRun.findings : []).concat(refsRun.ran ? refsRun.findings : []).concat(wall.ran ? wall.findings : []).concat(redirectsRun.ran ? redirectsRun.findings : []).concat(refundsRun.ran ? refundsRun.findings : []).concat(forged.ran ? forged.findings : []).concat(webhooks.ran ? webhooks.findings : []).concat(exportsRun.ran ? exportsRun.findings : []).concat(jobsRun.ran ? jobsRun.findings : []).concat(keptRun.ran ? keptRun.findings : []).concat(createsRun.ran ? createsRun.findings : []).concat(limitsRun.ran ? limitsRun.findings : []).concat(stepsRun.ran ? stepsRun.findings : []).concat(onceRun.ran ? onceRun.findings : []).concat(roleRun && roleRun.ran ? roleRun.findings : []).concat(invalid.ran ? invalid.findings : []).filter((f) => {
|
|
3353
3472
|
const k = f.kind + '|' + f.where + '|' + (f.field || '');
|
|
3354
3473
|
return seen.has(k) ? false : (seen.add(k), true);
|
|
3355
3474
|
});
|
|
3356
3475
|
const left = (grantsRun.ran ? grantsRun.left : []).concat(refsRun.ran ? refsRun.left : []).concat(webhooks.ran ? webhooks.left : []).concat(refundsRun.ran ? refundsRun.left : []).concat(exportsRun.ran ? exportsRun.left : []).concat(jobsRun.ran ? jobsRun.left : []).concat(keptRun.ran ? keptRun.left : []).concat(createsRun.ran ? createsRun.left : []).concat(limitsRun.ran ? limitsRun.left : []).concat(stepsRun.ran ? stepsRun.left : []).concat(onceRun.ran ? onceRun.left : []).concat(wall.ran ? wall.result.seeded || [] : []).concat(roleRun && roleRun.ran ? roleRun.result.seeded || [] : []).concat(wall.ran ? leftBehind(wall.result.attempts) : []).concat(invalid.ran ? invalid.left : []).concat(roleRun && roleRun.ran ? leftBehind(roleRun.result.attempts) : []);
|
|
3357
3476
|
return {
|
|
3358
3477
|
ran: wall.ran || invalid.ran, why: wall.ran || invalid.ran ? null : wall.why, checkedAt: new Date().toISOString(),
|
|
3359
|
-
origin: opts.origin, grants: grantsRun, refs: refsRun, wall: wall, forged: forged, webhooks: webhooks, exports: exportsRun, jobs: jobsRun, kept: keptRun, creates: createsRun, limits: limitsRun, steps: stepsRun, redirects: redirectsRun, refunds: refundsRun, stepsAtOnce: onceRun, invalid: invalid, roles: roleRun, verdicts: verdicts, findings: findings, left: left,
|
|
3478
|
+
origin: opts.origin, grants: grantsRun, refs: refsRun, wall: wall, forged: forged, webhooks: webhooks, exports: exportsRun, jobs: jobsRun, kept: keptRun, creates: createsRun, limits: limitsRun, steps: stepsRun, redirects: redirectsRun, refunds: refundsRun, stepsAtOnce: onceRun, answers: answersRun, invalid: invalid, roles: roleRun, verdicts: verdicts, findings: findings, left: left,
|
|
3360
3479
|
notTried: (wall.plan ? wall.plan.notTried : []).concat(invalid.ran ? invalid.notTried : []),
|
|
3361
3480
|
writes: writesOf(m, wall),
|
|
3362
3481
|
};
|
|
@@ -3465,6 +3584,13 @@ async function runLive(root, options) {
|
|
|
3465
3584
|
}
|
|
3466
3585
|
}
|
|
3467
3586
|
const stub = { ran: false, why: 'not on a live app - it writes; run it on a test copy' };
|
|
3587
|
+
let answersRun;
|
|
3588
|
+
try {
|
|
3589
|
+
answersRun = await runAnswers(root, Object.assign({}, opts, { map: m, origin, readOnly: true }));
|
|
3590
|
+
} catch (err) {
|
|
3591
|
+
if (!(err && (err.code === authz.READ_ONLY || authz.isRequestLimit(err)))) throw err;
|
|
3592
|
+
answersRun = { ran: false, why: 'stopped: ' + err.message };
|
|
3593
|
+
}
|
|
3468
3594
|
// Judged first, then every string kept from the tries masked - the answers, their excerpts, the lines printed from
|
|
3469
3595
|
// them: a live app's records are real people's, and none of their values is shown or saved.
|
|
3470
3596
|
const maskDeep = (v, depth) => {
|
|
@@ -3487,7 +3613,7 @@ async function runLive(root, options) {
|
|
|
3487
3613
|
if (roleRun.ran) { roleRun.result = maskDeep(roleRun.result, 0); roleRun.findings = maskDeep(roleRun.findings, 0); }
|
|
3488
3614
|
// the roles run keeps organizations apart too, so it finds the same reads across organizations again: said once
|
|
3489
3615
|
const seenLive = new Set();
|
|
3490
|
-
const findings = (wall.findings || []).concat(roleRun.ran ? roleRun.findings : []).filter((f) => {
|
|
3616
|
+
const findings = (wall.findings || []).concat(roleRun.ran ? roleRun.findings : []).concat(answersRun.ran ? answersRun.findings : []).filter((f) => {
|
|
3491
3617
|
const k = f.kind + '|' + f.where + '|' + (f.field || '');
|
|
3492
3618
|
return seenLive.has(k) ? false : (seenLive.add(k), true);
|
|
3493
3619
|
}).map((f) => maskDeep(Object.assign({}, f, { live: true }), 0));
|
|
@@ -3495,7 +3621,7 @@ async function runLive(root, options) {
|
|
|
3495
3621
|
return {
|
|
3496
3622
|
ran: true, live: true, why: null, checkedAt: new Date().toISOString(), origin,
|
|
3497
3623
|
wall, forged: stub, webhooks: stub, exports: stub, jobs: stub, kept: stub, creates: stub, limits: stub, steps: stub, redirects: stub, refunds: stub, stepsAtOnce: stub,
|
|
3498
|
-
roles: roleRun, invalid: stub, grants: stub, refs: stub,
|
|
3624
|
+
roles: roleRun, invalid: stub, grants: stub, refs: stub, answers: answersRun,
|
|
3499
3625
|
findings, left: [], leftOut: LIVE_LEFT_OUT,
|
|
3500
3626
|
verdicts: verdictsFor(toCheck, wall, stub, roleRun.ran ? roleRun : null, stub, stub, stub, stub),
|
|
3501
3627
|
notTried: wall.plan ? wall.plan.notTried : [],
|
|
@@ -3685,4 +3811,4 @@ function apiLines(run) {
|
|
|
3685
3811
|
return out;
|
|
3686
3812
|
}
|
|
3687
3813
|
|
|
3688
|
-
module.exports = { dbTargetsFor, stepTableOf, dbRecordsFor, runLive, maskValues, LIVE_LEFT_OUT, tokenAccountsOf, TOKEN_PREFIX, limitPairsIn, dbDoubleEffects, oneLeft, inferPermissions, grantRulesOf, runGrants, runRefs, probesOf, stepEffectOf, reconcile, isUpdateRoute, storedAs, updateProbesOf, heldStrength, runSteps, runRedirects, OUTSIDE, runRefundCap, PLUMBING, runStepsAtOnce, doubleEffects, numbersMoved, runKept, runCreates, COSTLY_RECORD, runLimits, limitPairOf, valueIn, plainFieldOf, runJobs, countsIn, JOB_PATH, runForged, personIn, REPORT_FILE, verdictsFor, runApi, reportOf, saveReport, apiLines, badValueFor, runInvalid, signInOf, emailsIn, accountsOf, wordsOf, sampleValue, allowedByName, actionOf, journeyFromMap, planOf, planLines, wallPolicy, runWall, findingsOf, fixPrompt, leftBehind, wallLines, DRAFT_FILE, permissionName, draftPolicy, writeDraft, runRoles };
|
|
3814
|
+
module.exports = { answerKindOf, runAnswers, dbTargetsFor, stepTableOf, dbRecordsFor, runLive, maskValues, LIVE_LEFT_OUT, tokenAccountsOf, TOKEN_PREFIX, limitPairsIn, dbDoubleEffects, oneLeft, inferPermissions, grantRulesOf, runGrants, runRefs, probesOf, stepEffectOf, reconcile, isUpdateRoute, storedAs, updateProbesOf, heldStrength, runSteps, runRedirects, OUTSIDE, runRefundCap, PLUMBING, runStepsAtOnce, doubleEffects, numbersMoved, runKept, runCreates, COSTLY_RECORD, runLimits, limitPairOf, valueIn, plainFieldOf, runJobs, countsIn, JOB_PATH, runForged, personIn, REPORT_FILE, verdictsFor, runApi, reportOf, saveReport, apiLines, badValueFor, runInvalid, signInOf, emailsIn, accountsOf, wordsOf, sampleValue, allowedByName, actionOf, journeyFromMap, planOf, planLines, wallPolicy, runWall, findingsOf, fixPrompt, leftBehind, wallLines, DRAFT_FILE, permissionName, draftPolicy, writeDraft, runRoles };
|
package/kryptheon-map.js
CHANGED
|
@@ -38,6 +38,7 @@ const fs = require('fs');
|
|
|
38
38
|
const path = require('path');
|
|
39
39
|
const keys = require('./kryptheon-keys.js');
|
|
40
40
|
const code = require('./kryptheon-code.js');
|
|
41
|
+
const aiapp = require('./kryptheon-aiapp.js');
|
|
41
42
|
|
|
42
43
|
const SKIP_DIRS = new Set([
|
|
43
44
|
'node_modules', '.git', 'dist', 'build', 'out', '.next', '.nuxt', '.svelte-kit',
|
|
@@ -103,6 +104,9 @@ function listFiles(root) {
|
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
/** A line of code fit to print: trimmed, short, and with any key in it masked. */
|
|
107
|
+
// what kryptheon-aiapp.js borrows to read a handler: the same names, the same way of following them
|
|
108
|
+
const AI_HELPERS = { requireOf: (t, n) => requireOf(t, n), memberChain: (n) => memberChain(n), resolveRef: (ctx, mod, p) => resolveRef(ctx, mod, p), snippet: (mod, line) => snippet(mod, line) };
|
|
109
|
+
|
|
106
110
|
function snippet(mod, line) {
|
|
107
111
|
let text = (mod.lines[line - 1] || '').trim();
|
|
108
112
|
try {
|
|
@@ -2682,6 +2686,7 @@ function edgeRoutes(ctx, root, schema) {
|
|
|
2682
2686
|
const g = judge({}, [element]);
|
|
2683
2687
|
const db = readDb(ctx, handler, schema);
|
|
2684
2688
|
const validation = readValidation(ctx, handler, [element], db);
|
|
2689
|
+
const ai = aiapp.routeAi(ctx, AI_HELPERS, handler, { path: '/functions/v1/' + name, middleware: [] });
|
|
2685
2690
|
// true / false from supabase/config.toml; null when it does not say (a deploy flag like --no-verify-jwt is not in the code)
|
|
2686
2691
|
const verify = jwt.has(name) ? jwt.get(name) : null;
|
|
2687
2692
|
routes.push({
|
|
@@ -2703,6 +2708,7 @@ function edgeRoutes(ctx, root, schema) {
|
|
|
2703
2708
|
: 'supabase/config.toml does not say: the platform asks for a JWT unless the function is deployed with --no-verify-jwt, which the code does not show - and the public anon key is a valid JWT, so this alone never means signed in' },
|
|
2704
2709
|
db,
|
|
2705
2710
|
validation,
|
|
2711
|
+
...(ai ? { ai } : {}),
|
|
2706
2712
|
});
|
|
2707
2713
|
}
|
|
2708
2714
|
return routes;
|
|
@@ -2838,6 +2844,7 @@ function nextRoutes(ctx, schema) {
|
|
|
2838
2844
|
const methods = el && el.guards && el.guards.methods;
|
|
2839
2845
|
const db = handlerRef.kind === 'fn' ? readDb(ctx, handlerRef, schema) : [];
|
|
2840
2846
|
const validation = handlerRef.kind === 'fn' ? readValidation(ctx, handlerRef, elements, db) : { fields: [], schemas: [] };
|
|
2847
|
+
const ai = handlerRef.kind === 'fn' ? aiapp.routeAi(ctx, AI_HELPERS, handlerRef, { path: p, middleware: elements.map((e) => ({ name: e.text, source: e.source || null, file: e.file || null, line: e.line || null, usedFile: e.usedFile, usedLine: e.usedLine })) }) : null;
|
|
2841
2848
|
routes.push({
|
|
2842
2849
|
method: method === 'ANY' && methods && methods.size === 1 ? Array.from(methods)[0] : method,
|
|
2843
2850
|
methods: method === 'ANY' && methods && methods.size > 1 ? Array.from(methods).sort() : undefined,
|
|
@@ -2855,6 +2862,7 @@ function nextRoutes(ctx, schema) {
|
|
|
2855
2862
|
note: f.note,
|
|
2856
2863
|
db,
|
|
2857
2864
|
validation,
|
|
2865
|
+
...(ai ? { ai } : {}),
|
|
2858
2866
|
});
|
|
2859
2867
|
};
|
|
2860
2868
|
// a package that wraps the handler: withApiAuthRequired(handler) protects it; another one is not read
|
|
@@ -3025,6 +3033,7 @@ function mapProject(root, options) {
|
|
|
3025
3033
|
const db = h ? readDb(ctx, h, schema) : [];
|
|
3026
3034
|
const validation = h ? readValidation(ctx, h, elements, db) : { fields: [], schemas: [], why: 'the handler could not be followed' };
|
|
3027
3035
|
const redirects = h ? readRedirects(ctx, h) : [];
|
|
3036
|
+
const ai = h ? aiapp.routeAi(ctx, AI_HELPERS, h, { path: r.path, middleware: elements.map((e) => ({ name: e.text, source: e.source || null, file: e.file || null, line: e.line || null, usedFile: e.usedFile, usedLine: e.usedLine })) }) : null;
|
|
3028
3037
|
return {
|
|
3029
3038
|
method: r.method,
|
|
3030
3039
|
path: r.path,
|
|
@@ -3040,6 +3049,7 @@ function mapProject(root, options) {
|
|
|
3040
3049
|
db,
|
|
3041
3050
|
validation,
|
|
3042
3051
|
redirects,
|
|
3052
|
+
...(ai ? { ai } : {}),
|
|
3043
3053
|
};
|
|
3044
3054
|
});
|
|
3045
3055
|
routes.push(...edgeRoutes(ctx, root, schema));
|
|
@@ -3073,6 +3083,9 @@ const ADVICE = {
|
|
|
3073
3083
|
'tenant-from-request': 'take the organisation from the signed-in person\'s session, never from the request body or query string; for an id the request sends, look the record up with the organisation condition before using it.',
|
|
3074
3084
|
'tenant-unscoped': 'add the signed-in person\'s organisation (or owner) to the statement - WHERE org_id = <the session\'s org> - or, for a row found by its id, check that the row belongs to that organisation before using it.',
|
|
3075
3085
|
'no-role': 'allow only the roles that should be able to do this, and answer 403 for the others.',
|
|
3086
|
+
'ai-open': 'require a signed-in person before it asks the AI (answer 401 otherwise), and add a limit on how many questions one person and one address may ask per minute and per day, kept on the server. If this route is meant to be open to anyone (a public demo), keep it open but add that limit, and tell me so.',
|
|
3087
|
+
'ai-no-limit': 'add a limit on how many questions one signed-in person may ask, per minute and per day, kept on the server (not in the browser), and answer 429 when it is reached. Keep the rest of the route as it is.',
|
|
3088
|
+
'ai-acts-alone': 'do not send or call what the AI wrote straight away: save it as a draft, and send it only when the person presses an approve button - and only to an address the person chose, never one the AI picked from what it read. Keep the rest of the route as it is.',
|
|
3076
3089
|
'open-redirect': 'send the browser only to an address on this site: accept a path that starts with a single "/" (not "//", not "/\\\\", no "http"), or a name from a fixed list of places, and fall back to "/" for anything else. Keep the rest of the route as it is.',
|
|
3077
3090
|
'no-state-check': 'look at the record\'s status first and refuse the step when the record is not in the status it must come from (WHERE status = <the one before> in the same statement, or a check that answers 409). A second call must change nothing - no stock, money or log entry added again.',
|
|
3078
3091
|
'identity-from-request': 'take who is calling only from something the server itself issued and can check - a signed session cookie (express-session, a signed JWT) - never from a bare user id in a cookie or a header the browser can set. Look the session up on the server and set req.user from that.',
|
|
@@ -3123,6 +3136,23 @@ function toCheck(map) {
|
|
|
3123
3136
|
for (const rd of r.redirects || []) {
|
|
3124
3137
|
add(r, 'open-redirect', 'MEDIUM', name + ' sends the browser to the address in ' + rd.from + '.' + rd.field + ' with nothing checking it first: a link to your app can land people on any other site', [(rd.file || r.file) + ':' + rd.line + ' ' + rd.code]);
|
|
3125
3138
|
}
|
|
3139
|
+
// a route that asks an AI: every answer is on the owner's bill, and what the AI wrote may be sent in their name.
|
|
3140
|
+
// Never sent to on the running app - read from the code only.
|
|
3141
|
+
if (r.ai && r.ai.calls && r.ai.calls.length) {
|
|
3142
|
+
const prov = aiapp.providerName(r.ai.calls[0].provider);
|
|
3143
|
+
const callAt = r.ai.calls.slice(0, 2).map((c) => c.file + ':' + c.line + ' ' + (c.code || ''));
|
|
3144
|
+
if (r.auth.status === STATUS.NOT && !r.ai.limited && !AUTH_PATH.test(r.path || '')) {
|
|
3145
|
+
add(r, 'ai-open', 'HIGH', name + ' asks ' + prov + ', with no sign-in check and no limit in front of it: anyone who finds the address can use your AI account, and every answer is on your bill', [r.file + ':' + r.line].concat(callAt));
|
|
3146
|
+
} else if (r.auth.status === STATUS.DETECTED && !r.ai.limited) {
|
|
3147
|
+
add(r, 'ai-no-limit', 'MEDIUM', name + ' asks ' + prov + ', and no limit on how often one person may call it was found: one account, or a script signed in as one, can run up your AI bill', [r.file + ':' + r.line].concat(callAt));
|
|
3148
|
+
}
|
|
3149
|
+
const acts = r.ai.approval ? [] : r.ai.acts || [];
|
|
3150
|
+
if (acts.length) {
|
|
3151
|
+
const a = acts[0];
|
|
3152
|
+
add(r, 'ai-acts-alone', 'MEDIUM', name + ' ' + a.what + (a.tool ? ' whenever the AI decides to (it is one of the AI\'s tools)' : ' with what the AI wrote') + ', and no step where a person approves it first was found: text written to trick the AI, in an email or a page it reads, can make it ' + (a.what === 'calls an address the AI chose' ? 'call any address' : 'send anything to anyone'),
|
|
3153
|
+
acts.slice(0, 3).map((x) => x.file + ':' + x.line + ' ' + (x.code || '')).concat(callAt.slice(0, 1)));
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3126
3156
|
// a route with no sign-in that changes something - sign-in and sign-up routes are open by nature
|
|
3127
3157
|
if (writes && r.auth.status === STATUS.NOT && changing.length && !AUTH_PATH.test(r.path || '')) {
|
|
3128
3158
|
add(r, 'no-sign-in', 'HIGH', name + ' ' + tables(changing) + ', and no sign-in check was found in front of it', [r.file + ':' + r.line].concat(changing.slice(0, 3).map((d) => d.file + ':' + d.line + ' ' + d.sql)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kryptheon",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.72",
|
|
4
4
|
"description": "Record what you do in your app and get plain-language reports when it breaks.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"kryptheon-roles.js",
|
|
59
59
|
"kryptheon-map.js",
|
|
60
60
|
"kryptheon-api.js",
|
|
61
|
+
"kryptheon-aiapp.js",
|
|
61
62
|
"kryptheon-webhook.js",
|
|
62
63
|
"kryptheon-csv.js",
|
|
63
64
|
"kryptheon-witness.js",
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
"pg": "^8.23.0"
|
|
74
75
|
},
|
|
75
76
|
"scripts": {
|
|
76
|
-
"check": "node kryptheon-store.check.js && node kryptheon-code.check.js && node kryptheon-constdata.check.js && node kryptheon-listitems.check.js && node kryptheon-accept.check.js && node kryptheon-keys.check.js && node kryptheon-dashboard.check.js && node kryptheon-edge.check.js && node kryptheon-reliability.check.js && node kryptheon-fresh.check.js && node kryptheon-payments-dash.check.js && node kryptheon-embedded.check.js && node kryptheon-autostart.check.js && node kryptheon-changes.check.js && node kryptheon-look.check.js && node kryptheon-verify.check.js && node kryptheon-recheck.check.js && node kryptheon-reporter.check.js && node kryptheon-signature.check.js && node kryptheon-signature.stream.check.js && node kryptheon-signature.baseline.check.js && node kryptheon-signature.settle.check.js && node kryptheon-signature.number.check.js && node kryptheon-signature.rows.check.js && node kryptheon-env.check.js && node kryptheon-watchdog.check.js && node kryptheon-phone.check.js && node kryptheon-homedash.check.js && node kryptheon-record.check.js && node kryptheon-selectors.check.js && node kryptheon-recordings.check.js && node kryptheon-testfiles.check.js && node kryptheon-cleanup.check.js && node kryptheon-orphan.check.js && node kryptheon-project.check.js && node kryptheon-setup.check.js && node kryptheon-browser.check.js && node kryptheon-heal.check.js && node kryptheon-load.check.js && node kryptheon-authz.check.js && node kryptheon-roles.check.js && node kryptheon-map.check.js && node kryptheon-api.check.js && node kryptheon-webhook.check.js && node kryptheon-csv.check.js && node kryptheon-witness.check.js && node kryptheon-round34.check.js && node kryptheon-token.check.js && node kryptheon-questions.check.js && node kryptheon-daily.check.js && node kryptheon-live.check.js && node kryptheon-aim.check.js && node kryptheon-peruser.check.js && node kryptheon-package.check.js && node kryptheon-newer.check.js",
|
|
77
|
+
"check": "node kryptheon-store.check.js && node kryptheon-code.check.js && node kryptheon-constdata.check.js && node kryptheon-listitems.check.js && node kryptheon-accept.check.js && node kryptheon-keys.check.js && node kryptheon-dashboard.check.js && node kryptheon-edge.check.js && node kryptheon-reliability.check.js && node kryptheon-fresh.check.js && node kryptheon-payments-dash.check.js && node kryptheon-embedded.check.js && node kryptheon-autostart.check.js && node kryptheon-changes.check.js && node kryptheon-look.check.js && node kryptheon-verify.check.js && node kryptheon-recheck.check.js && node kryptheon-reporter.check.js && node kryptheon-signature.check.js && node kryptheon-signature.stream.check.js && node kryptheon-signature.baseline.check.js && node kryptheon-signature.settle.check.js && node kryptheon-signature.number.check.js && node kryptheon-signature.rows.check.js && node kryptheon-env.check.js && node kryptheon-watchdog.check.js && node kryptheon-phone.check.js && node kryptheon-homedash.check.js && node kryptheon-record.check.js && node kryptheon-selectors.check.js && node kryptheon-recordings.check.js && node kryptheon-testfiles.check.js && node kryptheon-cleanup.check.js && node kryptheon-orphan.check.js && node kryptheon-project.check.js && node kryptheon-setup.check.js && node kryptheon-browser.check.js && node kryptheon-heal.check.js && node kryptheon-load.check.js && node kryptheon-authz.check.js && node kryptheon-roles.check.js && node kryptheon-map.check.js && node kryptheon-api.check.js && node kryptheon-webhook.check.js && node kryptheon-csv.check.js && node kryptheon-witness.check.js && node kryptheon-round34.check.js && node kryptheon-token.check.js && node kryptheon-questions.check.js && node kryptheon-daily.check.js && node kryptheon-live.check.js && node kryptheon-aim.check.js && node kryptheon-peruser.check.js && node kryptheon-aiapp.check.js && node kryptheon-package.check.js && node kryptheon-newer.check.js",
|
|
77
78
|
"check:store": "node kryptheon-store.check.js",
|
|
78
79
|
"check:code": "node kryptheon-code.check.js",
|
|
79
80
|
"check:constdata": "node kryptheon-constdata.check.js",
|
|
@@ -128,7 +129,8 @@
|
|
|
128
129
|
"check:aim": "node kryptheon-aim.check.js",
|
|
129
130
|
"check:peruser": "node kryptheon-peruser.check.js",
|
|
130
131
|
"check:newer": "node kryptheon-newer.check.js",
|
|
131
|
-
"check:account": "node kryptheon-account.check.js"
|
|
132
|
+
"check:account": "node kryptheon-account.check.js",
|
|
133
|
+
"check:aiapp": "node kryptheon-aiapp.check.js"
|
|
132
134
|
},
|
|
133
135
|
"keywords": [
|
|
134
136
|
"playwright",
|