@dataparade/cli 0.0.35 → 0.1.1

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 (140) hide show
  1. package/README.md +1 -0
  2. package/dist/package.json +4 -4
  3. package/dist/src/ai-enrichment/pii-signal-rules.d.ts +5 -0
  4. package/dist/src/ai-enrichment/pii-signal-rules.js +2 -3
  5. package/dist/src/ai-enrichment/provider-prompt.js +1 -0
  6. package/dist/src/ai-enrichment/providers/provider-contract.js +2 -44
  7. package/dist/src/ai-enrichment/third-party-data-flow.js +5 -4
  8. package/dist/src/cli.js +9 -3
  9. package/dist/src/discoveries/contract/ocsf-discovery-record.d.ts +4 -1
  10. package/dist/src/discoveries/contract/ocsf-discovery-record.js +1 -1
  11. package/dist/src/discoveries/contract/ontology-pins.d.ts +6 -4
  12. package/dist/src/discoveries/contract/ontology-pins.js +7 -5
  13. package/dist/src/facts/build-facts.d.ts +2 -0
  14. package/dist/src/facts/build-facts.js +18 -0
  15. package/dist/src/facts/layout.d.ts +4 -0
  16. package/dist/src/facts/layout.js +5 -1
  17. package/dist/src/facts/scan-stamps.d.ts +7 -0
  18. package/dist/src/facts/scan-stamps.js +30 -0
  19. package/dist/src/facts/schema.d.ts +178 -0
  20. package/dist/src/facts/schema.js +37 -1
  21. package/dist/src/kb/data-category-catalog.generated.d.ts +34 -0
  22. package/dist/src/kb/data-category-catalog.generated.js +962 -0
  23. package/dist/src/kb/kb-store.js +4 -1
  24. package/dist/src/kb/migrate.js +4 -2
  25. package/dist/src/kb/slot-shapes.d.ts +3 -2
  26. package/dist/src/kb/slot-shapes.js +13 -8
  27. package/dist/src/kb/taxonomy.d.ts +12 -6
  28. package/dist/src/kb/taxonomy.js +13 -18
  29. package/dist/src/output/scan-output-excludes.js +2 -0
  30. package/dist/src/output/write-scan-knowledge.d.ts +5 -1
  31. package/dist/src/output/write-scan-knowledge.js +21 -0
  32. package/dist/src/threat-model/build-threat-model.d.ts +3 -0
  33. package/dist/src/threat-model/build-threat-model.js +71 -0
  34. package/dist/src/threat-model/carry-forward-person-set-statuses.d.ts +8 -0
  35. package/dist/src/threat-model/carry-forward-person-set-statuses.js +87 -0
  36. package/dist/src/threat-model/io.d.ts +19 -0
  37. package/dist/src/threat-model/io.js +63 -0
  38. package/dist/src/threat-model/schema.d.ts +214 -0
  39. package/dist/src/threat-model/schema.js +75 -0
  40. package/dist/src/ui/scan-progress-renderer.d.ts +8 -1
  41. package/dist/src/ui/scan-progress-renderer.js +20 -1
  42. package/dist/src/upload/collect-scan-sidecars.d.ts +2 -1
  43. package/dist/src/upload/collect-scan-sidecars.js +3 -1
  44. package/dist/tests/cli/cli.spec.js +10 -1
  45. package/dist/tests/helpers/facts-fixture.js +16 -16
  46. package/dist/tests/schema/scan-result.schema.spec.js +1 -1
  47. package/dist/tests/unit/ai-enrichment/provider-contract.spec.js +1 -1
  48. package/dist/tests/unit/ai-enrichment/third-party-data-flow.spec.js +5 -5
  49. package/dist/tests/unit/core/graph-mapping.spec.js +4 -3
  50. package/dist/tests/unit/discoveries/write-ocsf-discoveries-long-ids.spec.js +3 -3
  51. package/dist/tests/unit/export/export-ocsf.spec.js +4 -4
  52. package/dist/tests/unit/facts/apply-answers.spec.js +20 -20
  53. package/dist/tests/unit/facts/build-facts.spec.js +143 -45
  54. package/dist/tests/unit/facts/identity.spec.js +13 -0
  55. package/dist/tests/unit/facts/scan-stamps.spec.js +32 -0
  56. package/dist/tests/unit/facts/slug.spec.js +2 -0
  57. package/dist/tests/unit/kb/answer-fingerprint.spec.js +9 -9
  58. package/dist/tests/unit/kb/data-category-catalog.spec.d.ts +1 -0
  59. package/dist/tests/unit/kb/data-category-catalog.spec.js +65 -0
  60. package/dist/tests/unit/kb/kb-interview-loop.spec.js +8 -7
  61. package/dist/tests/unit/kb/migrate.spec.js +2 -2
  62. package/dist/tests/unit/output/scan-output-excludes.spec.js +1 -1
  63. package/dist/tests/unit/threat-model/build-threat-model.spec.d.ts +1 -0
  64. package/dist/tests/unit/threat-model/build-threat-model.spec.js +189 -0
  65. package/dist/tests/unit/threat-model/carry-forward-person-set-statuses.spec.d.ts +1 -0
  66. package/dist/tests/unit/threat-model/carry-forward-person-set-statuses.spec.js +163 -0
  67. package/dist/tests/unit/threat-model/io.spec.d.ts +1 -0
  68. package/dist/tests/unit/threat-model/io.spec.js +103 -0
  69. package/dist/tests/unit/threat-model/schema.spec.d.ts +1 -0
  70. package/dist/tests/unit/threat-model/schema.spec.js +42 -0
  71. package/dist/tests/unit/ui/scan-progress-renderer.spec.js +58 -0
  72. package/dist/tests/unit/upload/collect-scan-sidecars.spec.js +8 -5
  73. package/dist/vendor/scanner/dist/src/analyze/code-navigator.d.ts +1 -1
  74. package/dist/vendor/scanner/dist/src/analyze/code-navigator.js +4 -0
  75. package/dist/vendor/scanner/dist/src/analyze/column-catalog.d.ts +1 -1
  76. package/dist/vendor/scanner/dist/src/analyze/column-catalog.js +2 -2
  77. package/dist/vendor/scanner/dist/src/analyze/concept-profile.d.ts +2 -2
  78. package/dist/vendor/scanner/dist/src/analyze/concept-profile.js +5 -3
  79. package/dist/vendor/scanner/dist/src/core/pipeline/build-scan-personal-data-layers.js +1 -1
  80. package/dist/vendor/scanner/dist/src/core/pipeline/deterministic-scan.js +43 -0
  81. package/dist/vendor/scanner/dist/src/core/pipeline/graph-mapping.js +23 -2
  82. package/dist/vendor/scanner/dist/src/core/pipeline/mixed-app-terraform-scan.js +1 -0
  83. package/dist/vendor/scanner/dist/src/core/pipeline/orchestrator-result.d.ts +2 -2
  84. package/dist/vendor/scanner/dist/src/core/pipeline/terraform-minimal-services.js +1 -0
  85. package/dist/vendor/scanner/dist/src/core/schema/scan-result.schema.d.ts +160 -2
  86. package/dist/vendor/scanner/dist/src/core/schema/scan-result.schema.js +24 -0
  87. package/dist/vendor/scanner/dist/src/core/types/data-flow.d.ts +48 -0
  88. package/dist/vendor/scanner/dist/src/core/types/data-flow.js +53 -0
  89. package/dist/vendor/scanner/dist/src/data-flow/detect.js +1 -0
  90. package/dist/vendor/scanner/dist/src/data-flow/ensure-hub-linked-assets.js +1 -0
  91. package/dist/vendor/scanner/dist/src/data-flow/ensure-manifest-declared-flows.js +1 -0
  92. package/dist/vendor/scanner/dist/src/data-flow/flow-authentication.d.ts +30 -0
  93. package/dist/vendor/scanner/dist/src/data-flow/flow-authentication.js +277 -0
  94. package/dist/vendor/scanner/dist/src/data-flow/flow-builder.js +6 -0
  95. package/dist/vendor/scanner/dist/src/data-flow/flow-controls.d.ts +24 -0
  96. package/dist/vendor/scanner/dist/src/data-flow/flow-controls.js +238 -0
  97. package/dist/vendor/scanner/dist/src/data-flow/flow-data-categories.d.ts +22 -0
  98. package/dist/vendor/scanner/dist/src/data-flow/flow-data-categories.js +69 -0
  99. package/dist/vendor/scanner/dist/src/data-flow/flow-interaction-description.d.ts +13 -0
  100. package/dist/vendor/scanner/dist/src/data-flow/flow-interaction-description.js +263 -0
  101. package/dist/vendor/scanner/dist/src/data-flow/hub-link-policy.d.ts +2 -1
  102. package/dist/vendor/scanner/dist/src/data-flow/hub-link-policy.js +3 -0
  103. package/dist/vendor/scanner/dist/src/data-flow/human-interaction-channels.d.ts +37 -0
  104. package/dist/vendor/scanner/dist/src/data-flow/human-interaction-channels.js +483 -0
  105. package/dist/vendor/scanner/dist/src/data-flow/intra-component-lineage.d.ts +3 -0
  106. package/dist/vendor/scanner/dist/src/data-flow/intra-component-lineage.js +12 -17
  107. package/dist/vendor/scanner/dist/src/data-flow/terraform-flows.js +5 -1
  108. package/dist/vendor/scanner/dist/src/data-flow/transformation-patterns.d.ts +5 -1
  109. package/dist/vendor/scanner/dist/src/data-flow/transformation-patterns.js +17 -37
  110. package/dist/vendor/scanner/dist/src/eval/canonical/concept-map.d.ts +36 -5
  111. package/dist/vendor/scanner/dist/src/eval/canonical/concept-map.js +53 -60
  112. package/dist/vendor/scanner/dist/src/eval/canonical/graph/endpoints.js +2 -9
  113. package/dist/vendor/scanner/dist/src/eval/canonical/scanner/personal-data.js +10 -7
  114. package/dist/vendor/scanner/dist/src/graph/build-dataparade-graph.js +3 -1
  115. package/dist/vendor/scanner/dist/src/index.d.ts +6 -0
  116. package/dist/vendor/scanner/dist/src/index.js +16 -1
  117. package/dist/vendor/scanner/dist/src/patterns/engine.js +1 -0
  118. package/dist/vendor/scanner/dist/src/pii-signals/match-pii-signals.d.ts +1 -1
  119. package/dist/vendor/scanner/dist/src/pii-signals/match-pii-signals.js +2 -2
  120. package/dist/vendor/scanner/dist/src/pii-signals/occurrence-group.d.ts +3 -3
  121. package/dist/vendor/scanner/dist/src/pii-signals/occurrence-group.js +12 -11
  122. package/dist/vendor/scanner/dist/src/pii-signals/personal-data-taxonomy.d.ts +44 -0
  123. package/dist/vendor/scanner/dist/src/pii-signals/personal-data-taxonomy.js +167 -0
  124. package/dist/vendor/scanner/dist/src/pii-signals/pii-signal-aliases.js +43 -43
  125. package/dist/vendor/scanner/dist/src/pii-signals/pii-signal-rules.d.ts +12 -1
  126. package/dist/vendor/scanner/dist/src/pii-signals/pii-signal-rules.js +28 -7
  127. package/dist/vendor/scanner/dist/src/pii-signals/signal-token.js +1 -1
  128. package/dist/vendor/scanner/dist/src/threats/stride.d.ts +98 -0
  129. package/dist/vendor/scanner/dist/src/threats/stride.js +179 -0
  130. package/dist/vendor/scanner/package.json +2 -2
  131. package/dist/vendor/scanner/patterns/concept-profiles.yaml +2 -2
  132. package/dist/vendor/scanner/patterns/flow-authentication.rules.yaml +75 -0
  133. package/dist/vendor/scanner/patterns/flow-controls.rules.yaml +68 -0
  134. package/dist/vendor/scanner/patterns/personal-data-taxonomy.yaml +155 -0
  135. package/dist/vendor/scanner/patterns/pii-signals.rules.yaml +38 -49
  136. package/dist/vendor/scanner/patterns/stride.rules.yaml +86 -0
  137. package/package.json +4 -4
  138. package/dist/vendor/scanner/dist/src/eval/canonical/concept-map.validate.d.ts +0 -17
  139. package/dist/vendor/scanner/dist/src/eval/canonical/concept-map.validate.js +0 -108
  140. package/dist/vendor/scanner/patterns/personal-data-concept-map.yaml +0 -76
