@clear-capabilities/agentic-security-scanner 0.195.24 → 0.195.26

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.
@@ -5812,7 +5812,7 @@ function findSiblings({ root, finding, scanFindings = [], limits = SIBLING_LIMIT
5812
5812
 
5813
5813
  /**
5814
5814
  * @param {string} scanRoot
5815
- * @returns {{ok:true, graph:object} | {ok:false, reason:'missing'|'unsigned'|'tampered'|'malformed', message:string}}
5815
+ * @returns {{ok:true, graph:object} | {ok:false, reason:'missing'|'unsigned'|'tampered'|'malformed'|'wrong-revision', message:string}}
5816
5816
  *
5817
5817
  * Four, and only four, distinct failure reasons — each with its own clear
5818
5818
  * message so an operator knows exactly what to do next:
@@ -5829,7 +5829,7 @@ function findSiblings({ root, finding, scanFindings = [], limits = SIBLING_LIMIT
5829
5829
  * valid JSON. Should not happen from a normal scan; the
5830
5830
  * file may be corrupted on disk after signing.
5831
5831
  */
5832
- function loadSignedGraph(scanRoot) {
5832
+ function loadSignedGraph(scanRoot, { expectRevision = null } = {}) {
5833
5833
  const graphPath = (0,_posture_state_dir_js__WEBPACK_IMPORTED_MODULE_1__.statePath)(scanRoot, 'lineage-graph.json');
5834
5834
  const sigPath = graphPath + '.sig';
5835
5835
 
@@ -5879,6 +5879,23 @@ function loadSignedGraph(scanRoot) {
5879
5879
  };
5880
5880
  }
5881
5881
 
5882
+ // GA-03.7 (0.195.26): wrong-revision refusal. A caller that knows which
5883
+ // revision it expects (`dataflow view --expect-revision`) gets a graph
5884
+ // only when the graph records that revision; a graph that records none
5885
+ // cannot prove it and is refused for the same reason, never served on
5886
+ // the hope that it matches.
5887
+ if (expectRevision) {
5888
+ const have = graph && graph.scope && graph.scope.revision ? graph.scope.revision.commit : null;
5889
+ if (have !== expectRevision) {
5890
+ return {
5891
+ ok: false,
5892
+ reason: 'wrong-revision',
5893
+ message: have
5894
+ ? `Lineage graph at ${graphPath} was built from revision ${have}, not the expected ${expectRevision}. Re-run the scan on the expected revision.`
5895
+ : `Lineage graph at ${graphPath} records no revision, so it cannot be shown to match the expected ${expectRevision}. Re-run the scan inside the repository (AGENTIC_SECURITY_LINEAGE_DEEP=1) so the graph records its revision.`,
5896
+ };
5897
+ }
5898
+ }
5882
5899
  return { ok: true, graph };
5883
5900
  }
5884
5901