@clear-capabilities/agentic-security-scanner 0.147.0 → 0.148.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +204 -0
  2. package/bin/agentic-security.js +47 -15
  3. package/dist/1122.index.js +79 -2
  4. package/dist/3180.index.js +73 -1
  5. package/dist/5051.index.js +77 -6
  6. package/dist/agentic-security.mjs +2 -2
  7. package/dist/agentic-security.mjs.sha256 +1 -1
  8. package/dist/compliance-frameworks/nist-800-171-r3.json +1269 -0
  9. package/dist/frontend/index.html +21 -0
  10. package/dist/frontend/src/app.js +176 -0
  11. package/dist/frontend/src/components/evidence-inspector.js +141 -0
  12. package/dist/frontend/src/components/filter-rail.js +119 -0
  13. package/dist/frontend/src/components/query-bar.js +126 -0
  14. package/dist/frontend/src/data/flagship-graph.js +1460 -0
  15. package/dist/frontend/src/export-entry.js +36 -0
  16. package/dist/frontend/src/lib/api-client.js +92 -0
  17. package/dist/frontend/src/lib/contrast.js +34 -0
  18. package/dist/frontend/src/lib/dom.js +24 -0
  19. package/dist/frontend/src/lib/escape-html.js +16 -0
  20. package/dist/frontend/src/lib/flow-path.js +40 -0
  21. package/dist/frontend/src/lib/focus-controls.js +149 -0
  22. package/dist/frontend/src/lib/protection-visual.js +46 -0
  23. package/dist/frontend/src/lib/query-language.js +240 -0
  24. package/dist/frontend/src/lib/row-filters.js +43 -0
  25. package/dist/frontend/src/lib/state.js +84 -0
  26. package/dist/frontend/src/main.js +83 -0
  27. package/dist/frontend/src/shell.js +184 -0
  28. package/dist/frontend/src/views/architecture-view.js +798 -0
  29. package/dist/frontend/src/views/inventory-view.js +292 -0
  30. package/dist/frontend/src/views/privacy-view.js +172 -0
  31. package/dist/frontend/src/views/trace-view.js +206 -0
  32. package/dist/frontend/styles/architecture-view.css +93 -0
  33. package/dist/frontend/styles/filter-rail.css +34 -0
  34. package/dist/frontend/styles/inspector.css +69 -0
  35. package/dist/frontend/styles/inventory-view.css +74 -0
  36. package/dist/frontend/styles/privacy-view.css +86 -0
  37. package/dist/frontend/styles/query-bar.css +107 -0
  38. package/dist/frontend/styles/shell.css +155 -0
  39. package/dist/frontend/styles/tokens.css +128 -0
  40. package/dist/frontend/styles/trace-view.css +95 -0
  41. package/package.json +2 -2
  42. package/src/posture/auditor-walkthrough.js +89 -6
  43. package/src/posture/compliance-frameworks/nist-800-171-r3.json +1269 -0
  44. package/src/server/static-assets.js +11 -6
  45. package/src/shared/frontend-root.js +52 -0
@@ -14,14 +14,19 @@
14
14
 
15
15
  import * as path from 'node:path';
16
16
  import { fileURLToPath } from 'node:url';
17
+ import { resolveFrontendRoot } from '../shared/frontend-root.js';
17
18
 
18
- // Located the SAME way scanner/src/mcp/server.js locates files relative to
19
- // its own module (path.dirname(fileURLToPath(import.meta.url))) the real,
20
- // existing precedent for this pattern in this codebase, not a new one.
21
- // scanner/src/server/ -> ../../../frontend, computed (not guessed) and
22
- // confirmed to resolve to the real frontend/ directory.
19
+ // Located relative to this module's own directory (path.dirname(
20
+ // fileURLToPath(import.meta.url)), the same pattern scanner/src/mcp/server.js
21
+ // uses), but via resolveFrontendRoot's search-upward strategy rather than a
22
+ // single hardcoded relative depth a fixed `../../../frontend` resolved
23
+ // correctly for this file's unbundled dev location but broke (silently, at
24
+ // runtime, for every real npx/npm user) once `npm run build` split this
25
+ // module into its own dist/ chunk, whose import.meta.url reflects dist/'s
26
+ // own shallower location. See src/shared/frontend-root.js for the full story
27
+ // and scripts/copy-frontend.mjs for the build-time copy this now finds.
23
28
  const _here = path.dirname(fileURLToPath(import.meta.url));
