@documentation-robotics/cli 0.2.0 → 0.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 (269) hide show
  1. package/README.md +36 -2
  2. package/dist/analysis/relationship-classifier.js +2 -9
  3. package/dist/analysis/relationship-classifier.js.map +2 -2
  4. package/dist/analyzers/call-graph-utils.js +2 -2
  5. package/dist/analyzers/call-graph-utils.js.map +2 -2
  6. package/dist/analyzers/cards/build.js +171 -0
  7. package/dist/analyzers/cards/build.js.map +7 -0
  8. package/dist/analyzers/cards/classify.js +42 -0
  9. package/dist/analyzers/cards/classify.js.map +7 -0
  10. package/dist/analyzers/cards/edge-index.js +44 -0
  11. package/dist/analyzers/cards/edge-index.js.map +7 -0
  12. package/dist/analyzers/cards/facts.js +46 -0
  13. package/dist/analyzers/cards/facts.js.map +7 -0
  14. package/dist/analyzers/cards/graph.js +42 -0
  15. package/dist/analyzers/cards/graph.js.map +7 -0
  16. package/dist/analyzers/cards/index.js +8 -0
  17. package/dist/analyzers/cards/index.js.map +7 -0
  18. package/dist/analyzers/cards/tier0.js +18 -0
  19. package/dist/analyzers/cards/tier0.js.map +7 -0
  20. package/dist/analyzers/cards/types.js +1 -0
  21. package/dist/analyzers/cards/types.js.map +7 -0
  22. package/dist/analyzers/cbm-analyzer.js +195 -171
  23. package/dist/analyzers/cbm-analyzer.js.map +2 -2
  24. package/dist/analyzers/cbm-responses.js +336 -0
  25. package/dist/analyzers/cbm-responses.js.map +7 -0
  26. package/dist/analyzers/edge-relationships.js +45 -0
  27. package/dist/analyzers/edge-relationships.js.map +7 -0
  28. package/dist/analyzers/mapping-loader.js +9 -0
  29. package/dist/analyzers/mapping-loader.js.map +2 -2
  30. package/dist/analyzers/tier0-rules.js +153 -0
  31. package/dist/analyzers/tier0-rules.js.map +7 -0
  32. package/dist/analyzers/types.js.map +1 -1
  33. package/dist/audit/relationships/ai/prompts.js +10 -10
  34. package/dist/audit/relationships/ai/prompts.js.map +2 -2
  35. package/dist/audit/relationships/analysis/layer-templates.js +52 -52
  36. package/dist/audit/relationships/analysis/layer-templates.js.map +1 -1
  37. package/dist/cli.js +12 -2
  38. package/dist/cli.js.map +2 -2
  39. package/dist/coding-agents/default-permissions.js +31 -1
  40. package/dist/coding-agents/default-permissions.js.map +2 -2
  41. package/dist/coding-agents/drbot-mcp.js +167 -0
  42. package/dist/coding-agents/drbot-mcp.js.map +7 -0
  43. package/dist/commands/add.js +3 -2
  44. package/dist/commands/add.js.map +2 -2
  45. package/dist/commands/analyzer.js +117 -14
  46. package/dist/commands/analyzer.js.map +2 -2
  47. package/dist/commands/changeset-verify.js +55 -0
  48. package/dist/commands/changeset-verify.js.map +7 -0
  49. package/dist/commands/changeset.js +43 -22
  50. package/dist/commands/changeset.js.map +2 -2
  51. package/dist/commands/delete.js +10 -4
  52. package/dist/commands/delete.js.map +2 -2
  53. package/dist/commands/farm.js +176 -60
  54. package/dist/commands/farm.js.map +2 -2
  55. package/dist/commands/mcp.js +19 -4
  56. package/dist/commands/mcp.js.map +2 -2
  57. package/dist/commands/relationship.js +207 -26
  58. package/dist/commands/relationship.js.map +2 -2
  59. package/dist/commands/update.js +42 -23
  60. package/dist/commands/update.js.map +2 -2
  61. package/dist/commands/upgrade.js +99 -11
  62. package/dist/commands/upgrade.js.map +3 -3
  63. package/dist/commands/version.js +1 -1
  64. package/dist/commands/visualize.js +4 -3
  65. package/dist/commands/visualize.js.map +2 -2
  66. package/dist/core/catalog-migration.js +33 -0
  67. package/dist/core/catalog-migration.js.map +7 -0
  68. package/dist/core/changeset-analysis.js +421 -0
  69. package/dist/core/changeset-analysis.js.map +7 -0
  70. package/dist/core/changeset-base-index.js +153 -0
  71. package/dist/core/changeset-base-index.js.map +7 -0
  72. package/dist/core/changeset-brief-delta.js +102 -0
  73. package/dist/core/changeset-brief-delta.js.map +7 -0
  74. package/dist/core/changeset-graph.js +281 -0
  75. package/dist/core/changeset-graph.js.map +7 -0
  76. package/dist/core/changeset-only-guard.js +32 -0
  77. package/dist/core/changeset-only-guard.js.map +7 -0
  78. package/dist/core/changeset-summary.js +68 -0
  79. package/dist/core/changeset-summary.js.map +7 -0
  80. package/dist/core/changeset-validator.js +66 -20
  81. package/dist/core/changeset-validator.js.map +2 -2
  82. package/dist/core/changeset-verify.js +518 -0
  83. package/dist/core/changeset-verify.js.map +7 -0
  84. package/dist/core/changeset.js +56 -9
  85. package/dist/core/changeset.js.map +2 -2
  86. package/dist/core/element-type-migration.js +145 -0
  87. package/dist/core/element-type-migration.js.map +7 -0
  88. package/dist/core/farm-manifest.js +12 -6
  89. package/dist/core/farm-manifest.js.map +2 -2
  90. package/dist/core/farm-sync-engine.js +1 -1
  91. package/dist/core/farm-sync-engine.js.map +2 -2
  92. package/dist/core/farm-sync-state.js +10 -2
  93. package/dist/core/farm-sync-state.js.map +2 -2
  94. package/dist/core/migration-registry.js +75 -46
  95. package/dist/core/migration-registry.js.map +2 -2
  96. package/dist/core/model-upgrade.js +102 -0
  97. package/dist/core/model-upgrade.js.map +7 -0
  98. package/dist/core/model.js +82 -30
  99. package/dist/core/model.js.map +2 -2
  100. package/dist/core/mutation-handler.js +71 -6
  101. package/dist/core/mutation-handler.js.map +2 -2
  102. package/dist/core/relationship-migration-table.js +6639 -0
  103. package/dist/core/relationship-migration-table.js.map +7 -0
  104. package/dist/core/relationship-migration.js +272 -0
  105. package/dist/core/relationship-migration.js.map +7 -0
  106. package/dist/core/relationship-prune.js +49 -0
  107. package/dist/core/relationship-prune.js.map +7 -0
  108. package/dist/core/relationship-staging.js +68 -0
  109. package/dist/core/relationship-staging.js.map +7 -0
  110. package/dist/core/relationships.js +26 -4
  111. package/dist/core/relationships.js.map +2 -2
  112. package/dist/core/report-data-model.js +7 -13
  113. package/dist/core/report-data-model.js.map +2 -2
  114. package/dist/core/staged-changeset-storage.js +64 -17
  115. package/dist/core/staged-changeset-storage.js.map +2 -2
  116. package/dist/core/staged-source-reference.js +28 -0
  117. package/dist/core/staged-source-reference.js.map +7 -0
  118. package/dist/core/staging-area.js +83 -18
  119. package/dist/core/staging-area.js.map +2 -2
  120. package/dist/core/virtual-projection.js +13 -5
  121. package/dist/core/virtual-projection.js.map +2 -2
  122. package/dist/export/archimate-exporter.js +1 -0
  123. package/dist/export/archimate-exporter.js.map +2 -2
  124. package/dist/generated/compiled-validators.js +2 -2
  125. package/dist/generated/compiled-validators.js.map +2 -2
  126. package/dist/generated/layer-registry.js +16 -16
  127. package/dist/generated/layer-registry.js.map +2 -2
  128. package/dist/generated/node-types.js +186 -168
  129. package/dist/generated/node-types.js.map +2 -2
  130. package/dist/generated/relationship-index.js +2236 -7790
  131. package/dist/generated/relationship-index.js.map +2 -2
  132. package/dist/integrations/claude_code/agents/dr-architect.md +16 -3
  133. package/dist/integrations/claude_code/agents/dr-extractor.md +1 -1
  134. package/dist/integrations/claude_code/commands/dr-analyzer.md +565 -0
  135. package/dist/integrations/claude_code/commands/dr-map.md +13 -0
  136. package/dist/integrations/claude_code/commands/dr-plan.md +40 -0
  137. package/dist/integrations/claude_code/commands/dr-relate.md +106 -96
  138. package/dist/integrations/claude_code/commands/dr-verify.md +45 -2
  139. package/dist/integrations/claude_code/docs/END_TO_END_WALKTHROUGH.md +14 -0
  140. package/dist/integrations/claude_code/docs/MCP_SERVER.md +26 -2
  141. package/dist/integrations/claude_code/docs/QUICK_START.md +37 -8
  142. package/dist/integrations/claude_code/docs/README.md +48 -1
  143. package/dist/integrations/claude_code/skills/dr_01_motivation_layer/SKILL.md +93 -72
  144. package/dist/integrations/claude_code/skills/dr_02_business_layer/SKILL.md +163 -126
  145. package/dist/integrations/claude_code/skills/dr_03_product_layer/SKILL.md +161 -126
  146. package/dist/integrations/claude_code/skills/dr_04_security_layer/SKILL.md +153 -133
  147. package/dist/integrations/claude_code/skills/dr_05_application_layer/SKILL.md +129 -100
  148. package/dist/integrations/claude_code/skills/dr_06_technology_layer/SKILL.md +111 -94
  149. package/dist/integrations/claude_code/skills/dr_07_api_layer/SKILL.md +143 -157
  150. package/dist/integrations/claude_code/skills/dr_08_data_model_layer/SKILL.md +117 -33
  151. package/dist/integrations/claude_code/skills/dr_09_dataset_layer/SKILL.md +74 -25
  152. package/dist/integrations/claude_code/skills/dr_10_ux_layer/SKILL.md +88 -12
  153. package/dist/integrations/claude_code/skills/dr_11_navigation_layer/SKILL.md +83 -24
  154. package/dist/integrations/claude_code/skills/dr_12_apm_layer/SKILL.md +57 -12
  155. package/dist/integrations/claude_code/skills/dr_13_testing_layer/SKILL.md +92 -15
  156. package/dist/integrations/claude_code/skills/dr_change_planning/SKILL.md +119 -0
  157. package/dist/integrations/claude_code/skills/dr_changeset_reviewer/SKILL.md +3 -0
  158. package/dist/integrations/claude_code/skills/dr_engineering_guide/SKILL.md +1 -1
  159. package/dist/integrations/github_copilot/agents/dr-architect.md +1 -1
  160. package/dist/integrations/github_copilot/skills/dr_01_motivation_layer/SKILL.md +182 -102
  161. package/dist/integrations/github_copilot/skills/dr_02_business_layer/SKILL.md +266 -148
  162. package/dist/integrations/github_copilot/skills/dr_03_product_layer/SKILL.md +547 -86
  163. package/dist/integrations/github_copilot/skills/dr_04_security_layer/SKILL.md +164 -169
  164. package/dist/integrations/github_copilot/skills/dr_05_application_layer/SKILL.md +420 -150
  165. package/dist/integrations/github_copilot/skills/dr_06_technology_layer/SKILL.md +331 -138
  166. package/dist/integrations/github_copilot/skills/dr_07_api_layer/SKILL.md +265 -201
  167. package/dist/integrations/github_copilot/skills/dr_08_data_model_layer/SKILL.md +181 -58
  168. package/dist/integrations/github_copilot/skills/dr_09_dataset_layer/SKILL.md +209 -57
  169. package/dist/integrations/github_copilot/skills/dr_10_ux_layer/SKILL.md +277 -112
  170. package/dist/integrations/github_copilot/skills/dr_11_navigation_layer/SKILL.md +219 -70
  171. package/dist/integrations/github_copilot/skills/dr_12_apm_layer/SKILL.md +189 -105
  172. package/dist/integrations/github_copilot/skills/dr_13_testing_layer/SKILL.md +222 -102
  173. package/dist/integrations/github_copilot/skills/dr_change_planning/SKILL.md +119 -0
  174. package/dist/integrations/github_copilot/skills/dr_changeset_reviewer/SKILL.md +3 -0
  175. package/dist/integrations/hash-utils.js.map +2 -2
  176. package/dist/mcp/api-key-manager.js +14 -1
  177. package/dist/mcp/api-key-manager.js.map +2 -2
  178. package/dist/mcp/changeset-only.js +34 -0
  179. package/dist/mcp/changeset-only.js.map +7 -0
  180. package/dist/mcp/tool-registry.js +19 -3
  181. package/dist/mcp/tool-registry.js.map +2 -2
  182. package/dist/mcp/tools/changeset-analysis-tools.js +78 -0
  183. package/dist/mcp/tools/changeset-analysis-tools.js.map +7 -0
  184. package/dist/mcp/tools/changeset-editing.js +184 -0
  185. package/dist/mcp/tools/changeset-editing.js.map +7 -0
  186. package/dist/mcp/tools/changeset-lifecycle.js +83 -0
  187. package/dist/mcp/tools/changeset-lifecycle.js.map +7 -0
  188. package/dist/mcp/tools/changeset-shared.js +31 -0
  189. package/dist/mcp/tools/changeset-shared.js.map +7 -0
  190. package/dist/mcp/tools/changeset-show.js +17 -1
  191. package/dist/mcp/tools/changeset-show.js.map +2 -2
  192. package/dist/mcp/tools/changeset-verify.js +43 -0
  193. package/dist/mcp/tools/changeset-verify.js.map +7 -0
  194. package/dist/mcp/tools/index.js +19 -1
  195. package/dist/mcp/tools/index.js.map +2 -2
  196. package/dist/mcp/tools/model-add.js +6 -5
  197. package/dist/mcp/tools/model-add.js.map +2 -2
  198. package/dist/mcp/tools/model-delete.js +2 -2
  199. package/dist/mcp/tools/model-delete.js.map +2 -2
  200. package/dist/mcp/tools/model-search.js +14 -0
  201. package/dist/mcp/tools/model-search.js.map +2 -2
  202. package/dist/mcp/tools/model-show.js +29 -2
  203. package/dist/mcp/tools/model-show.js.map +2 -2
  204. package/dist/mcp/tools/model-trace.js +93 -30
  205. package/dist/mcp/tools/model-trace.js.map +2 -2
  206. package/dist/mcp/tools/model-update.js +35 -19
  207. package/dist/mcp/tools/model-update.js.map +2 -2
  208. package/dist/mcp/tools/relationship-tools.js +98 -0
  209. package/dist/mcp/tools/relationship-tools.js.map +7 -0
  210. package/dist/mcp/tools/shared.js +25 -2
  211. package/dist/mcp/tools/shared.js.map +2 -2
  212. package/dist/mcp/tools/spec-type.js +90 -0
  213. package/dist/mcp/tools/spec-type.js.map +7 -0
  214. package/dist/schemas/bundled/analyzers/cbm.json +1186 -68
  215. package/dist/schemas/bundled/analyzers/manifest.json +2 -2
  216. package/dist/schemas/bundled/api.json +1029 -1658
  217. package/dist/schemas/bundled/apm.json +499 -734
  218. package/dist/schemas/bundled/application.json +735 -371
  219. package/dist/schemas/bundled/base.json +3 -220
  220. package/dist/schemas/bundled/business.json +452 -366
  221. package/dist/schemas/bundled/data-model.json +395 -411
  222. package/dist/schemas/bundled/data-store.json +334 -558
  223. package/dist/schemas/bundled/manifest.json +18 -18
  224. package/dist/schemas/bundled/motivation.json +349 -368
  225. package/dist/schemas/bundled/navigation.json +415 -731
  226. package/dist/schemas/bundled/product.json +325 -159
  227. package/dist/schemas/bundled/security.json +864 -1232
  228. package/dist/schemas/bundled/technology.json +574 -703
  229. package/dist/schemas/bundled/testing.json +718 -1643
  230. package/dist/schemas/bundled/ux.json +739 -1352
  231. package/dist/server/schemas.js +8 -0
  232. package/dist/server/schemas.js.map +2 -2
  233. package/dist/server/server.js +218 -34
  234. package/dist/server/server.js.map +2 -2
  235. package/dist/server-entry.js +2 -1
  236. package/dist/server-entry.js.map +2 -2
  237. package/dist/telemetry/index.js +1 -1
  238. package/dist/utils/ansi-suppressor.js +6 -8
  239. package/dist/utils/ansi-suppressor.js.map +2 -2
  240. package/dist/utils/attribute-patch.js +41 -0
  241. package/dist/utils/attribute-patch.js.map +7 -0
  242. package/dist/utils/error-hints.js +29 -0
  243. package/dist/utils/error-hints.js.map +7 -0
  244. package/dist/utils/errors.js +9 -3
  245. package/dist/utils/errors.js.map +2 -2
  246. package/dist/utils/project-paths.js +26 -1
  247. package/dist/utils/project-paths.js.map +2 -2
  248. package/dist/utils/source-reference.js +14 -12
  249. package/dist/utils/source-reference.js.map +2 -2
  250. package/dist/utils/spec-version.js +2 -2
  251. package/dist/utils/spec-version.js.map +1 -1
  252. package/dist/validators/composed-reference-validator.js +5 -27
  253. package/dist/validators/composed-reference-validator.js.map +2 -2
  254. package/dist/validators/reference-validator.js +0 -7
  255. package/dist/validators/reference-validator.js.map +2 -2
  256. package/dist/validators/relationship-schema-validator.js +3 -3
  257. package/dist/validators/relationship-schema-validator.js.map +2 -2
  258. package/dist/validators/schema-validator.js +27 -9
  259. package/dist/validators/schema-validator.js.map +2 -2
  260. package/dist/validators/types.js.map +1 -1
  261. package/dist/viewer/README.md +6 -6
  262. package/dist/viewer/assets/main-CxzcuU_o.js +84 -0
  263. package/dist/viewer/assets/main-j-7ULYpm.css +1 -0
  264. package/dist/viewer/index.html +2 -2
  265. package/dist/viewer/manifest.json +10 -10
  266. package/dist/viewer/version.json +1 -1
  267. package/package.json +2 -1
  268. package/dist/viewer/assets/main-B7AOQXXX.js +0 -81
  269. package/dist/viewer/assets/main-vdrFrG7q.css +0 -1