@@ -4,6 +4,6 @@
4
4
  "license": "Apache-2.0",
5
5
  "description": "Vendored build of @dataparade/scanner bundled into @dataparade/cli",
6
6
  "main": "dist/src/index.js",
7
- "gitHead": "08acc5536bf5b2b0532ee4f4e306798c4774138b",
8
- "catalogHash": "sha256:6e2a57b52ac0116f"
7
+ "gitHead": "798ba353eff174ae0210df166c55ea6aef351b97",
8
+ "catalogHash": "sha256:e719c413f7c8a6d8"
9
9
  }
@@ -42,14 +42,14 @@ negative_words:
42
42
  - flag
43
43
 
44
44
  concept_profiles:
45
- - id: email
45
+ - id: pd:EmailAddress
46
46
  type_hints: [email, emailfield]
47
47
  role_words: [from, sender, support, noreply]
48
48
  role_runs: [replyto, mailfrom, defaultfrom, noreply]
49
49
  tail_words: [from, to, reply, address, addresses, sender, recipient, recipients, cc, bcc]
50
50
  role_words_suffice: true
51
51
 
52
- - id: phone_number
52
+ - id: pd:TelephoneNumber
53
53
  type_hints: [phonenumberfield, possiblephonenumberfield, phonenumber, phone, telephone]
