kryptheon 0.1.67 → 0.1.69

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/LICENSE CHANGED
@@ -1,38 +1,38 @@
1
- Kryptheon Software License
2
-
3
- Copyright (c) 2026 Kryptheon (https://kryptheon.tech). All rights reserved.
4
-
5
- This software is proprietary. It is not open source.
6
-
7
- 1. Use. You may install and run this software, as published by Kryptheon,
8
- at no charge, to check software and databases that you own or are
9
- authorised to test. Features that kryptheon.tech offers on a paid plan
10
- are provided only under that plan and the Terms at
11
- https://kryptheon.tech/terms.
12
-
13
- 2. Restrictions. Without Kryptheon's written permission you may not:
14
- (a) copy, modify, translate or create derivative works of this software,
15
- except as needed to run it;
16
- (b) sell, sublicense, rent, publish or otherwise distribute it, or offer
17
- it, or anything derived from it, as a hosted or managed service;
18
- (c) remove, disable or work around any licence, plan or usage limit, or
19
- any part of the software that enforces them;
20
- (d) use it, or any part of it, to build a competing product.
21
-
22
- 3. No warranty. The software is provided "as is", without warranty of any
23
- kind, express or implied, including fitness for a particular purpose.
24
- It may miss problems; a check that finds nothing does not mean that
25
- nothing is wrong. You are responsible for what you test and for keeping
26
- your own backups.
27
-
28
- 4. Limitation of liability. To the extent the law allows, Kryptheon is not
29
- liable for any damages arising from the use of, or inability to use,
30
- this software.
31
-
32
- 5. Earlier versions. Versions published before this licence was added keep
33
- the licence they were published with.
34
-
35
- 6. Termination. This licence ends automatically if you break it. When it
36
- ends, you must stop using the software and delete your copies.
37
-
38
- Questions: company@kryptheon.tech
1
+ Kryptheon Software License
2
+
3
+ Copyright (c) 2026 Kryptheon (https://kryptheon.tech). All rights reserved.
4
+
5
+ This software is proprietary. It is not open source.
6
+
7
+ 1. Use. You may install and run this software, as published by Kryptheon,
8
+ at no charge, to check software and databases that you own or are
9
+ authorised to test. Features that kryptheon.tech offers on a paid plan
10
+ are provided only under that plan and the Terms at
11
+ https://kryptheon.tech/terms.
12
+
13
+ 2. Restrictions. Without Kryptheon's written permission you may not:
14
+ (a) copy, modify, translate or create derivative works of this software,
15
+ except as needed to run it;
16
+ (b) sell, sublicense, rent, publish or otherwise distribute it, or offer
17
+ it, or anything derived from it, as a hosted or managed service;
18
+ (c) remove, disable or work around any licence, plan or usage limit, or
19
+ any part of the software that enforces them;
20
+ (d) use it, or any part of it, to build a competing product.
21
+
22
+ 3. No warranty. The software is provided "as is", without warranty of any
23
+ kind, express or implied, including fitness for a particular purpose.
24
+ It may miss problems; a check that finds nothing does not mean that
25
+ nothing is wrong. You are responsible for what you test and for keeping
26
+ your own backups.
27
+
28
+ 4. Limitation of liability. To the extent the law allows, Kryptheon is not
29
+ liable for any damages arising from the use of, or inability to use,
30
+ this software.
31
+
32
+ 5. Earlier versions. Versions published before this licence was added keep
33
+ the licence they were published with.
34
+
35
+ 6. Termination. This licence ends automatically if you break it. When it
36
+ ends, you must stop using the software and delete your copies.
37
+
38
+ Questions: company@kryptheon.tech
package/bin/kryptheon.js CHANGED
@@ -2552,7 +2552,7 @@ async function apiCommand(args) {
2552
2552
  console.log('');
2553
2553
  return written.ok ? 0 : 2;
2554
2554
  }
2555
- if (!args.includes('--run')) {
2555
+ if (!args.includes('--run') && !args.includes('--live')) {
2556
2556
  for (const line of api.planLines(api.planOf(USER_DIR, { packageDir: PACKAGE_DIR }))) console.log(line);
2557
2557
  console.log(' To try them on your app on this computer: npx kryptheon api --run --origin http://localhost:3000 --yes');
2558
2558
  console.log(' Use a test copy: it adds test data and never deletes it.');
@@ -2560,6 +2560,31 @@ async function apiCommand(args) {
2560
2560
  return 0;
2561
2561
  }
2562
2562
  const origin = flagValue(args, '--origin');
2563
+ // --live: an app that is not on this computer, read-only (GET only, values never kept)
2564
+ if (args.includes('--live')) {
2565
+ if (!origin) { console.error('\n --live needs --origin, the address of your live app (for example https://my-app.lovable.app).\n'); return 2; }
2566
+ if (!args.includes('--yes')) {
2567
+ console.log('');
2568
+ console.log(' This signs in to ' + origin + ' as the test accounts in your .env and only READS: every page and list the');
2569
+ console.log(' code serves, as each account, aimed at another organization\'s records, and with no session. It never creates,');
2570
+ console.log(' changes or deletes anything - any other request is refused before it is sent - and it never keeps the');
2571
+ console.log(' values it reads, only field names and counts. Checks that write run only on a test copy. To go ahead, add --yes.');
2572
+ console.log('');
2573
+ return 2;
2574
+ }
2575
+ const mm = reader.mapProject(USER_DIR, { packageDir: PACKAGE_DIR });
2576
+ const liveRun = await api.runLive(USER_DIR, { map: mm, toCheck: mm.ran ? reader.toCheck(mm) : [], origin: origin, packageDir: PACKAGE_DIR, say: (line) => console.log(' ' + line) });
2577
+ for (const line of api.apiLines(liveRun)) console.log(line);
2578
+ if (liveRun.ran) {
2579
+ console.log(' Not run on a live app (each writes - run them on a test copy):');
2580
+ for (const l of api.LIVE_LEFT_OUT) console.log(' - ' + l);
2581
+ const saved = api.saveReport(opened.dir, liveRun);
2582
+ console.log(saved.ok ? ' Saved: ' + saved.file : ' (could not save this run: ' + saved.why + ')');
2583
+ console.log('');
2584
+ }
2585
+ if (!liveRun.ran) return 2;
2586
+ return liveRun.findings.some((f) => f.status === 'confirmed') ? 1 : 0;
2587
+ }
2563
2588
  if (!origin) {
2564
2589
  console.error('');
2565
2590
  console.error(' --run needs --origin, the address of your app on this computer (for example http://localhost:3000).');
@@ -2570,6 +2595,8 @@ async function apiCommand(args) {
2570
2595
  console.log('');
2571
2596
  console.log(' This signs in to ' + origin + ' as the accounts whose passwords are in your .env, and sends requests that must be refused');
2572
2597
  console.log(' (another organization\'s records, no session, values that should be turned away). It adds test data and never deletes it.');
2598
+ console.log(' If your .env holds a Postgres connection string for this computer (DATABASE_URL), it also READS that database,');
2599
+ console.log(' read-only, before and after its tries - to see what your pages do not show. It never reads a database on another computer.');
2573
2600
  console.log(' Run it on a test copy only. To go ahead, add --yes.');
2574
2601
  console.log('');
2575
2602
  return 2;
@@ -2890,6 +2917,38 @@ async function probeRecheckCommand(target, options) {
2890
2917
  return r.verdict === 'fixed' && !r.newProblems.length ? 0 : 1;
2891
2918
  }
2892
2919
 
2920
+ async function apiRecheckCommand(target, opened) {
2921
+ const api = require(path.join(PACKAGE_DIR, 'kryptheon-api.js'));
2922
+ let last = null;
2923
+ try { last = JSON.parse(fs.readFileSync(path.join(opened.dir, 'api-last.json'), 'utf8')); } catch (err) { last = null; }
2924
+ const origin = last && last.origin;
2925
+ const attempt = { id: target.id, at: new Date().toISOString(), check: 'api', where: target.where, headline: target.headline, verdict: 'could not confirm', why: '', newProblems: [], alsoFixed: [] };
2926
+ console.log('');
2927
+ console.log(' RE-CHECK ' + target.id + ' ' + target.where);
2928
+ console.log(' ' + target.headline);
2929
+ console.log('');
2930
+ if (!origin) {
2931
+ attempt.why = 'the address it was found on is not known - run Check my app again';
2932
+ } else if (!/^(GET|HEAD) /.test(String(target.where))) {
2933
+ attempt.why = 'it was proven by a change (' + String(target.where).split(' ')[0] + '), which a re-check does not send - run Check my app again on a test copy to see it held';
2934
+ } else {
2935
+ console.log(' Reading ' + origin + ' again, read-only - nothing is added to your app...');
2936
+ const run = await api.runLive(USER_DIR, { origin, packageDir: PACKAGE_DIR, say: () => {} });
2937
+ if (!run.ran) attempt.why = run.why;
2938
+ else {
2939
+ 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
+ const tried = run.wall && run.wall.ran && run.wall.result.attempts.some((a) => a.method + ' ' + a.template === target.where && !a.notTried);
2941
+ if (still) { attempt.verdict = 'still open'; attempt.why = 'it still answered: ' + still.headline; }
2942
+ else if (tried || (run.roles && run.roles.ran)) attempt.verdict = 'fixed';
2943
+ else attempt.why = 'that address could not be tried again (no record to aim it at, or no account that may not read it)';
2944
+ }
2945
+ }
2946
+ try { fs.appendFileSync(opened.fixes, JSON.stringify(attempt) + '\n', 'utf8'); } catch (err) { attempt.saveError = err.message; }
2947
+ console.log(' VERDICT ' + VERDICT_WORDS[attempt.verdict] + (attempt.why ? ' - ' + attempt.why : ''));
2948
+ console.log('');
2949
+ return attempt.verdict === 'fixed' ? 0 : attempt.verdict === 'still open' ? 1 : 2;
2950
+ }
2951
+
2893
2952
  function recheckCommand(id, options) {
2894
2953
  const here = project.inspectProject(USER_DIR);
2895
2954
  if (!here.ok) {
@@ -2935,6 +2994,11 @@ function recheckCommand(id, options) {
2935
2994
  const probeTarget = dash.buildState(USER_DIR).findings.find((f) => f.id === String(id).trim() && PROBE_CHECKS[f.check]);
2936
2995
  if (probeTarget) return probeRecheckCommand(probeTarget, options);
2937
2996
 
2997
+ // A finding of the API check: tried again READ-ONLY on the address it was found on - nothing is added to the app,
2998
+ // so nothing is asked. A read is proven again or not; a finding proven by a change cannot be, and says so.
2999
+ const apiTarget = dash.buildState(USER_DIR).findings.find((f) => f.id === String(id).trim() && f.check === 'api');
3000
+ if (apiTarget) return apiRecheckCommand(apiTarget, opened);
3001
+
2938
3002
  const r = looker.recheck(USER_DIR, { frontend: () => readCodeAndSave(opened), backend: () => readMapAndSave(opened), regression: replayForLoop }, String(id).trim());
2939
3003
  console.log('');
2940
3004
  if (!r.found) {
@@ -3120,12 +3184,12 @@ function appAnswers(origin) {
3120
3184
  * person types, with --roles, as a child. It listens for no stop message, and
3121
3185
  * sends only HTTP requests - no browser to close - so Stop ends it outright.
3122
3186
  */
3123
- async function apiFromDashboard(origin, say, control) {
3187
+ async function apiFromDashboard(origin, say, control, readOnly) {
3124
3188
  if (!(await appAnswers(origin))) {
3125
- return { ok: false, why: 'your app at ' + origin + ' is not answering - start it (for example npm run dev), then press Check my app again' };
3189
+ return { ok: false, why: 'your app at ' + origin + ' is not answering' + (readOnly ? '' : ' - start it (for example npm run dev), then press Check my app again') };
3126
3190
  }
3127
3191
  let stopped = false;
3128
- const { code } = await kryptheonChild(['api', '--run', '--origin', origin, '--roles', '--yes'], say, (child) => control.onStop(() => {
3192
+ const { code } = await kryptheonChild(readOnly ? ['api', '--live', '--origin', origin, '--yes'] : ['api', '--run', '--origin', origin, '--roles', '--yes'], say, (child) => control.onStop(() => {
3129
3193
  stopped = true;
3130
3194
  try { child.kill(); } catch (err) { /* already gone */ }
3131
3195
  }));
@@ -3160,7 +3224,7 @@ async function everythingFromDashboard(steps, opened, say, control, info) {
3160
3224
  stopStep = null;
3161
3225
  let r;
3162
3226
  try {
3163
- if (s.id === 'api') r = await apiFromDashboard(s.origin, say, step);
3227
+ if (s.id === 'api') r = await apiFromDashboard(s.origin, say, step, s.readOnly === true);
3164
3228
  else if (PROBE_CHECKS[s.id]) r = await probeFromDashboard(s.id, say, step, info.confirmed);
3165
3229
  else r = await runFromDashboard(s.id, opened, say);
3166
3230
  } catch (err) {