@@ -92,51 +92,60 @@ This layer uses a **custom YAML specification** designed to cover authentication
92
92
 
93
93
  ## Intra-Layer Relationships
94
94
 
95
- Security layer uses **containment relationships** rather than explicit ArchiMate-style relationships:
96
-
97
- ### Containment Hierarchy
98
-
99
- ```
100
- SecurityModel
101
- ├── contains → AuthenticationConfig
102
- ├── contains → Actors []
103
- │ └── each Actor contains → ActorObjectives [], ActorDependencies []
104
- ├── contains → Roles []
105
- ├── contains → Permissions []
106
- ├── contains → SecureResources []
107
- │ └── each SecureResource contains → ResourceOperations []
108
- │ └── each ResourceOperation contains → AccessConditions [], FieldAccessControls []
109
- ├── contains → InformationEntities []
110
- │ └── each InformationEntity contains → InformationRights []
111
- ├── contains → Delegations []
112
- ├── contains → SecurityConstraints
113
- │ ├── contains → SeparationOfDuty []
114
- │ ├── contains → BindingOfDuty []
115
- │ └── contains → NeedToKnow []
116
- ├── contains → SecurityPolicies []
117
- │ └── each SecurityPolicy contains → PolicyRules []
118
- │ └── each PolicyRule contains → PolicyActions []
119
- ├── contains → DataClassification
120
- ├── contains → SocialDependencies []
121
- ├── contains → AccountabilityRequirements []
122
- │ └── each AccountabilityRequirement contains → Evidence []
123
- └── contains → Threats []
124
- └── each Threat contains → Countermeasures []
125
- ```
95
+ Containment is recorded with `aggregates` / `composes`; behavior and access rules use the predicates below. Record each link with `dr relationship add`.
96
+
97
+ Access follows one chain: actors are `assigned-to` roles, roles `aggregates` permissions, and
98
+ permissions `authorizes` resource operations. A policy `composes` its rules, and a rule `uses` its
99
+ conditions and `triggers` its actions. Policies `mandates` countermeasures, and only countermeasures
100
+ `mitigates` threats. Audit configs and rules `generates` evidence, which retention policies govern.
101
+ Other layers link to the individual duty rule (separation of duty, binding of duty, need to know),
102
+ not to the constraints container, and data elements `references` their classification.
103
+
104
+ ### Containment
105
+
106
+ | Source Type | Predicate | Target Type | Example |
107
+ | ------------------- | ---------- | -------------------- | ---------------------------------------------------------- |
108
+ | SecurityModel | composes | AuthenticationConfig | "Application Security" composes "OAuth2 Google" |
109
+ | SecurityModel | composes | SecurityPolicy | "Application Security" composes "Data Access Policy" |
110
+ | SecurityModel | aggregates | Role | "Application Security" aggregates "Admin", "User", "Guest" |
111
+ | SecurityModel | aggregates | Threat | "Application Security" aggregates "SQL Injection" |
112
+ | SecureResource | composes | ResourceOperation | "User API" composes "List Users", "Create User" |
113
+ | SecureResource | composes | FieldAccessControl | "Customer Record" composes "Mask SSN For Support" |
114
+ | SecurityPolicy | composes | PolicyRule | "Data Access Policy" composes "Owner Can Write" |
115
+ | SecurityConstraints | aggregates | SeparationOfDuty | "Payment Controls" aggregates "Approve Payment SoD" |
126
116
 