54
54
  role_words: [sender, from, support, contact, sms, twilio]
55
55
  tail_words: [number, no, num, from, to, sender, support, contact, sms]
@@ -0,0 +1,75 @@
1
+ # Authentication evidence on data flows (DATAP-912).
2
+ #
3
+ # For each evidence location of a flow, the scanner reads the code around the request:
4
+ # the enclosing function up to a few lines after the call, plus any helper function or
5
+ # constant that the call passes as `headers=`, `auth=` or similar. It then applies these
6
+ # patterns. A match records the kind and the line. No match gives "none_seen", which
7
+ # means no evidence was found, not that the flow has no authentication.
8
+ #
9
+ # Flows of the types in `skip_flow_types` are not checked (database credentials are in
10
+ # connection settings, which this rule set does not read yet).
11
+ #
12
+ # The scan stamps hash this file (catalogHash).
13
+ version: 1
14
+
15
+ window:
16
+ # Lines before the evidence line to search for the start of the enclosing function.
17
+ max_lines_before: 40
18
+ # Lines after the evidence line that still belong to the request call. The window
19
+ # never runs past the end of the enclosing function.
20
+ lines_after: 8
21
+ # Lines to read from a referenced helper function or constant.
22
+ helper_lines: 25
23
+
24
+ skip_flow_types: [database_query]
25
+
26
+ # Arguments that pass credentials or headers to a request. The value, when it is a name
27
+ # or a call of a name defined in the same file, is followed to its definition.
28
+ credential_arguments: [headers, auth, credentials, session, client_kwargs]
29
+
30
+ kinds:
31
+ - id: bearer
32
+ patterns:
33
+ - "Authorization[\"']?\\s*[:=,]\\s*f?[\"'`]Bearer\\b"
34
+ - "[\"'`]Bearer [\"'`$\\{]"
35
+ - "\\bBearer \\{"
36
+ - "\\bBearer \\$\\{"
37
+ - id: basic
38
+ patterns:
39
+ - "Authorization[\"']?\\s*[:=,]\\s*f?[\"'`]Basic\\b"
40
+ - "\\b(HTTPBasicAuth|BasicAuth)\\s*\\("
41
+ - "\\bauth\\s*=\\s*\\("
42
+ - id: api_key
43
+ patterns:
44
+ - "Authorization[\"']?\\s*[:=,]\\s*f?[\"'`](Bot|Token|token|Key|ApiKey)\\b"
45
+ - "[\"'`][Xx]-[A-Za-z0-9-]*(Api-Key|API-Key|api-key|Access-Token|Auth-Token|Token|Key)[\"'`]"
46
+ - "[\"'`](api[-_]?key|apikey|x-api-key)[\"'`]\\s*:"
47
+ - "\\bapi_?[Kk]ey\\s*[=:]"
48
+ - "[?&](api_key|apikey|key|access_token|token)="
49
+ # Token in the URL path (Telegram Bot API).
50
+ - "/bot\\{|/bot\\$\\{"
51
+ # SDK client or helper given a token from configuration or a constant.
52
+ - "\\b(token|bot_token|app_token|access_token|auth_token)\\s*=\\s*(config|settings|os\\.environ|os\\.getenv|process\\.env|self\\.|[A-Z][A-Z0-9_]{2,}\\b)"
53
+ - "\\b\\w+_api_key\\b"
54
+ # Error-tracking DSNs carry the project key (Sentry).
55
+ - "\\bdsn\\s*[:=]"
56
+ - id: oauth
57
+ patterns:
58
+ - "\\bgoogle\\.oauth2\\b"
59
+ - "\\bservice_account\\.Credentials\\b"
60
+ - "\\bgoogle_auth_oauthlib\\b"
61
+ - "\\bOAuth2Session\\b"
62
+ - "/oauth2?/(access_)?token"
63
+ - "[\"']grant_type[\"']"
64
+ - "\\bclient_credentials\\b"
65
+ - id: signed_request
66
+ patterns:
67
+ - "\\b(SigV4Auth|AWS4Auth|aws4)\\b"
68
+ - "\\bsignRequest\\s*\\("
69
+ - id: webhook_signature
70
+ patterns:
71
+ - "\\bhmac\\.compare_digest\\s*\\("
72
+ - "\\btimingSafeEqual\\s*\\("
73
+ - "[\"'`][Xx]-(Hub-Signature(-256)?|Shopify-Hmac-Sha256|Slack-Signature|Signature|Twilio-Signature)[\"'`]"
74
+ - "\\bWebhook\\.construct_event\\s*\\("
75
+ - "\\bverify_?[Ss]ignature\\s*\\("
@@ -0,0 +1,68 @@
1
+ # Control evidence on data flows (DATAP-915).
2
+ #
3
+ # Each control is a code signal near a request. effect "mitigates" means the signal is a
4
+ # control (TLS, a timeout). effect "weakens" means the signal removes a control (plain
5
+ # HTTP, certificate checks turned off). patterns/stride.rules.yaml maps controls to
6
+ # threat statuses.
7
+ #
8
+ # The scan reads the same window as flow-authentication.rules.yaml: the enclosing
9
+ # function, a few lines after the call, and top-level URL constants the window names.
10
+ # When a flow cites an SDK import, the scan reads the whole file but keeps only the
11
+ # controls marked sdk: true (a client constructor takes them).
12
+ #
13
+ # No match gives no evidence. It never means the control is missing.
14
+ version: 1
15
+
16
+ skip_flow_types: [database_query]
17
+
18
+ # Top-level constants that hold a URL, such as CRISP_API_BASE or GITHUB_API_URL.
19
+ url_constant: '\b([A-Z][A-Z0-9_]*(?:URL|URI|BASE|API|ENDPOINT|HOST)[A-Z0-9_]*)\b'
20
+
21
+ # Lines that are comments are not read. Python docstrings are not read either.
22
+ comment_line: '^\s*(?:#|//|\*|/\*)'
23
+
24
+ controls:
25
+ - id: tls
26
+ effect: mitigates
27
+ patterns:
28
+ # Documentation links are not requests.
29
+ - 'https://(?!docs\.|developers?\.|help\.|support\.|github\.com/[\w.-]+/[\w.-]+/(?:blob|tree)/)'
30
+ - 'wss://'
31
+
32
+ - id: plaintext_http
33
+ effect: weakens
34
+ patterns:
35
+ # http:// to a remote host. Local and documentation hosts are not counted.
36
+ - 'http://(?!localhost\b|127\.0\.0\.1|0\.0\.0\.0|\[::1\]|host\.docker\.internal|[\w.-]*\.local\b|[\w.-]*\.internal\b|[\w.-]*\.svc\b|example\.(?:com|org)|www\.w3\.org|schemas\.|json-schema\.org|\{|\$\{)[\w.-]+'
37
+ - 'ws://(?!localhost\b|127\.0\.0\.1|0\.0\.0\.0)[\w.-]+'
38
+
39
+ - id: tls_verify_disabled
40
+ effect: weakens
41
+ sdk: true
42
+ patterns:
43
+ - '\bverify\s*=\s*False\b'
44
+ - '\bssl\s*=\s*False\b'
45
+ - 'rejectUnauthorized\s*:\s*false'
46
+ - 'InsecureSkipVerify\s*:\s*true'
47
+ - '\bCERT_NONE\b'
48
+ - 'NODE_TLS_REJECT_UNAUTHORIZED'
49
+
50
+ - id: timeout
51
+ effect: mitigates
52
+ sdk: true
53
+ patterns:
54
+ - '\btimeout\s*[=:]\s*(?:[1-9]|0\.\d|httpx\.Timeout|aiohttp\.ClientTimeout|ClientTimeout|[A-Z][A-Z0-9_]*TIMEOUT)'
55
+ - 'AbortSignal\.timeout\('
56
+ - 'context\.WithTimeout\('
57
+ - '\bTimeout:\s*\d'
58
+ - '\.timeout\(\s*\d'
59
+ # Ruby Net::HTTP, Faraday and HTTParty.
60
+ - '\b(?:open|read|write)_timeout\s*[=:]\s*\d'
61
+
62
+ - id: timeout_disabled
63
+ effect: weakens
64
+ sdk: true
65
+ patterns:
66
+ - '\btimeout\s*=\s*None\b'
67
+ # axios, node-fetch and others read 0 as "no timeout".
68
+ - '\btimeout\s*[=:]\s*0\s*(?:[,)}]|$)'
@@ -0,0 +1,155 @@
1
+ # Personal-data taxonomy (DATAP-947), built on the W3C Data Privacy Vocabulary (DPV 2.3).
2
+ #
3
+ # Every personal-data type the scanner names is a concept here, written as a compact IRI
4
+ # (CURIE): the prefix names the namespace below. DPV's personal-data extension (`pd:`)
5
+ # gives the top of the hierarchy; our more specific types (`dpx:`) sit beneath a DPV
6
+ # concept. `broader` is the direct parent; `dpv:PersonalData` is the root and is not
7
+ # listed. Ancestry, IRIs and validation come from this file only (see
8
+ # src/pii-signals/personal-data-taxonomy.ts and docs/dpv-taxonomy.md).
9
+ #
10
+ # Rules:
11
+ # - `pd:` concepts use DPV's own term name and parent. Add one only if DPV defines it.
12
+ # - `dpx:` concepts are ours. Each has a `broader` concept and a `definition`, and its
13
+ # local name never repeats a DPV term.
14
+ # - Detector rules (pii-signals.rules.yaml) and data-flow categories name concepts from
15
+ # this file; a name that is not here fails validation.
16
+ version: "2.0.0"
17
+ dpv_version: "2.3"
18
+ namespaces:
19
+ dpv: "https://w3id.org/dpv#"
20
+ pd: "https://w3id.org/dpv/pd#"
21
+ dpx: "https://dataparade.io/ns/dpx#"
22
+ concepts:
23
+ # External: characteristics that can be observed.
24
+ - id: pd:External
25
+ broader: dpv:PersonalData
26
+ - id: pd:Identifying
27
+ broader: pd:External
28
+ - id: pd:Name
29
+ broader: pd:Identifying
30
+ - id: dpx:FirstName
31
+ broader: pd:Name
32
+ definition: Given name or forename.
33
+ - id: dpx:LastName
34
+ broader: pd:Name
35
+ definition: Family name or surname.
36
+ - id: dpx:FullName
37
+ broader: pd:Name
38
+ definition: Whole name as one value, such as a display or legal name.
39
+ - id: pd:Username
40
+ broader: pd:Identifying
41
+ - id: pd:UID
42
+ broader: pd:Identifying
43
+ - id: pd:OfficialID
44
+ broader: pd:Identifying
45
+ - id: pd:Passport
46
+ broader: pd:OfficialID
47
+ - id: dpx:SocialSecurityNumber
48
+ broader: pd:OfficialID
49
+ definition: Social security or national insurance number.
50
+ - id: dpx:NationalIdentityNumber
51
+ broader: pd:OfficialID
52
+ definition: Number of a national identity card or other government-issued identifier.
53
+ - id: dpx:DriversLicenseNumber
54
+ broader: pd:OfficialID
55
+ definition: Number of a driving licence.
56
+ - id: dpx:TaxIdentificationNumber
57
+ broader: pd:OfficialID
58
+ definition: Tax or VAT identification number.
59
+ - id: pd:PhysicalCharacteristic
60
+ broader: pd:External
61
+ - id: pd:Age
62
+ broader: pd:PhysicalCharacteristic
63
+ - id: pd:BirthDate
64
+ broader: pd:Age
65
+ - id: pd:MedicalHealth
66
+ broader: pd:External
67
+
68
+ # Tracking: information used to track or contact an individual.
69
+ - id: pd:Tracking
70
+ broader: dpv:PersonalData
71
+ - id: pd:Contact
72
+ broader: pd:Tracking
73
+ - id: pd:EmailAddress
74
+ broader: pd:Contact
75
+ - id: pd:TelephoneNumber
76
+ broader: pd:Contact
77
+ - id: pd:Location
78
+ broader: pd:Tracking
79
+ - id: pd:PhysicalAddress
80
+ broader: pd:Location
81
+ - id: pd:Street
82
+ broader: pd:PhysicalAddress
83
+ - id: pd:PostalCode
84
+ broader: pd:PhysicalAddress
85
+ - id: pd:City
86
+ broader: pd:PhysicalAddress
87
+ - id: pd:Region
88
+ broader: pd:PhysicalAddress
89
+ - id: pd:Residency
90
+ broader: pd:Location
91
+ - id: pd:DeviceBased
92
+ broader: pd:Tracking
93
+ - id: pd:IPAddress
94
+ broader: pd:DeviceBased
95
+
96
+ # Internal: characteristics that cannot be observed, including authentication.
97
+ - id: pd:Internal
98
+ broader: dpv:PersonalData
99
+ - id: pd:Authenticating
100
+ broader: pd:Internal
101
+ - id: pd:Password
102
+ broader: pd:Authenticating
103
+ - id: dpx:PasswordVerifier
104
+ broader: pd:Authenticating
105
+ definition: Value derived from a password to check it, such as a hash, salt or verifier.
106
+ - id: pd:SecretText
107
+ broader: pd:Authenticating
108
+ - id: dpx:ClientSecret
109
+ broader: pd:SecretText
110
+ definition: Secret an application uses to authenticate itself, such as an OAuth client secret.
111
+ - id: dpx:AccessToken
112
+ broader: pd:Authenticating
113
+ definition: Bearer, API or refresh token that grants access on an individual's behalf.
114
+ - id: dpx:SessionToken
115
+ broader: pd:Authenticating
116
+ definition: Session identifier or session cookie that keeps an individual signed in.
117
+
118
+ # Financial.
119
+ - id: pd:Financial
120
+ broader: dpv:PersonalData
121
+ - id: pd:FinancialAccount
122
+ broader: pd:Financial
123
+ - id: pd:AccountIdentifier
124
+ broader: pd:FinancialAccount
125
+ - id: pd:FinancialAccountNumber
126
+ broader: pd:AccountIdentifier
127
+ - id: pd:BankAccount
128
+ broader: pd:FinancialAccount
129
+ - id: pd:PaymentCard
130
+ broader: pd:FinancialAccount
131
+ - id: pd:PaymentCardNumber
132
+ broader: pd:PaymentCard
133
+ - id: pd:PaymentCardExpiry
134
+ broader: pd:PaymentCard
135
+ - id: dpx:CardholderName
136
+ broader: pd:PaymentCard
137
+ definition: Name printed on a payment card.
138
+ - id: pd:Transactional
139
+ broader: pd:Financial
140
+ - id: pd:Transaction
141
+ broader: pd:Transactional
142
+ - id: pd:Purchase
143
+ broader: pd:Transactional
144
+
145
+ # Social.
146
+ - id: pd:Social
147
+ broader: dpv:PersonalData
148
+ - id: pd:Communication
149
+ broader: pd:Social
150
+ - id: pd:SocialMediaCommunication
151
+ broader: pd:Communication
152
+ - id: pd:Professional
153
+ broader: pd:Social
154
+ - id: pd:Salary
155
+ broader: pd:Professional
@@ -1,118 +1,107 @@
1
1
  # PII signal rules consumed by `src/ai-enrichment/pii-signal-rules.ts`.