24
- export const FRONTEND_ROOT = path.resolve(_here, '..', '..', '..', 'frontend');
29
+ export const FRONTEND_ROOT = resolveFrontendRoot(_here);
25
30
 
26
31
  export const CONTENT_TYPE_MAP = Object.freeze({
27
32
  '.html': 'text/html; charset=utf-8',
@@ -0,0 +1,52 @@
1
+ // frontend-root.js — locates the Data Flow Explorer's `frontend/` assets
2
+ // (index.html/src/styles) regardless of whether this code is running:
3
+ // - unbundled, straight out of scanner/src/ or scanner/scripts/ (dev/test —
4
+ // frontend/ is a monorepo sibling of scanner/, 2-3 levels up), or
5
+ // - bundled by `npm run build` (ncc splits a dynamic import() into its own
6
+ // chunk file physically written into scanner/dist/, so import.meta.url
7
+ // inside that chunk reflects dist/'s own location, not the original
8
+ // source file's — a fixed relative-levels-up path that was correct for
9
+ // one depth breaks silently at the other), or
10
+ // - installed from the published npm package, where the build copies
11
+ // frontend/'s servable files into scanner/dist/frontend/ (a sibling of
12
+ // the chunk file itself, i.e. 0 levels up) — see scripts/copy-frontend.mjs.
13
+ //
14
+ // Rather than hardcode one of those depths (the bug this file fixes: every
15
+ // consumer used to hardcode the dev-only depth), search upward from the
16
+ // caller's own directory and take the first candidate that actually has a
17
+ // frontend/index.html on disk. Never guessed silently past that — a caller
18
+ // with no match anywhere gets a clear, actionable error instead of a
19
+ // downstream ENOENT/404 with no indication why.
20
+
21
+ import * as fs from 'node:fs';
22
+ import * as path from 'node:path';
23
+
24
+ const MAX_LEVELS_UP = 4;
25
+
26
+ /**
27
+ * @param {string} startDir - `path.dirname(fileURLToPath(import.meta.url))`
28
+ * of the CALLING module (not this file) — each caller's own bundled/
29
+ * unbundled location determines which candidate depth resolves.
30
+ * @returns {string} absolute path to a real `frontend/` directory containing
31
+ * `index.html`.
32
+ * @throws if no candidate directory up to MAX_LEVELS_UP contains one.
33
+ */
34
+ export function resolveFrontendRoot(startDir) {
35
+ const tried = [];
36
+ for (let up = 0; up <= MAX_LEVELS_UP; up++) {
37
+ const candidate = path.resolve(startDir, ...Array(up).fill('..'), 'frontend');
38
+ tried.push(candidate);
39
+ // Every caller invokes resolveFrontendRoot() once, at module-load time,
40
+ // to compute a top-level FRONTEND_ROOT const (see static-assets.js /
41
+ // generate-html-report.mjs) — never per-request inside the explore
42
+ // server's request handler. At most MAX_LEVELS_UP+1 (5) sync stat calls
43
+ // at process startup is not a request-path DoS surface.
44
+ if (fs.existsSync(path.join(candidate, 'index.html'))) return candidate; // agentic-security-ignore: dos-sync-io
45
+ }
46
+ throw new Error(
47
+ `resolveFrontendRoot: no frontend/index.html found searching up from ${startDir}. ` +
48
+ `Tried: ${tried.join(', ')}. If you're running from a source checkout, run \`npm run build\` ` +
49
+ `first (it copies frontend/ into scanner/dist/frontend/); if you're running the published ` +
50
+ `package, this indicates a packaging defect — report it.`
51
+ );
52
+ }