127
117
  ### Key Relationship Patterns
128
118
 
129
- | Source | Relationship | Target | Example |
130
- | ---------------- | ------------- | ------------------- | -------------------------------------------------------- |
131
- | Actor | has-objective | ActorObjective | "Support Agent" has objective "Resolve Customer Issues" |
132
- | Actor | depends-on | InformationEntity | Actor depends on information to achieve objectives |
133
- | Actor | delegates-to | Actor | "Manager" delegates "Approval Permission" to "Team Lead" |
134
- | Role | inherits-from | Role | "Admin" inherits from "User" |
135
- | Permission | applies-to | SecureResource | "users.read" applies to "UserData" resource |
136
- | PolicyRule | evaluates | AccessCondition | Rule evaluates ABAC conditions |
137
- | Threat | mitigated-by | Countermeasure | "SQL Injection" mitigated by "Input Validation" |
138
- | ActorObjective | references | Goal (Layer 1) | Security objective links to business goal |
139
- | SocialDependency | defines | Actor → Actor trust | "Vendor" depends on "Company" for payment |
119
+ | Source Type | Predicate | Target Type | Example |
120
+ | ------------------------- | -------------- | ------------------------- | ------------------------------------------------------------- |
121
+ | Actor | assigned-to | Role | "Support Agent" assigned-to "Support" |
122
+ | AuthenticationConfig | authenticates | Actor | "mTLS Client Certificate" authenticates "Service Account" |
123
+ | Role | aggregates | Permission | "Admin" aggregates "users.write" |
124
+ | Role | specializes | Role | "Admin" specializes "User" |
125
+ | Permission | authorizes | ResourceOperation | "users.read" authorizes "List Users" |
126
+ | ResourceOperation | constrained-by | AccessCondition | "Update Invoice" constrained-by "Is Owner" |
127
+ | ResourceOperation | references | AuditConfig | "Delete User" references "Admin Action Audit" |
128
+ | AuthenticationConfig | uses | PasswordPolicy | "Internal JWT Login" uses "Corporate Password Policy" |
129
+ | AuthenticationConfig | protects | SecureResource | "OAuth2 Google" protects "User API" |
130
+ | FieldAccessControl | requires | Permission | "SSN Field Read" requires "pii.read" |
131
+ | PolicyRule | uses | AccessCondition | "Owner Can Write" uses "Is Owner" |
132
+ | PolicyRule | triggers | PolicyAction | "Block After 5 Failures" triggers "Lock Account" |
133
+ | PolicyRule | authorizes | Permission | "Business Hours Only" authorizes "payments.approve" |
134
+ | Delegation | authorizes | Role | "Budget Approval Delegation" authorizes "Approver" |
135
+ | Delegation | requires | Actor | "Budget Approval Delegation" requires "CFO" (delegatee) |
136
+ | InformationRight | assigned-to | Actor | "Read Customer PII" assigned-to "Support Agent" |
137
+ | InformationRight | accesses | InformationEntity | "Read Customer PII" accesses "Customer PII" |
138
+ | NeedToKnow | protects | InformationEntity | "Support Needs Ticket Context" protects "Customer PII" |
139
+ | SeparationOfDuty | constrains | Role | "Approve Payment SoD" constrains "Payment Creator" |
140
+ | BindingOfDuty | governs | ResourceOperation | "Refund Same Handler" governs "Complete Refund" |
141
+ | DataClassification | governs | SecureResource | "Confidential" governs "Customer Record" |
142
+ | Threat | targets | SecureResource | "SQL Injection" targets "Orders Database" |
143
+ | Countermeasure | mitigates | Threat | "Parameterized Queries" mitigates "SQL Injection" |
144
+ | Countermeasure | protects | SecureResource | "WAF Rules" protects "Public API" |
145
+ | AuditConfig | monitors | SecureResource | "Admin Action Audit" monitors "User API" |
146
+ | AuditConfig | satisfies | AccountabilityRequirement | "Admin Action Audit" satisfies "Non-Repudiation Of Admin Ops" |
147
+ | AccountabilityRequirement | requires | Evidence | "Non-Repudiation Of Admin Ops" requires "Signed Audit Entry" |
148
+ | RetentionPolicy | governs | AuditConfig | "7-Year Audit Retention" governs "Admin Action Audit" |
140
149
 