2
2
  # Rule schema:
3
- # - id: unique rule identifier
4
- # - category: one of [identifiers, profile_data, credentials]
5
- # - labels: canonical output labels emitted in thirdPartyDataFlow.dataShared
3
+ # - id: the personal-data type the rule detects, a concept CURIE from
4
+ # personal-data-taxonomy.yaml (DPV-based, DATAP-947). It is the data item id, the
5
+ # occurrence label and the label in thirdPartyDataFlow.dataShared. One rule per type.
6
+ # - category: report bucket for thirdPartyDataFlow.dataShared, one of
7
+ # [identifiers, profile_data, credentials]; not a data type
8
+ # - name_words: the words a source identifier uses for the type, in order (`email`;
9
+ # `phone`, `number`). Grouping and column matching find compound names by them
10
+ # (`customer_email`, `billingPhoneNumber`).
6
11
  # - patterns: regex strings (compiled case-insensitive)
7
12
  # Matching notes:
8
13
  # - Rules are evaluated per source line.
9
14
  # - A match still requires operation-context gating in the data-flow pass.
10
- # - Prefer snake_case labels for consistency.
11
15
  pii_signal_rules:
12
- - id: first_name
16
+ - id: dpx:FirstName
13
17
  category: profile_data
14
- labels:
15
- - first_name
18
+ name_words: [first, name]
16
19
  patterns:
17
20
  - "\\b(first[_-]?name|firstname|given[_-]?name|forename|f[_-]?name|fname)\\b"
18
21
 
19
- - id: last_name
22
+ - id: dpx:LastName
20
23
  category: profile_data
21
- labels:
22
- - last_name
24
+ name_words: [last, name]
23
25
  patterns:
24
26
  - "\\b(last[_-]?name|lastname|family[_-]?name|surname|l[_-]?name|lname)\\b"
25
27
 
26
- - id: full_name
28
+ - id: dpx:FullName
27
29
  category: profile_data
28
- labels:
29
- - full_name
30
+ name_words: [full, name]
30
31
  patterns:
31
32
  - "\\b(full[_-]?name|fullname|display[_-]?name|legal[_-]?name|person[_-]?name)\\b"
32
33
 
33
- - id: date_of_birth
34
+ - id: pd:BirthDate
34
35
  category: profile_data
35
- labels:
36
- - date_of_birth
36
+ name_words: [date, of, birth]
37
37
  patterns:
38
38
  - "\\b(date[_-]?of[_-]?birth|dob|d\\.o\\.b|birth[_-]?date|birthdate|bday)\\b"
39
39
 
40
- - id: phone_number
40
+ - id: pd:TelephoneNumber
41
41
  category: profile_data
