@prism-d1/cli 1.1.2 → 1.3.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 (255) hide show
  1. package/dist/assets/github-workflows/prism-agent-eval.yml +2 -1
  2. package/dist/assets/github-workflows/prism-eval-gate-kiro.yml +12 -2
  3. package/dist/assets/gitlab-workflows/prism-eval-gate.yml +8 -0
  4. package/dist/assets/infra/bin/app.ts +61 -37
  5. package/dist/assets/infra/lib/constructs/otel-collector-construct.ts +96 -0
  6. package/dist/assets/infra/lib/constructs/security-agent-construct.ts +35 -30
  7. package/dist/assets/infra/lib/dashboard-stack.ts +27 -0
  8. package/dist/assets/infra/lib/lambda/otel-receiver.ts +278 -8
  9. package/dist/assets/infra/lib/lambda/pricing/litellm-snapshot.json +3769 -0
  10. package/dist/assets/infra/lib/lambda/pricing/price-source.ts +56 -0
  11. package/dist/assets/infra/lib/lambda/pricing/price-table.ts +240 -0
  12. package/dist/assets/infra/lib/lambda/pricing/prices-key.ts +6 -0
  13. package/dist/assets/infra/lib/lambda/pricing/reprice.ts +108 -0
  14. package/dist/assets/infra/lib/lambda/pricing-refresh.ts +352 -0
  15. package/dist/assets/infra/lib/lambda/velocity-widget.ts +124 -1
  16. package/dist/assets/infra/lib/metrics-pipeline-stack.ts +2 -110
  17. package/dist/assets/infra/lib/security-agent-resources.ts +136 -0
  18. package/dist/assets/infra/lib/security-agent-stack.ts +69 -0
  19. package/dist/assets/infra/package.json +4 -1
  20. package/dist/assets/metric-hooks/prepare-commit-msg +3 -1
  21. package/dist/assets/pentest-cdk/bin/app.ts +12 -0
  22. package/dist/assets/pentest-cdk/cdk.json +7 -0
  23. package/dist/assets/pentest-cdk/lib/pentest-target-stack.ts +206 -0
  24. package/dist/assets/pentest-cdk/package.json +18 -0
  25. package/dist/assets/pentest-cdk/tsconfig.json +12 -0
  26. package/dist/src/codewatch/config.d.ts +17 -0
  27. package/dist/src/codewatch/config.d.ts.map +1 -0
  28. package/dist/src/codewatch/config.js +40 -0
  29. package/dist/src/codewatch/config.js.map +1 -0
  30. package/dist/src/codewatch/gitleaks.d.ts +49 -0
  31. package/dist/src/codewatch/gitleaks.d.ts.map +1 -0
  32. package/dist/src/codewatch/gitleaks.js +160 -0
  33. package/dist/src/codewatch/gitleaks.js.map +1 -0
  34. package/dist/src/codewatch/globalHooks.d.ts +52 -0
  35. package/dist/src/codewatch/globalHooks.d.ts.map +1 -0
  36. package/dist/src/codewatch/globalHooks.js +235 -0
  37. package/dist/src/codewatch/globalHooks.js.map +1 -0
  38. package/dist/src/codewatch/hooks.d.ts +38 -0
  39. package/dist/src/codewatch/hooks.d.ts.map +1 -0
  40. package/dist/src/codewatch/hooks.js +176 -0
  41. package/dist/src/codewatch/hooks.js.map +1 -0
  42. package/dist/src/codewatch/prepush.d.ts +37 -0
  43. package/dist/src/codewatch/prepush.d.ts.map +1 -0
  44. package/dist/src/codewatch/prepush.js +231 -0
  45. package/dist/src/codewatch/prepush.js.map +1 -0
  46. package/dist/src/codewatch/results.d.ts +210 -0
  47. package/dist/src/codewatch/results.d.ts.map +1 -0
  48. package/dist/src/codewatch/results.js +127 -0
  49. package/dist/src/codewatch/results.js.map +1 -0
  50. package/dist/src/codewatch/reviewers/claude.d.ts +9 -0
  51. package/dist/src/codewatch/reviewers/claude.d.ts.map +1 -0
  52. package/dist/src/codewatch/reviewers/claude.js +48 -0
  53. package/dist/src/codewatch/reviewers/claude.js.map +1 -0
  54. package/dist/src/codewatch/reviewers/index.d.ts +39 -0
  55. package/dist/src/codewatch/reviewers/index.d.ts.map +1 -0
  56. package/dist/src/codewatch/reviewers/index.js +97 -0
  57. package/dist/src/codewatch/reviewers/index.js.map +1 -0
  58. package/dist/src/codewatch/reviewers/kiro.d.ts +14 -0
  59. package/dist/src/codewatch/reviewers/kiro.d.ts.map +1 -0
  60. package/dist/src/codewatch/reviewers/kiro.js +32 -0
  61. package/dist/src/codewatch/reviewers/kiro.js.map +1 -0
  62. package/dist/src/codewatch/reviewers/types.d.ts +56 -0
  63. package/dist/src/codewatch/reviewers/types.d.ts.map +1 -0
  64. package/dist/src/codewatch/reviewers/types.js +91 -0
  65. package/dist/src/codewatch/reviewers/types.js.map +1 -0
  66. package/dist/src/codewatch/rules.d.ts +12 -0
  67. package/dist/src/codewatch/rules.d.ts.map +1 -0
  68. package/dist/src/codewatch/rules.js +27 -0
  69. package/dist/src/codewatch/rules.js.map +1 -0
  70. package/dist/src/commands/_top/dashboard.d.ts +17 -0
  71. package/dist/src/commands/_top/dashboard.d.ts.map +1 -0
  72. package/dist/src/commands/_top/dashboard.js +76 -0
  73. package/dist/src/commands/_top/dashboard.js.map +1 -0
  74. package/dist/src/commands/_top/version.d.ts +62 -0
  75. package/dist/src/commands/_top/version.d.ts.map +1 -0
  76. package/dist/src/commands/_top/version.js +175 -0
  77. package/dist/src/commands/_top/version.js.map +1 -0
  78. package/dist/src/commands/bedrock-protection/scan-account.d.ts.map +1 -1
  79. package/dist/src/commands/bedrock-protection/scan-account.js +2 -1
  80. package/dist/src/commands/bedrock-protection/scan-account.js.map +1 -1
  81. package/dist/src/commands/bedrock-protection/scan-org.d.ts.map +1 -1
  82. package/dist/src/commands/bedrock-protection/scan-org.js +16 -4
  83. package/dist/src/commands/bedrock-protection/scan-org.js.map +1 -1
  84. package/dist/src/commands/bootstrapper/install-eval-harness.d.ts.map +1 -1
  85. package/dist/src/commands/bootstrapper/install-eval-harness.js +15 -48
  86. package/dist/src/commands/bootstrapper/install-eval-harness.js.map +1 -1
  87. package/dist/src/commands/bootstrapper/install-git-hooks.d.ts +13 -0
  88. package/dist/src/commands/bootstrapper/install-git-hooks.d.ts.map +1 -1
  89. package/dist/src/commands/bootstrapper/install-git-hooks.js +28 -147
  90. package/dist/src/commands/bootstrapper/install-git-hooks.js.map +1 -1
  91. package/dist/src/commands/bootstrapper/setup-otel-sync.d.ts +12 -6
  92. package/dist/src/commands/bootstrapper/setup-otel-sync.d.ts.map +1 -1
  93. package/dist/src/commands/bootstrapper/setup-otel-sync.js +18 -443
  94. package/dist/src/commands/bootstrapper/setup-otel-sync.js.map +1 -1
  95. package/dist/src/commands/codewatch/pre-commit.d.ts +7 -0
  96. package/dist/src/commands/codewatch/pre-commit.d.ts.map +1 -0
  97. package/dist/src/commands/codewatch/pre-commit.js +30 -0
  98. package/dist/src/commands/codewatch/pre-commit.js.map +1 -0
  99. package/dist/src/commands/codewatch/pre-push.d.ts +16 -0
  100. package/dist/src/commands/codewatch/pre-push.d.ts.map +1 -0
  101. package/dist/src/commands/codewatch/pre-push.js +32 -0
  102. package/dist/src/commands/codewatch/pre-push.js.map +1 -0
  103. package/dist/src/commands/codewatch/report.d.ts +22 -0
  104. package/dist/src/commands/codewatch/report.d.ts.map +1 -0
  105. package/dist/src/commands/codewatch/report.js +64 -0
  106. package/dist/src/commands/codewatch/report.js.map +1 -0
  107. package/dist/src/commands/enable/codeburn.d.ts +59 -0
  108. package/dist/src/commands/enable/codeburn.d.ts.map +1 -0
  109. package/dist/src/commands/enable/codeburn.js +531 -0
  110. package/dist/src/commands/enable/codeburn.js.map +1 -0
  111. package/dist/src/commands/enable/codewatch.d.ts +15 -0
  112. package/dist/src/commands/enable/codewatch.d.ts.map +1 -0
  113. package/dist/src/commands/enable/codewatch.js +186 -0
  114. package/dist/src/commands/enable/codewatch.js.map +1 -0
  115. package/dist/src/commands/enable/security.d.ts +41 -0
  116. package/dist/src/commands/enable/security.d.ts.map +1 -0
  117. package/dist/src/commands/enable/security.js +130 -0
  118. package/dist/src/commands/enable/security.js.map +1 -0
  119. package/dist/src/commands/export/otel.d.ts +31 -0
  120. package/dist/src/commands/export/otel.d.ts.map +1 -0
  121. package/dist/src/commands/export/otel.js +52 -0
  122. package/dist/src/commands/export/otel.js.map +1 -0
  123. package/dist/src/commands/git/claude-session-context.d.ts.map +1 -1
  124. package/dist/src/commands/git/claude-session-context.js +2 -1
  125. package/dist/src/commands/git/claude-session-context.js.map +1 -1
  126. package/dist/src/commands/git/commit-trailers.js +1 -1
  127. package/dist/src/commands/git/commit-trailers.js.map +1 -1
  128. package/dist/src/commands/security/code-review.d.ts +22 -0
  129. package/dist/src/commands/security/code-review.d.ts.map +1 -0
  130. package/dist/src/commands/security/code-review.js +43 -0
  131. package/dist/src/commands/security/code-review.js.map +1 -0
  132. package/dist/src/commands/security/findings.d.ts +15 -0
  133. package/dist/src/commands/security/findings.d.ts.map +1 -0
  134. package/dist/src/commands/security/findings.js +31 -0
  135. package/dist/src/commands/security/findings.js.map +1 -0
  136. package/dist/src/commands/security/pentest.d.ts +18 -0
  137. package/dist/src/commands/security/pentest.d.ts.map +1 -0
  138. package/dist/src/commands/security/pentest.js +32 -0
  139. package/dist/src/commands/security/pentest.js.map +1 -0
  140. package/dist/src/commands/security/threat-model.d.ts +16 -0
  141. package/dist/src/commands/security/threat-model.d.ts.map +1 -0
  142. package/dist/src/commands/security/threat-model.js +24 -0
  143. package/dist/src/commands/security/threat-model.js.map +1 -0
  144. package/dist/src/commands/security/threats.d.ts +12 -0
  145. package/dist/src/commands/security/threats.d.ts.map +1 -0
  146. package/dist/src/commands/security/threats.js +23 -0
  147. package/dist/src/commands/security/threats.js.map +1 -0
  148. package/dist/src/commands/securityagent/setup.d.ts +19 -5
  149. package/dist/src/commands/securityagent/setup.d.ts.map +1 -1
  150. package/dist/src/commands/securityagent/setup.js +25 -189
  151. package/dist/src/commands/securityagent/setup.js.map +1 -1
  152. package/dist/src/commands/workshop/verify-setup.d.ts.map +1 -1
  153. package/dist/src/commands/workshop/verify-setup.js +5 -3
  154. package/dist/src/commands/workshop/verify-setup.js.map +1 -1
  155. package/dist/src/dashboard/codewatch.d.ts +106 -0
  156. package/dist/src/dashboard/codewatch.d.ts.map +1 -0
  157. package/dist/src/dashboard/codewatch.js +120 -0
  158. package/dist/src/dashboard/codewatch.js.map +1 -0
  159. package/dist/src/dashboard/commits.d.ts +96 -0
  160. package/dist/src/dashboard/commits.d.ts.map +1 -0
  161. package/dist/src/dashboard/commits.js +207 -0
  162. package/dist/src/dashboard/commits.js.map +1 -0
  163. package/dist/src/dashboard/page.d.ts +10 -0
  164. package/dist/src/dashboard/page.d.ts.map +1 -0
  165. package/dist/src/dashboard/page.js +470 -0
  166. package/dist/src/dashboard/page.js.map +1 -0
  167. package/dist/src/dashboard/payload.d.ts +114 -0
  168. package/dist/src/dashboard/payload.d.ts.map +1 -0
  169. package/dist/src/dashboard/payload.js +96 -0
  170. package/dist/src/dashboard/payload.js.map +1 -0
  171. package/dist/src/dashboard/report.d.ts +99 -0
  172. package/dist/src/dashboard/report.d.ts.map +1 -0
  173. package/dist/src/dashboard/report.js +300 -0
  174. package/dist/src/dashboard/report.js.map +1 -0
  175. package/dist/src/dashboard/repos.d.ts +58 -0
  176. package/dist/src/dashboard/repos.d.ts.map +1 -0
  177. package/dist/src/dashboard/repos.js +111 -0
  178. package/dist/src/dashboard/repos.js.map +1 -0
  179. package/dist/src/dashboard/security.d.ts +130 -0
  180. package/dist/src/dashboard/security.d.ts.map +1 -0
  181. package/dist/src/dashboard/security.js +144 -0
  182. package/dist/src/dashboard/security.js.map +1 -0
  183. package/dist/src/dashboard/server.d.ts +52 -0
  184. package/dist/src/dashboard/server.d.ts.map +1 -0
  185. package/dist/src/dashboard/server.js +163 -0
  186. package/dist/src/dashboard/server.js.map +1 -0
  187. package/dist/src/dashboard/setup.d.ts +67 -0
  188. package/dist/src/dashboard/setup.d.ts.map +1 -0
  189. package/dist/src/dashboard/setup.js +146 -0
  190. package/dist/src/dashboard/setup.js.map +1 -0
  191. package/dist/src/dashboard/usage.d.ts +43 -0
  192. package/dist/src/dashboard/usage.d.ts.map +1 -0
  193. package/dist/src/dashboard/usage.js +88 -0
  194. package/dist/src/dashboard/usage.js.map +1 -0
  195. package/dist/src/index.d.ts +1 -0
  196. package/dist/src/index.d.ts.map +1 -1
  197. package/dist/src/index.js +48 -2
  198. package/dist/src/index.js.map +1 -1
  199. package/dist/src/security/cfn-diff.d.ts +57 -0
  200. package/dist/src/security/cfn-diff.d.ts.map +1 -0
  201. package/dist/src/security/cfn-diff.js +112 -0
  202. package/dist/src/security/cfn-diff.js.map +1 -0
  203. package/dist/src/security/errors.d.ts +45 -0
  204. package/dist/src/security/errors.d.ts.map +1 -0
  205. package/dist/src/security/errors.js +116 -0
  206. package/dist/src/security/errors.js.map +1 -0
  207. package/dist/src/security/marker.d.ts +46 -0
  208. package/dist/src/security/marker.d.ts.map +1 -0
  209. package/dist/src/security/marker.js +120 -0
  210. package/dist/src/security/marker.js.map +1 -0
  211. package/dist/src/security/pentest-dockerfile.d.ts +8 -0
  212. package/dist/src/security/pentest-dockerfile.d.ts.map +1 -0
  213. package/dist/src/security/pentest-dockerfile.js +163 -0
  214. package/dist/src/security/pentest-dockerfile.js.map +1 -0
  215. package/dist/src/security/pentest.d.ts +233 -0
  216. package/dist/src/security/pentest.d.ts.map +1 -0
  217. package/dist/src/security/pentest.js +1057 -0
  218. package/dist/src/security/pentest.js.map +1 -0
  219. package/dist/src/security/repo.d.ts +25 -0
  220. package/dist/src/security/repo.d.ts.map +1 -0
  221. package/dist/src/security/repo.js +38 -0
  222. package/dist/src/security/repo.js.map +1 -0
  223. package/dist/src/security/review.d.ts +202 -0
  224. package/dist/src/security/review.d.ts.map +1 -0
  225. package/dist/src/security/review.js +706 -0
  226. package/dist/src/security/review.js.map +1 -0
  227. package/dist/src/security/setup.d.ts +193 -0
  228. package/dist/src/security/setup.d.ts.map +1 -0
  229. package/dist/src/security/setup.js +728 -0
  230. package/dist/src/security/setup.js.map +1 -0
  231. package/dist/src/security/threat-model.d.ts +133 -0
  232. package/dist/src/security/threat-model.d.ts.map +1 -0
  233. package/dist/src/security/threat-model.js +653 -0
  234. package/dist/src/security/threat-model.js.map +1 -0
  235. package/dist/src/utils/audit-bedrock.d.ts +1 -0
  236. package/dist/src/utils/audit-bedrock.d.ts.map +1 -1
  237. package/dist/src/utils/audit-bedrock.js +133 -0
  238. package/dist/src/utils/audit-bedrock.js.map +1 -1
  239. package/dist/src/utils/audit-org.d.ts +1 -0
  240. package/dist/src/utils/audit-org.d.ts.map +1 -1
  241. package/dist/src/utils/audit-org.js +155 -0
  242. package/dist/src/utils/audit-org.js.map +1 -1
  243. package/dist/src/utils/exec.d.ts +6 -0
  244. package/dist/src/utils/exec.d.ts.map +1 -1
  245. package/dist/src/utils/exec.js +12 -1
  246. package/dist/src/utils/exec.js.map +1 -1
  247. package/dist/src/utils/otel-sync-schedule.d.ts +41 -0
  248. package/dist/src/utils/otel-sync-schedule.d.ts.map +1 -0
  249. package/dist/src/utils/otel-sync-schedule.js +90 -0
  250. package/dist/src/utils/otel-sync-schedule.js.map +1 -0
  251. package/dist/src/utils/tool-check.d.ts +14 -0
  252. package/dist/src/utils/tool-check.d.ts.map +1 -0
  253. package/dist/src/utils/tool-check.js +42 -0
  254. package/dist/src/utils/tool-check.js.map +1 -0
  255. package/package.json +3 -2
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Resource-level diff between the deployed CloudFormation template and the
3
+ * one `cdk synth` produced, used for the summary shown before confirmation.
4
+ *
5
+ * `cdk diff` is still run (its full text goes to a file the summary points
6
+ * at), but its output is human-oriented and changes between CDK versions, so
7
+ * the summary is computed from the two templates directly. It answers what the
8
+ * confirmation needs: how many resources are added, changed or removed, which
9
+ * of those touch IAM, network or public endpoints, and whether any of them are
10
+ * the Security Agent resources at all.
11
+ */
12
+ /**
13
+ * Construct path prefixes (after the stack name) that make up the Security
14
+ * Agent feature. The auto-delete provider is a stack-level singleton CDK adds
15
+ * for the scan bucket's autoDeleteObjects; measured on a real synth, it is
16
+ * the only thing enableSecurityAgent adds outside the SecurityAgent construct.
17
+ */
18
+ export const SECURITY_AGENT_PATHS = ['SecurityAgent/', 'ContinuumCiPolicy/', 'Custom::S3AutoDeleteObjectsCustomResourceProvider/'];
19
+ const IGNORED_TYPES = new Set(['AWS::CDK::Metadata']);
20
+ export function categorize(type) {
21
+ if (/^AWS::IAM::/.test(type) || /^AWS::(S3::BucketPolicy|KMS::Key|KMS::Grant|Lambda::Permission|SQS::QueuePolicy|SNS::TopicPolicy|Events::EventBusPolicy)$/.test(type))
22
+ return 'iam';
23
+ if (/^AWS::EC2::(SecurityGroup|SecurityGroupIngress|SecurityGroupEgress|VPC|Subnet|InternetGateway|NatGateway|EIP|Route|RouteTable|VPCEndpoint|NetworkAcl)/.test(type))
24
+ return 'network';
25
+ if (/^AWS::(ApiGateway::|ApiGatewayV2::|ElasticLoadBalancing|ElasticLoadBalancingV2::|CloudFront::|Lambda::Url$|Cognito::UserPoolDomain$|AppSync::)/.test(type))
26
+ return 'endpoint';
27
+ return 'other';
28
+ }
29
+ function cdkPath(r, stackName) {
30
+ const p = r?.Metadata?.['aws:cdk:path'];
31
+ if (typeof p !== 'string')
32
+ return '';
33
+ return p.startsWith(stackName + '/') ? p.slice(stackName.length + 1) : p;
34
+ }
35
+ function comparable(r) {
36
+ return JSON.stringify({ t: r.Type, p: r.Properties ?? null, d: r.DependsOn ?? null, c: r.Condition ?? null });
37
+ }
38
+ /** `deployed` is null when the stack does not exist yet. */
39
+ /** `isFeature` decides which resources belong to Security Agent; default: SECURITY_AGENT_PATHS. */
40
+ export function diffTemplates(deployed, synthesized, stackName, isFeature = (path) => SECURITY_AGENT_PATHS.some((p) => path.startsWith(p))) {
41
+ const before = deployed?.Resources ?? {};
42
+ const after = synthesized.Resources ?? {};
43
+ const changes = [];
44
+ const add = (logicalId, r, change) => {
45
+ if (IGNORED_TYPES.has(r.Type))
46
+ return;
47
+ const path = cdkPath(r, stackName) || logicalId;
48
+ changes.push({
49
+ logicalId, type: r.Type, path, change, category: categorize(r.Type),
50
+ securityAgent: isFeature(path),
51
+ });
52
+ };
53
+ for (const [id, r] of Object.entries(after)) {
54
+ if (!(id in before))
55
+ add(id, r, 'add');
56
+ else if (comparable(before[id]) !== comparable(r))
57
+ add(id, r, 'modify');
58
+ }
59
+ for (const [id, r] of Object.entries(before))
60
+ if (!(id in after))
61
+ add(id, r, 'remove');
62
+ changes.sort((a, b) => a.path.localeCompare(b.path));
63
+ const counts = { add: 0, modify: 0, remove: 0 };
64
+ for (const c of changes)
65
+ counts[c.change]++;
66
+ return {
67
+ newStack: deployed === null,
68
+ changes,
69
+ counts,
70
+ touchesSecurityAgent: changes.some((c) => c.securityAgent),
71
+ deployedHasSecurityAgent: Object.values(before).some((r) => r.Type === 'AWS::SecurityAgent::AgentSpace'),
72
+ };
73
+ }
74
+ const SIGN = { add: '+', modify: '~', remove: '-' };
75
+ const HEADINGS = {
76
+ iam: 'IAM and resource policies',
77
+ network: 'Security groups and network',
78
+ endpoint: 'Public endpoints (API Gateway, load balancers, CloudFront, Cognito domains, function URLs)',
79
+ other: 'Other resources',
80
+ };
81
+ /** Lines for the summary. Every IAM, network and endpoint change is listed by name; other resources are counted by type. */
82
+ export function formatDiff(d, stackName) {
83
+ const L = [];
84
+ const { add, modify, remove } = d.counts;
85
+ L.push(`Stack ${stackName}${d.newStack ? ' (new stack)' : ''}: ${add} to add, ${modify} to change, ${remove} to remove`);
86
+ if (!d.changes.length) {
87
+ L.push(' No changes.');
88
+ return L;
89
+ }
90
+ for (const cat of ['iam', 'network', 'endpoint']) {
91
+ const items = d.changes.filter((c) => c.category === cat);
92
+ L.push(` ${HEADINGS[cat]}:${items.length ? '' : ' none'}`);
93
+ for (const c of items)
94
+ L.push(` ${SIGN[c.change]} ${c.type} ${c.path}`);
95
+ }
96
+ const other = d.changes.filter((c) => c.category === 'other');
97
+ if (other.length) {
98
+ L.push(` ${HEADINGS.other}:`);
99
+ const groups = new Map();
100
+ for (const c of other)
101
+ groups.set(`${SIGN[c.change]} ${c.type}`, (groups.get(`${SIGN[c.change]} ${c.type}`) ?? 0) + 1);
102
+ for (const [k, n] of [...groups].sort())
103
+ L.push(` ${k}${n > 1 ? ` x${n}` : ''}`);
104
+ }
105
+ if (remove)
106
+ L.push(` WARNING: ${remove} resource(s) would be REMOVED. If your stack was deployed with extra context (for example -c skipVpc=true), pass the same values with --context.`);
107
+ const outside = d.changes.filter((c) => !c.securityAgent).length;
108
+ if (!d.newStack && outside)
109
+ L.push(` ${outside} of these changes are outside the Security Agent resources (the local infra code differs from what is deployed).`);
110
+ return L;
111
+ }
112
+ //# sourceMappingURL=cfn-diff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cfn-diff.js","sourceRoot":"","sources":["../../../src/security/cfn-diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqCH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,gBAAgB,EAAE,oBAAoB,EAAE,oDAAoD,CAAC,CAAC;AAEnI,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC;AAEtD,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,2HAA2H,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACrL,IAAI,uJAAuJ,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IACzL,IAAI,gJAAgJ,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,UAAU,CAAC;IACnL,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,OAAO,CAAC,CAA0B,EAAE,SAAiB;IAC5D,MAAM,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC,cAAc,CAAC,CAAC;IACxC,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IACrC,OAAO,CAAC,CAAC,UAAU,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,UAAU,CAAC,CAAc;IAChC,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,C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
5
+ * what to do: no usable credentials, an AWS CLI too old to know the
6
+ * `securityagent` commands, and an AccessDenied (which API, and which IAM
7
+ * action it needed). Everything printed goes through redact() first, so a
8
+ * credential that ends up in an error string is never echoed.
9
+ */
10
+ /** First AWS CLI release with the Security Agent code review commands (matches the CI eval gate's check). */
11
+ export declare const MIN_AWS_CLI: readonly [2, 36];
12
+ export declare const MIN_AWS_CLI_TEXT: string;
13
+ export declare const NO_CREDENTIALS_MESSAGE = "Failed to get account ID. Check your AWS credentials.";
14
+ /** Removes anything shaped like an AWS credential from text before it is printed. */
15
+ export declare function redact(text: string): string;
16
+ /** The IAM action an `aws <service> <command>` call needs, derived from the argv. */
17
+ export declare function permissionFor(args: string[]): string;
18
+ export type AwsErrorKind = 'no-credentials' | 'access-denied' | 'old-cli' | 'other';
19
+ export interface ExplainedError {
20
+ kind: AwsErrorKind;
21
+ /** One or more lines, already redacted. */
22
+ message: string;
23
+ }
24
+ /**
25
+ * Explains a failed `aws` call. `args` is the argv that failed (without
26
+ * --region/--profile), `stderr` what the CLI printed, `cliVersion` the
27
+ * `aws --version` output when known.
28
+ */
29
+ export declare function explainAwsError(args: string[], stderr: string, cliVersion?: string | null): ExplainedError;
30
+ /**
31
+ * Lines for an error that is not one of ours (not an Abort): a failed npm or
32
+ * cdk run, a JSON parse, a git or file-system error. One redacted `Error:`
33
+ * line, at most one hint, and the redacted stack only with PRISM_DEBUG=1.
34
+ *
35
+ * Only `message`, `code`, `syscall` and `stack` are read. A child-process
36
+ * error also carries `cmd`, `spawnargs`, `envPairs`, `stdout` and `stderr`,
37
+ * which can hold full command lines and the environment; those are never read.
38
+ */
39
+ export declare function describeUnexpectedError(e: unknown, env?: NodeJS.ProcessEnv): string[];
40
+ /** Parses `aws --version` ("aws-cli/2.36.19 Python/...") and checks it against MIN_AWS_CLI. */
41
+ export declare function cliVersionOk(versionText: string | null): {
42
+ ok: boolean;
43
+ version: string | null;
44
+ };
45
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/security/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,6GAA6G;AAC7G,eAAO,MAAM,WAAW,kBAAmB,CAAC;AAC5C,eAAO,MAAM,gBAAgB,QAA8B,CAAC;AAE5D,eAAO,MAAM,sBAAsB,0DAA0D,CAAC;AAM9F,qFAAqF;AACrF,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK3C;AAUD,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAIpD;AAED,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,eAAe,GAAG,SAAS,GAAG,OAAO,CAAC;AAEpF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,YAAY,CAAC;IACnB,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,cAAc,CAyB1G;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,EAAE,CAqBlG;AAED,+FAA+F;AAC/F,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAMhG"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Turns AWS CLI failures into messages a developer can act on.
3
+ *
4
+ * Three cases get their own wording because the raw CLI output does not say
5
+ * what to do: no usable credentials, an AWS CLI too old to know the
6
+ * `securityagent` commands, and an AccessDenied (which API, and which IAM
7
+ * action it needed). Everything printed goes through redact() first, so a
8
+ * credential that ends up in an error string is never echoed.
9
+ */
10
+ /** First AWS CLI release with the Security Agent code review commands (matches the CI eval gate's check). */
11
+ export const MIN_AWS_CLI = [2, 36];
12
+ export const MIN_AWS_CLI_TEXT = `v${MIN_AWS_CLI.join('.')}`;
13
+ export const NO_CREDENTIALS_MESSAGE = 'Failed to get account ID. Check your AWS credentials.';
14
+ const CREDENTIAL_ERRORS = /Unable to locate credentials|could not be found|ExpiredToken|InvalidClientTokenId|SignatureDoesNotMatch|Token has expired|The SSO session|NoCredentialProviders|Error loading SSO Token|security token included in the request is (invalid|expired)/i;
15
+ const ACCESS_DENIED = /AccessDenied|UnauthorizedOperation|not authorized to perform|UnauthorizedException/i;
16
+ const UNKNOWN_COMMAND = /invalid choice/i;
17
+ /** Removes anything shaped like an AWS credential from text before it is printed. */
18
+ export function redact(text) {
19
+ return text
20
+ .replace(/\b(AKIA|ASIA)[A-Z0-9]{16}\b/g, '[redacted access key]')
21
+ .replace(/(aws_secret_access_key|aws_session_token|SecretAccessKey|SessionToken)(["']?\s*[:=]\s*["']?)[^\s"',}]+/gi, '$1$2[redacted]')
22
+ .replace(/(X-Amz-Security-Token|X-Amz-Signature|X-Amz-Credential)=[^&\s"']+/gi, '$1=[redacted]');
23
+ }
24
+ /** `list-agent-spaces` -> `ListAgentSpaces`. */
25
+ function pascal(cmd) {
26
+ return cmd.split('-').map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join('');
27
+ }
28
+ const SERVICE_PREFIX = { s3api: 's3', s3: 's3' };
29
+ const S3_ACTIONS = { 'head-object': 's3:GetObject', 'put-object': 's3:PutObject', cp: 's3:PutObject' };
30
+ /** The IAM action an `aws <service> <command>` call needs, derived from the argv. */
31
+ export function permissionFor(args) {
32
+ const [service = '', command = ''] = args;
33
+ if (service === 's3api' || service === 's3')
34
+ return S3_ACTIONS[command] ?? `s3:${pascal(command)}`;
35
+ return `${SERVICE_PREFIX[service] ?? service}:${pascal(command)}`;
36
+ }
37
+ /**
38
+ * Explains a failed `aws` call. `args` is the argv that failed (without
39
+ * --region/--profile), `stderr` what the CLI printed, `cliVersion` the
40
+ * `aws --version` output when known.
41
+ */
42
+ export function explainAwsError(args, stderr, cliVersion) {
43
+ const raw = redact((stderr || '').trim());
44
+ const lastLine = raw.split('\n').map((l) => l.trim()).filter(Boolean).pop() || 'unknown error';
45
+ if (UNKNOWN_COMMAND.test(raw)) {
46
+ return {
47
+ kind: 'old-cli',
48
+ message: `This AWS CLI does not have "aws ${args.slice(0, 2).join(' ')}". prism-cli enable security needs AWS CLI ${MIN_AWS_CLI_TEXT} or later`
49
+ + `${cliVersion ? ` (found ${cliVersion.split(/\s+/)[0]})` : ''}. Install it from https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html`,
50
+ };
51
+ }
52
+ if (CREDENTIAL_ERRORS.test(raw)) {
53
+ return {
54
+ kind: 'no-credentials',
55
+ message: `${NO_CREDENTIALS_MESSAGE}\n ${lastLine}\n Configure them with "aws configure" or "aws sso login", or pass --profile <name>.`,
56
+ };
57
+ }
58
+ if (ACCESS_DENIED.test(raw)) {
59
+ const op = /when calling the (\w+) operation/.exec(raw)?.[1] ?? pascal(args[1] || '');
60
+ const action = /not authorized to perform:?\s+([\w-]+:[\w*]+)/.exec(raw)?.[1] ?? permissionFor(args);
61
+ return {
62
+ kind: 'access-denied',
63
+ message: `AccessDenied: ${op} (aws ${args.slice(0, 2).join(' ')}) was refused. The caller needs the IAM permission ${action}.\n ${lastLine}`,
64
+ };
65
+ }
66
+ return { kind: 'other', message: `aws ${args.slice(0, 2).join(' ')} failed: ${lastLine}` };
67
+ }
68
+ /**
69
+ * Lines for an error that is not one of ours (not an Abort): a failed npm or
70
+ * cdk run, a JSON parse, a git or file-system error. One redacted `Error:`
71
+ * line, at most one hint, and the redacted stack only with PRISM_DEBUG=1.
72
+ *
73
+ * Only `message`, `code`, `syscall` and `stack` are read. A child-process
74
+ * error also carries `cmd`, `spawnargs`, `envPairs`, `stdout` and `stderr`,
75
+ * which can hold full command lines and the environment; those are never read.
76
+ */
77
+ export function describeUnexpectedError(e, env = process.env) {
78
+ const err = e instanceof Error ? e : new Error(String(e));
79
+ const extra = err;
80
+ const code = typeof extra.code === 'string' ? extra.code : '';
81
+ const syscall = typeof extra.syscall === 'string' ? extra.syscall : '';
82
+ const firstLine = redact(err.message || String(e)).split('\n').map((l) => l.trim()).find(Boolean) || 'unknown error';
83
+ const lines = [`Error: ${firstLine}`];
84
+ const msg = err.message || '';
85
+ let hint = '';
86
+ // Most specific first: a parse or fs error whose message merely contains a
87
+ // path like cdk.out/... or .git/... must not get the cdk or git hint.
88
+ const spawned = syscall.startsWith('spawn');
89
+ if (/Command failed: npm\b|\bnpm (ERR|error)\b/.test(msg))
90
+ hint = 'Installing the CDK app dependencies failed: check network access to the npm registry and that Node.js 22 is installed, then re-run.';
91
+ else if (err instanceof SyntaxError || /\bJSON\b/.test(msg))
92
+ hint = 'A CDK template or an AWS response was not valid JSON; re-run, and report it if it repeats.';
93
+ else if (syscall && code && !spawned)
94
+ hint = `File system error (${code} during ${syscall}): check the path exists and is writable.`;
95
+ else if (/(^|[\s:'"])cdk\b(?![.-])/.test(msg))
96
+ hint = 'The CDK step failed: re-run with --dry-run to see the synth output, and check that the account is CDK-bootstrapped.';
97
+ else if (/(^|[\s:'"])git\b(?![.-])/.test(msg))
98
+ hint = 'A git command failed: run prism-cli enable security from inside the repository.';
99
+ else if (syscall && code)
100
+ hint = `Could not start a program (${code} during ${syscall}): check it is installed and on PATH.`;
101
+ if (hint)
102
+ lines.push(` ${hint}`);
103
+ if (env.PRISM_DEBUG === '1' && err.stack)
104
+ lines.push(redact(err.stack));
105
+ return lines;
106
+ }
107
+ /** Parses `aws --version` ("aws-cli/2.36.19 Python/...") and checks it against MIN_AWS_CLI. */
108
+ export function cliVersionOk(versionText) {
109
+ const m = /aws-cli\/(\d+)\.(\d+)\.(\d+)/.exec(versionText || '');
110
+ if (!m)
111
+ return { ok: true, version: null }; // unknown: let the first securityagent call decide
112
+ const [maj, min] = [Number(m[1]), Number(m[2])];
113
+ const ok = maj > MIN_AWS_CLI[0] || (maj === MIN_AWS_CLI[0] && min >= MIN_AWS_CLI[1]);
114
+ return { ok, version: `${m[1]}.${m[2]}.${m[3]}` };
115
+ }
116
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/security/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,6GAA6G;AAC7G,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,EAAE,EAAE,CAAU,CAAC;AAC5C,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAE5D,MAAM,CAAC,MAAM,sBAAsB,GAAG,uDAAuD,CAAC;AAE9F,MAAM,iBAAiB,GAAG,sPAAsP,CAAC;AACjR,MAAM,aAAa,GAAG,qFAAqF,CAAC;AAC5G,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAE1C,qFAAqF;AACrF,MAAM,UAAU,MAAM,CAAC,IAAY;IACjC,OAAO,IAAI;SACR,OAAO,CAAC,8BAA8B,EAAE,uBAAuB,CAAC;SAChE,OAAO,CAAC,0GAA0G,EAAE,gBAAgB,CAAC;SACrI,OAAO,CAAC,qEAAqE,EAAE,eAAe,CAAC,CAAC;AACrG,CAAC;AAED,gDAAgD;AAChD,SAAS,MAAM,CAAC,GAAW;IACzB,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACpF,CAAC;AAED,MAAM,cAAc,GAA2B,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE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,IAAI;QAAE,IAAI,GAAG,8BAA8B,IAAI,WAAW,OAAO,uCAAuC,CAAC;IAC7H,IAAI,IAAI;QAAE,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAClC,IAAI,GAAG,CAAC,WAAW,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK;QAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IACxE,OAAO,KAAK,CAAC;AACf,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,YAAY,CAAC,WAA0B;IACrD,MAAM,CAAC,GAAG,8BAA8B,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;IACjE,IAAI,CAAC,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,mDAAmD;IAC/F,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,MAAM,EAAE,GAAG,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACrF,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACpD,CAAC"}
@@ -0,0 +1,46 @@
1
+ import type { RunResult } from '../utils/exec.js';
2
+ export declare const MARKER_PATH = ".prism/security.local.json";
3
+ export interface SecurityMarker {
4
+ agentSpaceId: string;
5
+ applicationId: string;
6
+ codeReviewId: string;
7
+ region: string;
8
+ account: string;
9
+ setupAt: string;
10
+ }
11
+ /** Only `.prism/security.local.json`, never the legacy config.json block. */
12
+ export declare function readLocalMarker(repoRoot: string): SecurityMarker | null;
13
+ /** The marker and where it came from: the local file first, else the legacy `security` block. */
14
+ export declare function readSecurityMarkerWithSource(repoRoot: string): {
15
+ marker: SecurityMarker;
16
+ source: 'local' | 'legacy';
17
+ } | null;
18
+ /** The marker, or null when it is absent or incomplete. */
19
+ export declare function readSecurityMarker(repoRoot: string): SecurityMarker | null;
20
+ /**
21
+ * Removes only the `security` key from `.prism/config.json`, keeping every
22
+ * other key, its order, the indent and the trailing newline. Returns true when
23
+ * the key was there.
24
+ */
25
+ export declare function removeLegacyBlock(repoRoot: string): boolean;
26
+ export interface MarkerWrite {
27
+ path: string;
28
+ /** False when the file already held the same ids (setupAt is then kept). */
29
+ wrote: boolean;
30
+ /** A legacy `security` block was removed from `.prism/config.json`. */
31
+ migrated: boolean;
32
+ }
33
+ /**
34
+ * Writes `.prism/security.local.json`. setupAt is kept when nothing else
35
+ * changed, so a re-run that changes nothing leaves the file as it was. A
36
+ * legacy block in `.prism/config.json` is removed after the new file is written.
37
+ */
38
+ export declare function writeSecurityMarker(repoRoot: string, m: Omit<SecurityMarker, 'setupAt'>, now: Date): MarkerWrite;
39
+ /**
40
+ * Makes sure git ignores the marker in this clone, without touching the repo's
41
+ * .gitignore: when `git check-ignore` says it is not ignored, the path is added
42
+ * to `info/exclude` (resolved with `git rev-parse --git-path`, so linked
43
+ * worktrees use the right file). Returns the exclude file when it was changed.
44
+ */
45
+ export declare function ensureMarkerIgnored(repoRoot: string, git: (args: string[]) => RunResult): string | null;
46
+ //# sourceMappingURL=marker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marker.d.ts","sourceRoot":"","sources":["../../../src/security/marker.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,eAAO,MAAM,WAAW,+BAA+B,CAAC;AAExD,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAcD,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAEvE;AAMD,iGAAiG;AACjG,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,OAAO,GAAG,QAAQ,CAAA;CAAE,GAAG,IAAI,CAK5H;AAED,2DAA2D;AAC3D,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAE1E;AAQD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAS3D;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,KAAK,EAAE,OAAO,CAAC;IACf,uEAAuE;IACvE,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,EAAE,GAAG,EAAE,IAAI,GAAG,WAAW,CAchH;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,SAAS,GAAG,MAAM,GAAG,IAAI,CAUvG"}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * The local record that `prism-cli enable security` finished in this repo:
3
+ * `.prism/security.local.json`. Ids, account and region only, never a secret.
4
+ * It is per developer and never committed (`.prism/config.json` stays safe to
5
+ * commit for the team reviewer). The dashboard's Security Agent row reads it,
6
+ * so the dashboard stays credential-free.
7
+ *
8
+ * Earlier versions wrote the same block as `security` inside
9
+ * `.prism/config.json`. Readers fall back to it, and the next successful
10
+ * `enable security` run moves it here.
11
+ */
12
+ import { appendFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
13
+ import { dirname, resolve } from 'node:path';
14
+ import { CONFIG_PATH, readPrismConfig } from '../codewatch/config.js';
15
+ export const MARKER_PATH = '.prism/security.local.json';
16
+ const REQUIRED = ['agentSpaceId', 'codeReviewId', 'region', 'account'];
17
+ function parseMarker(s) {
18
+ if (!s || typeof s !== 'object')
19
+ return null;
20
+ for (const k of REQUIRED)
21
+ if (typeof s[k] !== 'string' || !s[k])
22
+ return null;
23
+ return {
24
+ agentSpaceId: s.agentSpaceId, applicationId: typeof s.applicationId === 'string' ? s.applicationId : '',
25
+ codeReviewId: s.codeReviewId, region: s.region, account: s.account,
26
+ setupAt: typeof s.setupAt === 'string' ? s.setupAt : '',
27
+ };
28
+ }
29
+ /** Only `.prism/security.local.json`, never the legacy config.json block. */
30
+ export function readLocalMarker(repoRoot) {
31
+ return readLocal(repoRoot);
32
+ }
33
+ function readLocal(repoRoot) {
34
+ try {
35
+ return parseMarker(JSON.parse(readFileSync(resolve(repoRoot, MARKER_PATH), 'utf8')));
36
+ }
37
+ catch {
38
+ return null;
39
+ }
40
+ }
41
+ /** The marker and where it came from: the local file first, else the legacy `security` block. */
42
+ export function readSecurityMarkerWithSource(repoRoot) {
43
+ const local = readLocal(repoRoot);
44
+ if (local)
45
+ return { marker: local, source: 'local' };
46
+ const legacy = parseMarker(readPrismConfig(repoRoot).security);
47
+ return legacy ? { marker: legacy, source: 'legacy' } : null;
48
+ }
49
+ /** The marker, or null when it is absent or incomplete. */
50
+ export function readSecurityMarker(repoRoot) {
51
+ return readSecurityMarkerWithSource(repoRoot)?.marker ?? null;
52
+ }
53
+ /** The indent a JSON file uses (its first indented line), so a rewrite keeps the look. */
54
+ function detectIndent(text) {
55
+ const m = /\n([ \t]+)"/.exec(text);
56
+ return m ? m[1] : 2;
57
+ }
58
+ /**
59
+ * Removes only the `security` key from `.prism/config.json`, keeping every
60
+ * other key, its order, the indent and the trailing newline. Returns true when
61
+ * the key was there.
62
+ */
63
+ export function removeLegacyBlock(repoRoot) {
64
+ const p = resolve(repoRoot, CONFIG_PATH);
65
+ let text;
66
+ let cfg;
67
+ try {
68
+ text = readFileSync(p, 'utf8');
69
+ cfg = JSON.parse(text);
70
+ }
71
+ catch {
72
+ return false;
73
+ }
74
+ if (!cfg || typeof cfg !== 'object' || Array.isArray(cfg) || !('security' in cfg))
75
+ return false;
76
+ delete cfg.security;
77
+ writeFileSync(p, JSON.stringify(cfg, null, detectIndent(text)) + (text.endsWith('\n') ? '\n' : ''));
78
+ return true;
79
+ }
80
+ /**
81
+ * Writes `.prism/security.local.json`. setupAt is kept when nothing else
82
+ * changed, so a re-run that changes nothing leaves the file as it was. A
83
+ * legacy block in `.prism/config.json` is removed after the new file is written.
84
+ */
85
+ export function writeSecurityMarker(repoRoot, m, now) {
86
+ const p = resolve(repoRoot, MARKER_PATH);
87
+ const prev = readSecurityMarkerWithSource(repoRoot);
88
+ const pm = prev?.marker;
89
+ const same = !!pm && pm.agentSpaceId === m.agentSpaceId && pm.applicationId === m.applicationId
90
+ && pm.codeReviewId === m.codeReviewId && pm.region === m.region && pm.account === m.account && !!pm.setupAt;
91
+ let wrote = false;
92
+ if (!(same && prev.source === 'local')) {
93
+ mkdirSync(dirname(p), { recursive: true });
94
+ writeFileSync(p, JSON.stringify({ ...m, setupAt: same ? pm.setupAt : now.toISOString() }, null, 2) + '\n');
95
+ wrote = !same;
96
+ }
97
+ const migrated = removeLegacyBlock(repoRoot);
98
+ return { path: p, wrote, migrated };
99
+ }
100
+ /**
101
+ * Makes sure git ignores the marker in this clone, without touching the repo's
102
+ * .gitignore: when `git check-ignore` says it is not ignored, the path is added
103
+ * to `info/exclude` (resolved with `git rev-parse --git-path`, so linked
104
+ * worktrees use the right file). Returns the exclude file when it was changed.
105
+ */
106
+ export function ensureMarkerIgnored(repoRoot, git) {
107
+ if (git(['-C', repoRoot, 'check-ignore', '-q', MARKER_PATH]).ok)
108
+ return null;
109
+ const r = git(['-C', repoRoot, 'rev-parse', '--path-format=absolute', '--git-path', 'info/exclude']);
110
+ if (!r.ok || !r.stdout)
111
+ return null;
112
+ const exclude = r.stdout.trim();
113
+ const text = existsSync(exclude) ? readFileSync(exclude, 'utf8') : '';
114
+ if (text.split('\n').some((l) => l.trim() === MARKER_PATH || l.trim() === `/${MARKER_PATH}`))
115
+ return null;
116
+ mkdirSync(dirname(exclude), { recursive: true });
117
+ appendFileSync(exclude, `${text && !text.endsWith('\n') ? '\n' : ''}# prism-cli enable security: per-developer record, never committed\n${MARKER_PATH}\n`);
118
+ return exclude;
119
+ }
120
+ //# sourceMappingURL=marker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marker.js","sourceRoot":"","sources":["../../../src/security/marker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEtE,MAAM,CAAC,MAAM,WAAW,GAAG,4BAA4B,CAAC;AAWxD,MAAM,QAAQ,GAA6B,CAAC,cAAc,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAEjG,SAAS,WAAW,CAAC,CAAM;IACzB,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC7C,KAAK,MAAM,CAAC,IAAI,QAAQ;QAAE,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,Q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+ export declare function runSlug(repo: RepoCtx, now: number): string;
5
+ export declare function dockerfileApp(opts: {
6
+ profile?: string;
7
+ }): PentestApp;
8
+ //# sourceMappingURL=pentest-dockerfile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pentest-dockerfile.d.ts","sourceRoot":"","sources":["../../../src/security/pentest-dockerfile.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAyB,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAGjE,OAAO,KAAK,EAAE,UAAU,EAAyC,MAAM,cAAc,CAAC;AAwBtF,yEAAyE;AACzE,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAG1D;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAkGpE"}