141
150
  ---
142
151
 
@@ -144,31 +153,41 @@ SecurityModel
144
153
 
145
154
  ### Outgoing References (Security → Other Layers)
146
155
 
147
- | Target Layer | Reference Type | Example |
148
- | ------------------------- | ------------------------------------------------ | --------------------------------------------------------- |
149
- | **Layer 1 (Motivation)** | Actor references **Stakeholder** | Security actor maps to business stakeholder |
150
- | **Layer 1 (Motivation)** | ActorObjective references **Goal** | "Protect Customer Data" objective links to "Privacy Goal" |
151
- | **Layer 1 (Motivation)** | Threat references **Assessment** | Threat is a risk assessment |
152
- | **Layer 1 (Motivation)** | Countermeasure implements **Requirement** | Security control fulfills security requirement |
153
- | **Layer 1 (Motivation)** | SocialDependency references **Constraint** | Trust commitments are constraints |
154
- | **Layer 2 (Business)** | Actor references **BusinessActor** | Security actor maps to business role |
155
- | **Layer 2 (Business)** | SecurityConstraints apply to **BusinessProcess** | Separation of duty applies to business tasks |
156
- | **Layer 4 (Application)** | SecureResource references **ApplicationService** | Protects application components |
157
- | **Layer 4 (Application)** | SecureResource references **DataObject** | Protects application data |
158
- | **Layer 6 (API)** | SecureResource references **API Operations** | API endpoint security |
159
- | **Layer 6 (API)** | SecurityScheme maps to **API SecurityScheme** | OAuth2 config maps to OpenAPI security |
160
- | **Layer 5 (Technology)** | Artifact **encryption** property | Data-at-rest encryption |
161
- | **Layer 5 (Technology)** | Artifact **classification** property | Data classification levels |
162
- | **Layer 11 (APM)** | AuditConfig **retention** | Audit log retention policies |
163
- | **Layer 11 (APM)** | AuditConfig **monitoring** | Security event monitoring |
164
-
165
- ### Incoming References (Lower Layers → Security)
166
-
167
- Lower layers reference Security layer to:
168
-
169
- - Apply authentication/authorization to services and APIs
170
- - Enforce data classification on artifacts and data objects
171
- - Implement security policies and access controls
156
+ | Source Type | Predicate | Target Type | Example |
157
+ | ------------------------- | ---------- | -------------------------- | --------------------------------------------------------------- |
158
+ | Countermeasure | satisfies | `motivation.requirement` | "Parameterized Queries" satisfies "Prevent Injection Attacks" |
159
+ | Countermeasure | realizes | `motivation.goal` | "Encrypt PII At Rest" realizes "Protect Customer Privacy" |
160
+ | SecurityPolicy | satisfies | `motivation.requirement` | "Data Access Policy" satisfies "GDPR Article 32" |
161
+ | SecurityPolicy | satisfies | `motivation.principle` | "Default Deny Policy" satisfies "Least Privilege" |
162
+ | SecurityConstraints | satisfies | `motivation.constraint` | "Payment Controls" satisfies "SOX Dual Control" |
163
+ | AccountabilityRequirement | satisfies | `motivation.requirement` | "Non-Repudiation Of Admin Ops" satisfies "Audit Trail Required" |
164
+ | Threat | references | `motivation.driver` | "Credential Stuffing" references "Account Takeover Risk" |
165
+ | Role | references | `business.businessrole` | "Admin" references "System Administrator" |
166
+ | SeparationOfDuty | constrains | `business.businessrole` | "Approve Payment SoD" constrains "Accounts Payable Clerk" |
167
+ | SecurityPolicy | governs | `business.businessprocess` | "Refund Approval Policy" governs "Process Refund" |
168
+ | SecurityPolicy | governs | `business.businessservice` | "PCI Policy" governs "Card Payments" |
169
+ | Countermeasure | protects | `business.businessprocess` | "Fraud Scoring" protects "Checkout" |
170
+ | SecureResource | references | `business.businessobject` | "Customer Record" references "Customer" |
171
+ | Threat | targets | `business.businessservice` | "Card Testing Attack" targets "Card Payments" |
172
+
173
+ ### Incoming References (Other Layers → Security)
174
+
175
+ | Source Type | Predicate | Target Type | Example |
176
+ | ---------------------------------- | -------------- | -------------------- | ------------------------------------------------------- |
177
+ | `application.applicationinterface` | exposes | SecureResource | "User REST API" exposes "User API" resource |
178
+ | `application.applicationcomponent` | realizes | Countermeasure | "Fetch Interceptor" realizes "Bearer Token Injection" |
179
+ | `application.applicationservice` | requires | AuthenticationConfig | "Order API" requires "Internal JWT" |
180
+ | `application.applicationservice` | constrained-by | SecurityPolicy | "Patient Records Service" constrained-by "HIPAA Policy" |
181
+ | `api.operation` | requires | Permission | "GET /users" requires "users.read" |
182
+ | `api.securityscheme` | realizes | SecurityPolicy | "bearerAuth" realizes "API Authentication Policy" |
183
+ | `api.ratelimit` | realizes | Countermeasure | "100 req/min per key" realizes "Rate Limiting" |
184
+ | `business.businessprocess` | constrained-by | SeparationOfDuty | "Approve Payment" constrained-by "Approve Payment SoD" |
185
+ | `data-model.schemaproperty` | satisfies | FieldAccessControl | "Customer.ssn" satisfies "Mask SSN For Support" |
186
+ | `data-store.field` | references | DataClassification | "customers.ssn" references "Restricted" |
187
+ | `navigation.navigationguard` | requires | Role | "AdminGuard" requires "Admin" |
188
+ | `ux.view` | requires | Permission | "User Admin Screen" requires "users.write" |
189
+ | `apm.logconfiguration` | satisfies | AuditConfig | "Audit Log Pipeline" satisfies "Admin Action Audit" |
190
+ | `testing.testcasesketch` | tests | Threat | "Injection payloads on search" tests "SQL Injection" |
172
191
 