42
- labels:
43
- - phone_number
42
+ name_words: [phone, number]
44
43
  patterns:
45
44
  - "\\b(phone|phone[_-]?number|telephone|tel|mobile|mobile[_-]?number|cell|msisdn)\\b"
46
45
 
47
- - id: address
46
+ - id: pd:PhysicalAddress
48
47
  category: profile_data
49
- labels:
50
- - address
48
+ name_words: [address]
51
49
  patterns:
52
50
  - "\\b(street[_-]?address|mailing[_-]?address|home[_-]?address|billing[_-]?address|shipping[_-]?address|postal[_-]?address|zip[_-]?code|postal[_-]?code|postcode)\\b"
53
51
 
54
- - id: ssn
52
+ - id: dpx:SocialSecurityNumber
55
53
  category: identifiers
56
- labels:
57
- - social_security_number
54
+ name_words: [ssn]
58
55
  patterns:
59
56
  - "\\b(ssn|social[_-]?security[_-]?number|socialsecuritynumber|nin|national[_-]?insurance[_-]?number)\\b"
60
57
 
61
- - id: passport
58
+ - id: pd:Passport
62
59
  category: identifiers
63
- labels:
64
- - passport_number
60
+ name_words: [passport]
65
61
  patterns:
66
62
  - "\\b(passport[_-]?number|passport[_-]?no|pp[_-]?number|travel[_-]?document[_-]?number)\\b"
67
63
 
68
- - id: national_id
64
+ - id: dpx:NationalIdentityNumber
69
65
  category: identifiers
70
- labels:
71
- - national_id
66
+ name_words: [national, id]
72
67
  patterns:
73
68
  - "\\b(national[_-]?id|national[_-]?identifier|nid|id[_-]?number|government[_-]?id|gov[_-]?id)\\b"
74
69
 
75
- - id: drivers_license
70
+ - id: dpx:DriversLicenseNumber
76
71
  category: identifiers
77
- labels:
78
- - drivers_license_number
72
+ name_words: [drivers, license]
79
73
  patterns:
80
74
  - "\\b(driver['’]?s?[_-]?license|driverslicense|driving[_-]?license|driver[_-]?licence|dl[_-]?number|license[_-]?number|licence[_-]?number)\\b"
81
75
 
82
- - id: tax_id
76
+ - id: dpx:TaxIdentificationNumber
83
77
  category: identifiers
84
- labels:
85
- - tax_identifier
78
+ name_words: [tax, id]
86
79
  patterns:
87
80
  - "\\b(tax[_-]?id|taxid|tin|ein|vat[_-]?number|fiscal[_-]?code)\\b"
88
81
 
89
- - id: account_number
82
+ - id: pd:FinancialAccountNumber
90
83
  category: identifiers
91
- labels:
92
- - account_number
84
+ name_words: [account, number]
93
85
  patterns:
94
86
  - "\\b(account[_-]?number|acct[_-]?number|iban|routing[_-]?number|sort[_-]?code|swift|bic)\\b"
95
87
 
96
- - id: username
88
+ - id: pd:Username
97
89
  category: credentials
98
- labels:
99
- - username
90
+ name_words: [username]
100
91
  patterns:
101
92
  - "\\b(username|user[_-]?name|login|login[_-]?id|userid|user[_-]?id)\\b"
102
93
 
103
- - id: email
94
+ - id: pd:EmailAddress
104
95
  category: credentials
105
- labels:
106
- - user_email
96
+ name_words: [email]
107
97
  patterns:
108
98
  - "\\b(email|email[_-]?address)\\b"
109
99
  # A bare `mail` is an address unless it is used as a constant, a call, or an object
110
100
  # whose member is not an address list (`Mail::Field`, `mail.subject`, `mail(`).
111
101
  - "\\bmail\\b(?!\\s*(?:::|\\(|\\.(?!(?:to|from|cc|bcc|reply_to|sender|recipients)\\b)))"
112
102
 
113
- - id: password
103
+ - id: pd:Password
114
104
  category: credentials
115
- labels:
116
- - user_password
105
+ name_words: [password]
117
106
  patterns:
118
107
  - "\\b(password|passwd|pass|pwd|passphrase|secret)\\b"