173
192
  ---
174
193
 
@@ -310,7 +329,7 @@ def get_user_by_email(email: str):
310
329
 
311
330
  - Threat: "SQL Injection" (likelihood: high, impact: critical)
312
331
  - Countermeasure: "Parameterized Queries"
313
- - Threat mitigated-by Countermeasure
332
+ - Countermeasure mitigates Threat
314
333
 
315
334
  ---
316
335
 
@@ -370,24 +389,19 @@ dr add security resource-operation "create-user" \
370
389
  --description "Create new user operation"
371
390
  ```
372
391
 
373
- ### Step 4: Define Security Actors and Objectives (STS-ml)
392
+ ### Step 4: Define Security Actors (STS-ml)
374
393
 
375
394
  ```bash
376
395
  # Security actors
377
396
  dr add security actor "support-agent" \
378
397
  --description "Customer support team member"
379
398
 
380
- # Actor objectives (link to motivation goals)
381
- dr add security actor-objective "resolve-customer-issues" \
382
- --description "Provide timely customer support"
383
-
384
- # Link objective to motivation layer
385
- dr relationship add security.actor-objective.resolve-customer-issues \
386
- motivation.goal.customer-satisfaction --predicate supports
399
+ # Assign the actor to a role and the authentication it must use
400
+ dr relationship add security.actor.support-agent \
401
+ security.role.user --predicate assigned-to
387
402
 