@@ -0,0 +1,86 @@
1
+ # STRIDE per element (DATAP-914).
2
+ #
3
+ # Which STRIDE threat categories apply to each kind of diagram element. This table only
4
+ # says which categories apply; it never says a threat is present. Every category starts
5
+ # with status "unknown". The status rules below (DATAP-915) set "mitigated" or "open"
6
+ # from control evidence.
7
+ #
8
+ # Categories: S spoofing, T tampering, R repudiation, I information disclosure,
9
+ # D denial of service, E elevation of privilege.
10
+ #
11
+ # Rule ids carry the version (stride/v<version>/...). Bump it whenever a change here
12
+ # changes which threats or statuses a scan reports, so results from different tables
13
+ # are never compared as if they were the same.
14
+ version: 3
15
+ framework: stride
16
+
17
+ categories:
18
+ - id: S
19
+ name: Spoofing
20
+ - id: T
21
+ name: Tampering
22
+ - id: R
23
+ name: Repudiation
24
+ - id: I
25
+ name: Information disclosure
26
+ - id: D
27
+ name: Denial of service
28
+ - id: E
29
+ name: Elevation of privilege
30
+
31
+ # Element kinds and the categories that apply to each.
32
+ elements:
33
+ external_entity:
34
+ categories: [S, R]
35
+ process:
36
+ categories: [S, T, R, I, D, E]
37
+ data_store:
38
+ categories: [T, R, I, D]
39
+ data_flow:
40
+ categories: [T, I, D]
41
+
42
+ # Flow relationships that describe structure rather than data crossing between elements.
43
+ # A flow with one of these relationships is not a data_flow element: it gets no threats,
44
+ # and it is not read when deciding the status of the components at its ends.
45
+ structural_flow_relationships: [uses_in_process, exposes, depends_on, provisions]
46
+
47
+ # How a component maps to an element kind. Data flows are always data_flow.
48
+ # The first matching rule wins.
49
+ component_kinds:
50
+ - when: { type: actor }
51
+ kind: external_entity
52
+ - when: { type: third_party }
53
+ kind: external_entity
54
+ - when: { type: asset, subType: [database, cache, storage, config] }
55
+ kind: data_store
56
+ - when: { type: asset }
57
+ kind: process
58
+
59
+ # Status rules (DATAP-915). For each element kind and category:
60
+ # opened_by: a control with effect "weakens" (patterns/flow-controls.rules.yaml) sets "open".
61
+ # mitigated_by: a control with effect "mitigates", or an authentication kind written
62
+ # "auth:<kind>" (patterns/flow-authentication.rules.yaml), sets "mitigated".
63
+ # "open" wins over "mitigated". With no matching evidence the status stays "unknown":
64
+ # no evidence never sets "open".
65
+ #
66
+ # A data flow reads its own evidence. An external entity reads the flows to and from it:
67
+ # "open" when one flow has a weakening control; "mitigated" only when every checked flow
68
+ # has a mitigating control.
69
+ #
70
+ # Not covered yet, so these stay "unknown": route authorization, rate limits, audit logs,
71
+ # data-store encryption, and every process and data-store category.
72
+ status_rules:
73
+ data_flow:
74
+ T:
75
+ mitigated_by: [tls, "auth:signed_request", "auth:webhook_signature"]
76
+ opened_by: [plaintext_http, tls_verify_disabled]
77
+ I:
78
+ mitigated_by: [tls]
79
+ opened_by: [plaintext_http, tls_verify_disabled]
80
+ D:
81
+ mitigated_by: [timeout]
82
+ opened_by: [timeout_disabled]
83
+ external_entity:
84
+ S:
85
+ mitigated_by: [tls, "auth:signed_request", "auth:webhook_signature"]
86
+ opened_by: [plaintext_http, tls_verify_disabled]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataparade/cli",
3
- "version": "0.0.35",
3
+ "version": "0.1.1",
4
4
  "description": "dataPARADE CLI — scan codebases for privacy and security data flows",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -55,7 +55,7 @@
55
55
  "eval:models": "pnpm exec node dist/src/evals/run-model-matrix.js"
56
56
  },
57
57
  "dependencies": {
58
- "@clack/prompts": "^1.8.1",
58
+ "@clack/prompts": "^1.9.0",
59
59
  "@sentry/node": "^10.75.2",
60
60
  "commander": "^14.0.3",
61
61
  "dotenv": "^16.4.7",
@@ -67,14 +67,14 @@
67
67
  "zod": "^4.3.5"
68
68
  },
69
69
  "devDependencies": {
70
- "@dataparade/scanner": "github:DataParade-io/scanner#08acc5536bf5b2b0532ee4f4e306798c4774138b",
70
+ "@dataparade/scanner": "github:DataParade-io/scanner#798ba353eff174ae0210df166c55ea6aef351b97",
71
71
  "@eslint/js": "^9.18.0",
72
72
  "@types/jest": "^30.0.0",
73
73
  "@types/node": "^22.0.0",
74
74
  "eslint": "^9.18.0",
75
75
  "globals": "^15.14.0",
76
76
  "jest": "^30.5.2",
77
- "ts-jest": "^29.4.6",
77
+ "ts-jest": "^29.4.15",
78
78
  "typescript-eslint": "^8.20.0"
79
79
  },
80
80
  "files": [
@@ -1,17 +0,0 @@
1
- /** Gold taxonomy parent keys — never valid as concept_leaf (KDATAP-326fdd). */
2
- export declare const FORBIDDEN_CATEGORY_LEAVES: readonly string[];
3
- export interface PersonalDataConceptMapEntry {
4
- ruleId: string;
5
- conceptLeaf: string;
6
- conceptAncestry: readonly string[];
7
- }
8
- export interface PersonalDataConceptMap {
9
- version: string;
10
- entries: readonly PersonalDataConceptMapEntry[];
11
- }
12
- export declare function normalizeConceptToken(token: string): string;
13
- /**
14
- * Validate a parsed YAML document against the closed PII rule-id inventory.
15
- * Throws on any group-shaped, duplicate-leaf, category-as-leaf, or coverage mismatch.
16
- */
17
- export declare function validatePersonalDataConceptMapDocument(parsed: unknown, expectedRuleIds: readonly string[]): PersonalDataConceptMap;