388
- # Actor dependencies
389
- dr add security actor-dependency "support-needs-customer-data" \
390
- --description "Support agent requires customer data to resolve issues"
403
+ dr relationship add security.authenticationconfig.oauth2-google \
404
+ security.actor.support-agent --predicate authenticates
391
405
  ```
392
406
 
393
407
  ### Step 5: Define Information Entities and Rights
@@ -432,9 +446,12 @@ dr add security threat "sql-injection" \
432
446
  dr add security countermeasure "parameterized-queries" \
433
447
  --description "Use parameterized queries for all database operations"
434
448
 
435
- # Link threat to motivation layer
436
- dr relationship add security.threat.sql-injection \
437
- motivation.assessment.security-vulnerability-risk --predicate references
449
+ # Link countermeasure to threat, and to the requirement it satisfies
450
+ dr relationship add security.countermeasure.parameterized-queries \
451
+ security.threat.sql-injection --predicate mitigates
452
+
453
+ dr relationship add security.countermeasure.parameterized-queries \
454
+ motivation.requirement.prevent-injection-attacks --predicate satisfies
438
455
  ```
439
456
 
440
457
  ### Step 8: Define Policies (ABAC)
@@ -456,17 +473,21 @@ dr add security access-condition "is-owner" \
456
473
  ### Step 9: Cross-Layer Integration
457
474
 
458
475
  ```bash
459
- # Link to application layer
460
- dr relationship add security.secure-resource.user-api \
461
- application.service.user-management-api --predicate protects
476
+ # Application interface exposes the secure resource
477
+ dr relationship add application.applicationinterface.user-api-rest \
478
+ security.secureresource.user-api --predicate exposes
462
479
 
463
- # Link to API layer
464
- dr relationship add security.resource-operation.list-users \
465
- api.operation.get-users --predicate protects
480
+ # API operation requires a permission
481
+ dr relationship add api.operation.get-users \
482
+ security.permission.users-read --predicate requires
466
483
 
467
- # Link to motivation layer
468
- dr relationship add security.actor.support-agent \
469
- motivation.stakeholder.customer-support-team --predicate references
484
+ # Security role references a business role
485
+ dr relationship add security.role.admin \
486
+ business.businessrole.system-administrator --predicate references
487
+
488
+ # Security policy satisfies a motivation requirement
489
+ dr relationship add security.securitypolicy.data-access-policy \
490
+ motivation.requirement.gdpr-article-32 --predicate satisfies
470
491
  ```
471
492
 
472
493
  ### Step 10: Validate
@@ -484,36 +505,37 @@ dr validate --relationships
484
505
 
485
506
  ```
486
507
  Role: "Admin" (hierarchy: 1)
487
- ├── inherits-from → Role: "Manager" (hierarchy: 2)
488
- │ ├── inherits-from → Role: "User" (hierarchy: 3)
489
- │ │ └── inherits-from → Role: "Guest" (hierarchy: 4)
490
- │ └── has-permission → Permission: "users.write"
491
- ├── has-permission → Permission: "admin.all"
492
- └── allowed-on → ResourceOperation: "delete-user"
508
+ ├── specializes → Role: "Manager" (hierarchy: 2)
509
+ │ ├── specializes → Role: "User" (hierarchy: 3)
510
+ │ │ └── specializes → Role: "Guest" (hierarchy: 4)
511
+ │ └── aggregates → Permission: "users.write"
512
+ └── aggregates → Permission: "admin.all"
513
+ └── authorizes → ResourceOperation: "delete-user"
493
514
  ```
494
515
 
495
516
  ### Pattern 2: Goal-Oriented Security (STS-ml)
496
517
 
497
518
  ```
498
519
  Actor: "Data Analyst"
499
- ├── has-objective → ActorObjective: "Generate Business Reports"
500
- │ └── supports → Goal: "Data-Driven Decisions" (Layer 1)
501
- ├── depends-on → InformationEntity: "Sales Data"
502
- │ ├── has-right → InformationRight: "read" (Data Analyst)
503
- │ └── classification: "internal"
504
- └── subject-to → NeedToKnow: "Access sales data only for reporting objectives"
520
+ ├── assigned-to → Role: "Analyst"
521
+ └── ← assigned-to — InformationRight: "Read Sales Data"
522
+ └── governs → InformationEntity: "Sales Data"
523
+ ├── constrained-by → DataClassification: "Internal"
524
+ └── ← protects — NeedToKnow: "Access sales data only for reporting"
525
+ Countermeasure: "Row-Level Security On Sales Data"
526
+ └── realizes → motivation.goal: "Data-Driven Decisions"
505
527
  ```
506
528
 
507
529
  ### Pattern 3: Delegation Chain
508
530
 
509
531
  ```
510
532
  Actor: "CEO"
511
- └── delegates-to → Delegation: "Budget Approval"
512
- ├── delegatee → Actor: "CFO"
513
- ├── type: "approval"
514
- ├── retain-oversight: true
515
- └── delegates-to → Delegation: "Department Budget"
516
- ├── delegatee → Actor: "Department Head"
533
+ └── associated-with → Delegation: "Budget Approval"
534
+ ├── requires → Actor: "CFO" (delegatee)
535
+ ├── authorizes → Role: "Budget Approver"
536
+ ├── type: "approval", retain-oversight: true
537
+ └── (CFO) associated-with → Delegation: "Department Budget"
538
+ ├── requires → Actor: "Department Head" (delegatee)
517
539
  └── retain-oversight: true
518
540
  ```
519
541
 
@@ -524,12 +546,10 @@ Threat: "Unauthorized API Access"
524
546
  ├── likelihood: "high"
525
547
  ├── impact: "critical"
526
548
  ├── category: "broken-authentication"
527
- └── mitigated-by → Countermeasure: "JWT Authentication"
528
- ├── status: "implemented"
529
- └── mitigated-by → Countermeasure: "Rate Limiting"
530
- ├── status: "implemented"
531
- └── mitigated-by → Countermeasure: "API Key Rotation"
532
- └── status: "planned"
549
+ ├── aggregates → Countermeasure: "JWT Authentication" (status: implemented)
550
+ ├── aggregates → Countermeasure: "Rate Limiting" (status: implemented)
551
+ └── aggregates → Countermeasure: "API Key Rotation" (status: planned)
552
+ (each Countermeasure also mitigates → Threat: "Unauthorized API Access")
533
553
  ```
534
554
 
535
555
  ---
@@ -540,7 +560,7 @@ The Security Layer integrates **STS-ml 2.0** (Socio-Technical Security Modeling
540
560
 
541
561
  ### 1. Goal-Oriented Security
542
562
 
543
- - **Actor Objectives** link to Motivation Layer goals
563
+ - **Countermeasures and policies** link to Motivation Layer goals, principles and requirements (`realizes`, `satisfies`)
544
564
  - Security is justified by business goals
545
565
  - Traceability: Why do we need this security control?
546
566
 
@@ -594,15 +614,15 @@ The Security Layer integrates **STS-ml 2.0** (Socio-Technical Security Modeling
594
614
 
595
615
  ## Validation Tips
596
616
 
597
- | Issue | Cause | Fix |
598
- | ---------------------------- | ---------------------------------------------- | ------------------------------------ |
599
- | Orphaned Actor | Actor has no objectives or dependencies | Add actor objectives or remove actor |
600
- | Unmapped Threat | Threat has no countermeasures | Add countermeasures or accept risk |
601
- | Unused Permission | Permission not assigned to roles or operations | Assign to roles or remove |
602
- | Missing Field-Level Security | Sensitive data lacks FieldAccessControl | Add field-level access rules |
603
- | Unlinked Objective | ActorObjective doesn't link to motivation goal | Add cross-layer link |
604
- | No Evidence | AccountabilityRequirement lacks evidence | Define required evidence types |
605
- | Incomplete Delegation | Delegation chain missing delegatee | Complete delegation or remove |
617
+ | Issue | Cause | Fix |
618
+ | ---------------------------- | ---------------------------------------------- | ---------------------------------- |
619
+ | Orphaned Actor | Actor not assigned to any role | Assign to a Role or remove actor |
620
+ | Unmapped Threat | Threat has no countermeasures | Add countermeasures or accept risk |
621
+ | Unused Permission | Permission not assigned to roles or operations | Assign to roles or remove |
622
+ | Missing Field-Level Security | Sensitive data lacks FieldAccessControl | Add field-level access rules |
623
+ | Unlinked Countermeasure | Countermeasure doesn't satisfy a requirement | Add cross-layer link |
624
+ | No Evidence | AccountabilityRequirement lacks evidence | Define required evidence types |
625
+ | Incomplete Delegation | Delegation chain missing delegatee | Complete delegation or remove |
606
626
 
607
627
  ---
608
628
 
@@ -617,7 +637,6 @@ dr add security role <name> --description <description>
617
637
  dr add security permission <name> --description <description>
618
638
  dr add security secure-resource <name> --description <description>
619
639
  dr add security actor <name> --description <description>
620
- dr add security actor-objective <name> --description <description>
621
640
  dr add security information-entity <name> --description <description>
622
641
  dr add security threat <name> --description <description>
623
642
  dr add security countermeasure <name> --description <description>
@@ -627,16 +646,17 @@ dr add security delegation <name> --description <description>
627
646
  **Relationship Commands:**
628
647
 
629
648
  ```bash
630
- dr relationship add <actor> <objective> --predicate has-objective
631
- dr relationship add <threat> <countermeasure> --predicate mitigated-by
632
- dr relationship add <secure-resource> <application-service> --predicate protects
633
- dr relationship add <actor-objective> <motivation-goal> --predicate supports
649
+ dr relationship add <actor> <role> --predicate assigned-to
650
+ dr relationship add <role> <permission> --predicate aggregates
651
+ dr relationship add <permission> <resource-operation> --predicate authorizes
652
+ dr relationship add <countermeasure> <threat> --predicate mitigates
634
653
  ```
635
654
 
636
655
  **Cross-Layer Commands:**
637
656
 
638
657
  ```bash
639
- dr relationship add <security-actor> <motivation-stakeholder> --predicate references
640
- dr relationship add <secure-resource> <application-service> --predicate protects
641
- dr relationship add <security-resource-operation> <api-operation> --predicate protects
658
+ dr relationship add <countermeasure> <motivation-requirement> --predicate satisfies
659
+ dr relationship add <security-role> <business-role> --predicate maps-to
660
+ dr relationship add <application-interface> <secure-resource> --predicate exposes
661
+ dr relationship add <api-operation> <permission> --predicate requires
642
662
  ```