attribution-suite 0.6.0__tar.gz

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.
@@ -0,0 +1,23 @@
1
+ name: CI
2
+ on:
3
+ push: { branches: [main] }
4
+ pull_request: { branches: [main] }
5
+
6
+ jobs:
7
+ test:
8
+ runs-on: ubuntu-latest
9
+ strategy:
10
+ matrix:
11
+ python-version: ["3.11", "3.12", "3.13"]
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: actions/setup-python@v5
15
+ with: { python-version: "${{ matrix.python-version }}" }
16
+ - run: pip install -e ".[dev]"
17
+ - run: ruff check .
18
+ - run: pytest -q
19
+ - name: Run examples
20
+ run: |
21
+ for f in examples/*.py; do
22
+ [ -f "$f" ] && python "$f" > /dev/null || true
23
+ done
@@ -0,0 +1,58 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ permissions:
8
+ contents: write
9
+ id-token: write # OIDC token for keyless Sigstore signing
10
+
11
+ jobs:
12
+ release:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ with: { fetch-depth: 0 }
17
+
18
+ - uses: actions/setup-python@v5
19
+ with: { python-version: "3.12" }
20
+
21
+ - name: Build
22
+ run: |
23
+ pip install build
24
+ python -m build
25
+
26
+ # CycloneDX SBOM. For a security tool aimed at security teams, shipping
27
+ # without one is an easy thing to be criticised for.
28
+ - name: Generate SBOM
29
+ run: |
30
+ pip install cyclonedx-bom
31
+ cyclonedx-py environment -o sbom.cyclonedx.json --output-format json
32
+
33
+ # Keyless signing via OIDC: no long-lived key to leak or rotate. The
34
+ # signing identity is the GitHub workflow itself, recorded in the public
35
+ # Rekor transparency log and verifiable by anyone.
36
+ - name: Sign artifacts
37
+ uses: sigstore/gh-action-sigstore-python@v3.0.0
38
+ with:
39
+ inputs: ./dist/*.tar.gz ./dist/*.whl ./sbom.cyclonedx.json
40
+
41
+ - name: Checksums
42
+ run: |
43
+ cd dist && sha256sum * > SHA256SUMS && cd ..
44
+ sha256sum sbom.cyclonedx.json >> dist/SHA256SUMS
45
+
46
+ - name: Publish release
47
+ uses: softprops/action-gh-release@v2
48
+ with:
49
+ files: |
50
+ dist/*
51
+ sbom.cyclonedx.json
52
+ *.sigstore.json
53
+ generate_release_notes: true
54
+
55
+ - name: Publish to PyPI
56
+ uses: pypa/gh-action-pypi-publish@release/v1
57
+ with:
58
+ skip-existing: true
@@ -0,0 +1,15 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ venv/
5
+ dist/
6
+ build/
7
+ *.egg-info/
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ .mypy_cache/
11
+ .eae-cache/
12
+ out/
13
+ audit.jsonl
14
+ case.yaml
15
+ .DS_Store
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ ## [0.2.0] - 2026-08-18
4
+
5
+ Initial release of the unification package.
6
+
7
+ ### Added
8
+ - `attribution run` — full chain from one case file: import, collect, score,
9
+ resolve, verify, report
10
+ - Passthrough commands for `index`, `portfolio`, `handles`, `registries`
11
+ - `attribution verify` and `attribution version`
12
+ - Non-zero exit when evidence verification fails, so scripted callers can detect
13
+ an unpresentable result
@@ -0,0 +1,45 @@
1
+ cff-version: 1.2.0
2
+ title: "attribution-suite: unified CLI over the attribution toolchain"
3
+ message: "If you use this software or the method it implements, please cite it."
4
+ type: software
5
+ cff-version: 1.2.0
6
+ title: "adtx-attribution: ad-tech supply-chain collectors for entity attribution"
7
+ message: "If you use this software or the method it implements, please cite it."
8
+ type: software
9
+ authors:
10
+ - family-names: Karumudi
11
+ given-names: Tushar
12
+ orcid: "https://orcid.org/0009-0005-0870-914X"
13
+ repository-code: "https://github.com/OWNER/adtx-attribution"
14
+ abstract: >-
15
+ Collectors and a reverse ads.txt/sellers.json index for attributing websites
16
+ to the legal entities paid for their advertising inventory. Chains IAB ads.txt
17
+ v1.1 and sellers.json declarations to statutory corporate registries (GLEIF,
18
+ SEC EDGAR, UK Companies House) and to infrastructure sources (RDAP,
19
+ Certificate Transparency, passive DNS), using only free and keyless endpoints.
20
+ The reverse index doubles as the selectivity corpus required to calibrate
21
+ attribution-graph confidence scores.
22
+ keywords:
23
+ - ads.txt
24
+ - sellers.json
25
+ - ad fraud
26
+ - open source intelligence
27
+ - attribution
28
+ - corporate registries
29
+ license: Apache-2.0
30
+ version: 0.1.0
31
+ repository-code: "https://github.com/OWNER/attribution-suite"
32
+ abstract: >-
33
+ Meta-package providing a single install and a single command-line interface
34
+ over attribution-graph, adtx-attribution and handle-correlation. Runs the full
35
+ chain from one case file: import from SpiderFoot and OpenCTI, collect from
36
+ registries and ad-tech supply-chain sources, apply planted-identifier checks,
37
+ score and resolve, verify the evidence package, and report.
38
+ keywords:
39
+ - open source intelligence
40
+ - entity resolution
41
+ - record linkage
42
+ - attribution
43
+ - threat intelligence
44
+ license: Apache-2.0
45
+ version: 0.1.0
@@ -0,0 +1,17 @@
1
+ # Code of Conduct
2
+
3
+ This project follows the [Contributor Covenant v2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
4
+
5
+ In short: be respectful, assume good faith, and focus criticism on code and
6
+ methods rather than people.
7
+
8
+ ## Additional expectation specific to this project
9
+
10
+ This is attribution tooling. Do not use issues, discussions or pull requests to
11
+ share attribution findings about identifiable private individuals, to request
12
+ help attributing a specific person, or to post identifiers belonging to real
13
+ people who are not parties to the discussion. Use synthetic or clearly fictional
14
+ identifiers in bug reports and examples.
15
+
16
+ Report conduct concerns through GitHub's private reporting or by contacting the
17
+ maintainer directly.
@@ -0,0 +1,22 @@
1
+ # Contributing
2
+
3
+ This package is thin by design: it wires the three component packages together
4
+ and adds a CLI. It should stay that way.
5
+
6
+ **Logic belongs in the component packages.** A PR adding scoring, collectors or
7
+ signal analysis here will be redirected to `attribution-graph`,
8
+ `adtx-attribution` or `handle-correlation` respectively. What belongs here is
9
+ orchestration, argument plumbing, and anything that genuinely needs all three at
10
+ once.
11
+
12
+ The one substantive rule to preserve: **run ordering**. Imported claims seed the
13
+ frontier before collection, adversarial checks run before scoring, and evidence
14
+ verification runs before reporting. Each of those orderings prevents a specific
15
+ failure — an unchecked planted identifier reaching the model at full weight, or
16
+ findings being presented from a package whose integrity check failed. Changing
17
+ the order needs an argument, not just passing tests.
18
+
19
+ ```bash
20
+ pip install -e ".[dev]"
21
+ pytest -q && ruff check .
22
+ ```
@@ -0,0 +1,204 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
203
+
204
+ Copyright 2026 Tushar Karumudi
@@ -0,0 +1,127 @@
1
+ Metadata-Version: 2.5
2
+ Name: attribution-suite
3
+ Version: 0.6.0
4
+ Summary: One install and one CLI over the attribution-graph toolchain
5
+ Project-URL: Homepage, https://github.com/OWNER/attribution-suite
6
+ Author: Tushar Karumudi
7
+ License-Expression: Apache-2.0
8
+ License-File: LICENSE
9
+ Keywords: attribution,entity-resolution,osint,threat-intelligence
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Information Technology
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Security
16
+ Requires-Python: >=3.11
17
+ Requires-Dist: adtx-attribution>=0.6.0
18
+ Requires-Dist: attribution-graph>=0.6.0
19
+ Requires-Dist: handle-correlation>=0.6.0
20
+ Provides-Extra: dev
21
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
22
+ Requires-Dist: pytest>=8.0; extra == 'dev'
23
+ Requires-Dist: ruff>=0.6; extra == 'dev'
24
+ Description-Content-Type: text/markdown
25
+
26
+ # attribution-suite
27
+
28
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
29
+
30
+ One install and one CLI over the attribution toolchain.
31
+
32
+ ```bash
33
+ pip install attribution-suite
34
+ attribution run --case case.yaml --index adtx.sqlite --out ./out
35
+ ```
36
+
37
+ ## Why the packages are separate at all
38
+
39
+ [`attribution-graph`](https://github.com/OWNER/attribution-graph) is a pure
40
+ inference library with no network I/O — that is what makes its scoring auditable,
41
+ since every number is a function of claims plus index counts with no hidden
42
+ network state. [`adtx-attribution`](https://github.com/OWNER/adtx-attribution)
43
+ carries the collectors and their dependencies.
44
+ [`handle-correlation`](https://github.com/OWNER/handle-correlation) is
45
+ independent of both.
46
+
47
+ Someone who only wants the scoring model should not have to install an HTTP
48
+ client, and someone writing their own collectors should not inherit ours. This
49
+ package exists for when you want all of it.
50
+
51
+ ## Unified run
52
+
53
+ One case file drives the whole chain:
54
+
55
+ ```bash
56
+ attribution run \
57
+ --case case.yaml \
58
+ --index adtx.sqlite \
59
+ --handles observed_handles.csv \
60
+ --spiderfoot scan.db \
61
+ --opencti bundle.json \
62
+ --robin investigations/kraken.json \
63
+ --out ./out
64
+ ```
65
+
66
+ Robin handles feed the handle-correlation pass automatically, carrying the
67
+ durable identifiers found alongside them. `.onion`-derived claims raise a warning
68
+ in the run summary: those sources have no archive and no preserved body, so they
69
+ cannot be verified after the fact by anyone, including you.
70
+
71
+ Order is fixed, and the ordering is the point: imported claims seed the frontier
72
+ before collection, adversarial checks run before scoring so a planted identifier
73
+ never reaches the model at full weight, and evidence verification runs before
74
+ reporting so findings from a package that failed its integrity check are never
75
+ presented. **`attribution run` exits non-zero if verification fails**, so a
76
+ scripted caller can detect an unpresentable result.
77
+
78
+ ## Passthrough commands
79
+
80
+ ```bash
81
+ attribution index build --domains tranco.txt --db adtx.sqlite
82
+ attribution portfolio scraper-site.example --index adtx.sqlite --registrants
83
+ attribution handles --observations handles.csv --corpus usernames.txt
84
+ attribution registries --jurisdiction IN
85
+ attribution verify ./out/evidence
86
+ attribution version
87
+ ```
88
+
89
+ These delegate to the component CLIs rather than duplicating their flags.
90
+
91
+ ## Outputs
92
+
93
+ | File | What it is |
94
+ |---|---|
95
+ | `attribution_report.md` / `.html` | Findings, ICD 203 language, source terms |
96
+ | `verification_trail.md` | Ordered timestamped steps with numbered citations |
97
+ | `investigation_graph.json` | Every claim with full provenance |
98
+ | `entities.ftm.json` | FollowTheMoney — loads into yente / Aleph |
99
+ | `graph.cypher` | Neo4j |
100
+ | `evidence/evidence_manifest.json` | Hash-chained capture record |
101
+ | `evidence/verify.py` | Standalone integrity checker, no dependencies |
102
+ | `evidence/DECLARATION_DRAFT.md` | Qualified-person certification skeleton |
103
+
104
+ ## Collection policy
105
+
106
+ `robots_policy` in the case file: `respect`, `record` (default), or `ignore`.
107
+
108
+ There is no silent enforcement — robots.txt is routinely bypassed in practice and
109
+ a library pretending otherwise would be enforcing an abandoned norm. What matters
110
+ for this toolchain is different: the output is meant to survive review, and the
111
+ question there is never "did the tool obey robots.txt" but "can you state what
112
+ your collection policy was". Whichever setting you choose is written into the
113
+ evidence manifest and the declaration draft.
114
+
115
+ In practice it rarely bites. RDAP, crt.sh, GLEIF, EDGAR, `sellers.json` and
116
+ `ads.txt` are all published for machine consumption; only imprint scraping and
117
+ county-records HTML touch robots-relevant paths.
118
+
119
+ ## Version reporting
120
+
121
+ Every run prints the version of each component, and `attribution version` reports
122
+ them. A finding that cannot name its toolchain is hard to re-examine once the
123
+ scoring model has moved.
124
+
125
+ ## License
126
+
127
+ Apache-2.0.
@@ -0,0 +1,102 @@
1
+ # attribution-suite
2
+
3
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
4
+
5
+ One install and one CLI over the attribution toolchain.
6
+
7
+ ```bash
8
+ pip install attribution-suite
9
+ attribution run --case case.yaml --index adtx.sqlite --out ./out
10
+ ```
11
+
12
+ ## Why the packages are separate at all
13
+
14
+ [`attribution-graph`](https://github.com/OWNER/attribution-graph) is a pure
15
+ inference library with no network I/O — that is what makes its scoring auditable,
16
+ since every number is a function of claims plus index counts with no hidden
17
+ network state. [`adtx-attribution`](https://github.com/OWNER/adtx-attribution)
18
+ carries the collectors and their dependencies.
19
+ [`handle-correlation`](https://github.com/OWNER/handle-correlation) is
20
+ independent of both.
21
+
22
+ Someone who only wants the scoring model should not have to install an HTTP
23
+ client, and someone writing their own collectors should not inherit ours. This
24
+ package exists for when you want all of it.
25
+
26
+ ## Unified run
27
+
28
+ One case file drives the whole chain:
29
+
30
+ ```bash
31
+ attribution run \
32
+ --case case.yaml \
33
+ --index adtx.sqlite \
34
+ --handles observed_handles.csv \
35
+ --spiderfoot scan.db \
36
+ --opencti bundle.json \
37
+ --robin investigations/kraken.json \
38
+ --out ./out
39
+ ```
40
+
41
+ Robin handles feed the handle-correlation pass automatically, carrying the
42
+ durable identifiers found alongside them. `.onion`-derived claims raise a warning
43
+ in the run summary: those sources have no archive and no preserved body, so they
44
+ cannot be verified after the fact by anyone, including you.
45
+
46
+ Order is fixed, and the ordering is the point: imported claims seed the frontier
47
+ before collection, adversarial checks run before scoring so a planted identifier
48
+ never reaches the model at full weight, and evidence verification runs before
49
+ reporting so findings from a package that failed its integrity check are never
50
+ presented. **`attribution run` exits non-zero if verification fails**, so a
51
+ scripted caller can detect an unpresentable result.
52
+
53
+ ## Passthrough commands
54
+
55
+ ```bash
56
+ attribution index build --domains tranco.txt --db adtx.sqlite
57
+ attribution portfolio scraper-site.example --index adtx.sqlite --registrants
58
+ attribution handles --observations handles.csv --corpus usernames.txt
59
+ attribution registries --jurisdiction IN
60
+ attribution verify ./out/evidence
61
+ attribution version
62
+ ```
63
+
64
+ These delegate to the component CLIs rather than duplicating their flags.
65
+
66
+ ## Outputs
67
+
68
+ | File | What it is |
69
+ |---|---|
70
+ | `attribution_report.md` / `.html` | Findings, ICD 203 language, source terms |
71
+ | `verification_trail.md` | Ordered timestamped steps with numbered citations |
72
+ | `investigation_graph.json` | Every claim with full provenance |
73
+ | `entities.ftm.json` | FollowTheMoney — loads into yente / Aleph |
74
+ | `graph.cypher` | Neo4j |
75
+ | `evidence/evidence_manifest.json` | Hash-chained capture record |
76
+ | `evidence/verify.py` | Standalone integrity checker, no dependencies |
77
+ | `evidence/DECLARATION_DRAFT.md` | Qualified-person certification skeleton |
78
+
79
+ ## Collection policy
80
+
81
+ `robots_policy` in the case file: `respect`, `record` (default), or `ignore`.
82
+
83
+ There is no silent enforcement — robots.txt is routinely bypassed in practice and
84
+ a library pretending otherwise would be enforcing an abandoned norm. What matters
85
+ for this toolchain is different: the output is meant to survive review, and the
86
+ question there is never "did the tool obey robots.txt" but "can you state what
87
+ your collection policy was". Whichever setting you choose is written into the
88
+ evidence manifest and the declaration draft.
89
+
90
+ In practice it rarely bites. RDAP, crt.sh, GLEIF, EDGAR, `sellers.json` and
91
+ `ads.txt` are all published for machine consumption; only imprint scraping and
92
+ county-records HTML touch robots-relevant paths.
93
+
94
+ ## Version reporting
95
+
96
+ Every run prints the version of each component, and `attribution version` reports
97
+ them. A finding that cannot name its toolchain is hard to re-examine once the
98
+ scoring model has moved.
99
+
100
+ ## License
101
+
102
+ Apache-2.0.
@@ -0,0 +1,32 @@
1
+ # Security policy
2
+
3
+ ## Reporting a vulnerability
4
+
5
+ Report privately via GitHub Security Advisories ("Report a vulnerability" on the
6
+ Security tab). Please do not open a public issue for security matters.
7
+
8
+ Expect an acknowledgement within 5 working days.
9
+
10
+ ## Scope
11
+
12
+ In scope:
13
+
14
+ - Code execution or injection via crafted claim data, case files or graph JSON
15
+ - Cypher or query injection in the unified runner
16
+ - Bypass of the source-class deny list in `scope.check_source_class`
17
+ - Leakage of unminimized identifiers when `minimize: true` is set
18
+ - Path traversal in case-file or output handling
19
+
20
+ Out of scope:
21
+
22
+ - Misuse of the library for investigations the operator was not authorized to
23
+ conduct. Scope enforcement here is a guardrail against accident and drift, not
24
+ a security boundary against a determined operator who controls the code.
25
+ - Vulnerabilities in downstream collector packages — report those to their
26
+ respective repositories.
27
+
28
+ ## Design note
29
+
30
+ `AttributionGraph` and `Claim` objects deserialized from untrusted JSON should
31
+ be treated as untrusted input. The library does not currently sandbox claim
32
+ `raw` payloads.
@@ -0,0 +1,40 @@
1
+ # Verifying a release
2
+
3
+ Releases are signed with [Sigstore](https://www.sigstore.dev/) keyless signing.
4
+ There is no long-lived signing key: the identity is the GitHub Actions workflow
5
+ that built the artifact, and every signature is recorded in the public Rekor
6
+ transparency log.
7
+
8
+ ## Verify a downloaded artifact
9
+
10
+ ```bash
11
+ pip install sigstore
12
+
13
+ sigstore verify identity \
14
+ --cert-identity "https://github.com/OWNER/REPO/.github/workflows/release.yml@refs/tags/vX.Y.Z" \
15
+ --cert-oidc-issuer "https://token.actions.githubusercontent.com" \
16
+ PACKAGE-X.Y.Z.tar.gz
17
+ ```
18
+
19
+ Substitute the real owner, repo and tag. If verification fails, the artifact was
20
+ not produced by that workflow at that tag — do not install it.
21
+
22
+ ## Checksums
23
+
24
+ `SHA256SUMS` is published with each release and is itself signed.
25
+
26
+ ```bash
27
+ sha256sum -c SHA256SUMS
28
+ ```
29
+
30
+ ## SBOM
31
+
32
+ `sbom.cyclonedx.json` is a CycloneDX software bill of materials for the release,
33
+ signed alongside the artifacts. Feed it to your own dependency scanner rather
34
+ than trusting this project's assessment of its own supply chain.
35
+
36
+ ## What signing does and does not prove
37
+
38
+ It proves the artifact came from this repository's release workflow at the stated
39
+ tag and has not been altered since. It does not prove the code is correct, safe,
40
+ or free of vulnerabilities. Read it.
@@ -0,0 +1,26 @@
1
+ # Drives the whole chain. attribution run --case this.yaml
2
+ case_ref: SCRAPE-2026-0417
3
+ authorization: "IR ticket SEC-88213 / preservation request 2026-08-02"
4
+ contact_email: "threatintel@example.com"
5
+
6
+ seeds:
7
+ - domain:scraper-site.example
8
+ - seller_id:pubmatic.com/156423
9
+
10
+ pivot_radius: 3
11
+ entity_types_allowed: [Company]
12
+ jurisdictions: [US, EU, IN]
13
+
14
+ # respect | record | ignore. Whichever you pick is written into the evidence
15
+ # manifest and the declaration draft, so the run can state its own policy.
16
+ robots_policy: record
17
+
18
+ minimize: true
19
+ retention_days: 180
20
+
21
+ budget:
22
+ max_requests: 4000
23
+ max_nodes: 15000
24
+ max_runtime_s: 1800
25
+
26
+ audit_path: audit.jsonl
@@ -0,0 +1,49 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "attribution-suite"
7
+ version = "0.6.0"
8
+ description = "One install and one CLI over the attribution-graph toolchain"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "Apache-2.0"
12
+ authors = [{ name = "Tushar Karumudi" }]
13
+ keywords = ["osint", "attribution", "threat-intelligence", "entity-resolution"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Information Technology",
17
+ "Topic :: Security",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ ]
22
+ dependencies = [
23
+ "attribution-graph>=0.6.0",
24
+ "adtx-attribution>=0.6.0",
25
+ "handle-correlation>=0.6.0",
26
+ ]
27
+
28
+ [project.optional-dependencies]
29
+ dev = ["pytest>=8.0", "pytest-asyncio>=0.23", "ruff>=0.6"]
30
+
31
+ [project.scripts]
32
+ attribution = "attribution_suite.cli:_cli"
33
+
34
+ [project.urls]
35
+ Homepage = "https://github.com/OWNER/attribution-suite"
36
+
37
+ [tool.hatch.build.targets.wheel]
38
+ packages = ["src/attribution_suite"]
39
+
40
+ [tool.ruff]
41
+ line-length = 100
42
+ target-version = "py311"
43
+
44
+ [tool.ruff.lint]
45
+ select = ["E", "F", "W", "I", "UP", "B", "SIM"]
46
+ ignore = ["B008", "UP017"]
47
+
48
+ [tool.pytest.ini_options]
49
+ testpaths = ["tests"]
@@ -0,0 +1,19 @@
1
+ """attribution-suite: one install and one CLI over the three attribution packages.
2
+
3
+ The packages are separate on purpose. ``attribution-graph`` is a pure inference
4
+ library with no network I/O, which is what makes its scoring auditable;
5
+ ``adtx-attribution`` carries the collectors and their dependencies;
6
+ ``handle-correlation`` is independent of both. Someone who only wants the scoring
7
+ model should not have to install an HTTP client, and someone building their own
8
+ collectors should not inherit ours.
9
+
10
+ This package exists for the case where you want all of it: ``pip install
11
+ attribution-suite`` and a single ``attribution`` command that runs the whole
12
+ chain — collect, score, resolve, verify, report — with one case file.
13
+ """
14
+
15
+ from .runner import SuiteResult, run_case
16
+ from .version import PACKAGES, versions
17
+
18
+ __version__ = "0.6.0"
19
+ __all__ = ["run_case", "SuiteResult", "versions", "PACKAGES", "__version__"]
@@ -0,0 +1,131 @@
1
+ """Unified CLI.
2
+
3
+ attribution run --case case.yaml [--index adtx.sqlite] [--handles h.csv]
4
+ attribution portfolio <domain> --index adtx.sqlite
5
+ attribution handles --observations h.csv
6
+ attribution registries --jurisdiction IN
7
+ attribution verify ./out/evidence
8
+ attribution version
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import argparse
14
+ import contextlib
15
+ import os
16
+ import subprocess
17
+ import sys
18
+ from pathlib import Path
19
+
20
+ from .runner import run_case
21
+ from .version import banner, versions
22
+
23
+
24
+ def _run(a: argparse.Namespace) -> int:
25
+ from attribution_graph import PolicyError
26
+ try:
27
+ res = run_case(
28
+ a.case, a.out, corpus_index=a.index or None, blacklist=a.blacklist or None,
29
+ handles=a.handles or None, spiderfoot=a.spiderfoot or None,
30
+ opencti=a.opencti or None, robin=a.robin or None,
31
+ show_scores=not a.no_scores,
32
+ evidence=not a.no_evidence, concurrency=a.concurrency,
33
+ )
34
+ except PolicyError as e:
35
+ print(f"policy error: {e}", file=sys.stderr)
36
+ return 2
37
+
38
+ print(banner())
39
+ print(res.summary())
40
+ print()
41
+ for p in res.outputs:
42
+ print(f" {p}")
43
+ # Non-zero when integrity failed: a caller scripting this must be able to
44
+ # detect that the findings are not presentable.
45
+ return 1 if res.stats.get("evidence_verified") is False else 0
46
+
47
+
48
+ def _verify(a: argparse.Namespace) -> int:
49
+ v = Path(a.path) / "verify.py"
50
+ if not v.exists():
51
+ v = Path(a.path)
52
+ if not v.exists():
53
+ print(f"no verify.py at {a.path}", file=sys.stderr)
54
+ return 2
55
+ return subprocess.call([sys.executable, str(v)])
56
+
57
+
58
+ def _delegate(module: str, argv: list[str]) -> int:
59
+ from importlib import import_module
60
+ return import_module(module).main(argv)
61
+
62
+
63
+ def _version(_: argparse.Namespace) -> int:
64
+ for k, v in versions().items():
65
+ print(f"{k.replace('_', '-'):22} {v}")
66
+ return 0
67
+
68
+
69
+ def main(argv: list[str] | None = None) -> int:
70
+ ap = argparse.ArgumentParser(
71
+ prog="attribution",
72
+ description="Unified entity attribution suite")
73
+ sub = ap.add_subparsers(dest="cmd", required=True)
74
+
75
+ r = sub.add_parser("run", help="full chain from one case file")
76
+ r.add_argument("--case", required=True)
77
+ r.add_argument("--out", default="./out")
78
+ r.add_argument("--index", default="", help="ads.txt corpus sqlite")
79
+ r.add_argument("--blacklist", default="")
80
+ r.add_argument("--handles", default="", help="observed-handle CSV/JSON")
81
+ r.add_argument("--spiderfoot", default="", help="SpiderFoot .csv or .db")
82
+ r.add_argument("--opencti", default="", help="STIX 2.1 bundle")
83
+ r.add_argument("--robin", default="", help="Robin dark web investigation JSON")
84
+ r.add_argument("--no-scores", action="store_true",
85
+ help="omit confidence figures from the report")
86
+ r.add_argument("--no-evidence", action="store_true")
87
+ r.add_argument("--concurrency", type=int, default=6)
88
+ r.set_defaults(func=_run)
89
+
90
+ v = sub.add_parser("verify", help="check an evidence package's integrity")
91
+ v.add_argument("path", default="./out/evidence", nargs="?")
92
+ v.set_defaults(func=_verify)
93
+
94
+ sub.add_parser("version").set_defaults(func=_version)
95
+
96
+ known = {"run", "verify", "version"}
97
+ argv = list(sys.argv[1:] if argv is None else argv)
98
+
99
+ # Pass through to the component CLIs rather than duplicating their flags.
100
+ if argv and argv[0] not in known:
101
+ delegates = {
102
+ "portfolio": ("adtx_attribution.cli", argv),
103
+ "registries": ("adtx_attribution.cli", argv),
104
+ "index": ("adtx_attribution.index", argv[1:]),
105
+ "handles": ("handle_correlation.cli", ["score"] + argv[1:]),
106
+ }
107
+ if argv[0] in delegates:
108
+ mod, passthru = delegates[argv[0]]
109
+ if argv[0] == "index":
110
+ from adtx_attribution.index import _main
111
+ return _main(passthru)
112
+ return _delegate(mod, passthru)
113
+
114
+ args = ap.parse_args(argv)
115
+ return args.func(args)
116
+
117
+
118
+ def _cli() -> int:
119
+ try:
120
+ return main()
121
+ except BrokenPipeError:
122
+ os.dup2(os.open(os.devnull, os.O_WRONLY), sys.stdout.fileno())
123
+ return 0
124
+ except KeyboardInterrupt:
125
+ with contextlib.suppress(Exception):
126
+ print("\ninterrupted", file=sys.stderr)
127
+ return 130
128
+
129
+
130
+ if __name__ == "__main__":
131
+ raise SystemExit(_cli())
@@ -0,0 +1,205 @@
1
+ """Unified run: collect, score, resolve, verify, report.
2
+
3
+ One case file drives everything. The sequence is fixed because the ordering
4
+ matters: adversarial checks must run before scoring (a planted identifier must
5
+ not reach the model at full weight), and evidence verification must run before
6
+ reporting (findings from a package that failed its integrity check should never
7
+ be presented).
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import asyncio
13
+ from dataclasses import dataclass, field
14
+ from pathlib import Path
15
+ from typing import Any
16
+
17
+ from attribution_graph import (
18
+ AttributionGraph,
19
+ CaseScope,
20
+ CompositeIndex,
21
+ Engine,
22
+ EvidenceLog,
23
+ InMemoryIndex,
24
+ PolicyEngine,
25
+ ResolutionResult,
26
+ RobotsPolicy,
27
+ StepKind,
28
+ Trail,
29
+ load_blacklist,
30
+ write_all,
31
+ write_evidence_package,
32
+ )
33
+
34
+
35
+ @dataclass
36
+ class SuiteResult:
37
+ scope: CaseScope
38
+ graph: AttributionGraph
39
+ resolution: ResolutionResult | None
40
+ trail: Trail
41
+ evidence: EvidenceLog | None
42
+ outputs: list[Path] = field(default_factory=list)
43
+ warnings: list[str] = field(default_factory=list)
44
+ stats: dict[str, Any] = field(default_factory=dict)
45
+
46
+ def summary(self) -> str:
47
+ L = [f"case {self.scope.case_ref}",
48
+ f" {len(self.graph.identifiers)} identifiers, "
49
+ f"{len(self.graph.claims)} claims, {len(self.graph.entities)} entities"]
50
+ for k, v in self.stats.items():
51
+ L.append(f" {k}: {v}")
52
+ if self.warnings:
53
+ L.append(" warnings:")
54
+ L += [f" - {w}" for w in self.warnings]
55
+ return "\n".join(L)
56
+
57
+
58
+ def run_case(
59
+ case_path: str | Path,
60
+ outdir: str | Path = "./out",
61
+ *,
62
+ corpus_index: str | Path | None = None,
63
+ blacklist: str | Path | None = None,
64
+ handles: str | Path | None = None,
65
+ spiderfoot: str | Path | None = None,
66
+ opencti: str | Path | None = None,
67
+ robin: str | Path | None = None,
68
+ show_scores: bool = True,
69
+ evidence: bool = True,
70
+ concurrency: int = 6,
71
+ ) -> SuiteResult:
72
+ """Run the full chain from one case file."""
73
+ from adtx_attribution import AdsTxtIndex, Fetcher
74
+ from adtx_attribution.collectors import build_all
75
+
76
+ scope = CaseScope.load(case_path)
77
+ out = Path(outdir)
78
+ out.mkdir(parents=True, exist_ok=True)
79
+
80
+ trail = Trail(scope.case_ref, scope.authorization)
81
+ warnings: list[str] = []
82
+ stats: dict[str, Any] = {}
83
+
84
+ if blacklist:
85
+ load_blacklist(str(blacklist))
86
+
87
+ ua = (f"attribution-suite/0.2 (case {scope.case_ref}; "
88
+ f"{scope.contact_email or 'no-contact-configured'})")
89
+ fetcher = Fetcher(user_agent=ua, max_requests=scope.max_requests)
90
+ policy = PolicyEngine(policy=RobotsPolicy(scope.robots_policy), user_agent=ua)
91
+ ev = EvidenceLog(scope, out / "evidence") if evidence else None
92
+
93
+ collectors = build_all(fetcher, scope)
94
+ engine = Engine(scope, collectors=collectors, concurrency=concurrency)
95
+
96
+ if corpus_index:
97
+ engine.index = CompositeIndex(AdsTxtIndex(str(corpus_index)),
98
+ InMemoryIndex(engine.graph))
99
+ else:
100
+ warnings.append(
101
+ "no corpus index supplied — selectivity counts come from this case "
102
+ "only, so confidence figures are upper bounds, not assessments")
103
+
104
+ for s in scope.seeds:
105
+ trail.seed(s)
106
+
107
+ # --- imported claims, before collection, so they seed the frontier ------ #
108
+ if spiderfoot:
109
+ from adtx_attribution import from_spiderfoot_csv, from_spiderfoot_db
110
+ p = Path(spiderfoot)
111
+ imported = (from_spiderfoot_db(p) if p.suffix in (".db", ".sqlite")
112
+ else from_spiderfoot_csv(p))
113
+ for c in imported:
114
+ engine.ingest(c, depth=1)
115
+ stats["spiderfoot_claims"] = len(imported)
116
+ trail.add_imported("SpiderFoot", str(p), len(imported))
117
+
118
+ if opencti:
119
+ from adtx_attribution import from_opencti_bundle
120
+ imported = from_opencti_bundle(Path(opencti))
121
+ for c in imported:
122
+ engine.ingest(c, depth=1)
123
+ stats["opencti_claims"] = len(imported)
124
+ trail.add_imported("OpenCTI", str(opencti), len(imported))
125
+
126
+ robin_claims: list = []
127
+ if robin:
128
+ from adtx_attribution import from_robin
129
+ robin_claims = from_robin(Path(robin))
130
+ for c in robin_claims:
131
+ engine.ingest(c, depth=1)
132
+ stats["robin_claims"] = len(robin_claims)
133
+ onion = sum(1 for c in robin_claims if c.raw.get("onion"))
134
+ llm = sum(1 for c in robin_claims if c.raw.get("llm_derived"))
135
+ stats["robin_onion_sources"] = onion
136
+ trail.add_imported("Robin", str(robin), len(robin_claims))
137
+ trail.add(
138
+ StepKind.FILTER,
139
+ f"Marked {len(robin_claims)} Robin claim(s) as derived text",
140
+ detail=("Robin truncates scraped content and does not retain response "
141
+ "bodies, so these are leads rather than captures. "
142
+ f"{onion} came from .onion sources, which cannot be re-fetched "
143
+ f"or archived; {llm} were asserted by a language model and are "
144
+ "capped at UNCERTAIN."))
145
+ if onion:
146
+ warnings.append(
147
+ f"{onion} claim(s) derive from .onion sources with no preserved "
148
+ "response body — unverifiable after the fact by anyone, including you")
149
+
150
+ # --- collect ------------------------------------------------------------ #
151
+ resolution = asyncio.run(engine.run())
152
+ asyncio.run(fetcher.aclose())
153
+ stats["requests"] = fetcher.count
154
+
155
+ # --- handles ------------------------------------------------------------ #
156
+ if handles or robin_claims:
157
+ from handle_correlation import HandleCorpus, Observation, all_claims, correlation_points
158
+ from handle_correlation import load as load_handles
159
+
160
+ obs = load_handles(handles) if handles else []
161
+
162
+ # Handles Robin surfaced join the same correlation pass, carrying the
163
+ # durable identifiers found on the same page -- which is what can lift
164
+ # them above the correlation-point floor.
165
+ if robin_claims:
166
+ from adtx_attribution import to_handle_observations
167
+ for row in to_handle_observations(robin_claims, scope.case_ref):
168
+ obs.append(Observation(
169
+ handle=row["handle"], platform=row["platform"],
170
+ linked={k[5:]: v for k, v in row.items() if k.startswith("link_")},
171
+ source_url=row.get("source_url", ""),
172
+ case_ref=row.get("case_ref", ""),
173
+ ))
174
+ corpus = HandleCorpus()
175
+ for o in obs:
176
+ corpus.observe(o.qualified)
177
+ hclaims = all_claims(obs, corpus)
178
+ for c in hclaims:
179
+ engine.graph.add_claim(c)
180
+ hc = correlation_points(hclaims)
181
+ stats["handle_observations"] = len(obs)
182
+ stats["handle_confidence"] = f"{hc.level.value} ({hc.points} points)"
183
+ warnings.append(f"handle correlation: {hc.caveat}")
184
+ trail.infer(f"Handle correlation assessed: {hc.level.value}",
185
+ basis=hc.caveat)
186
+
187
+ # --- evidence policy block ---------------------------------------------- #
188
+ if ev is not None:
189
+ ev.fetch_policy = policy.summary([])
190
+ paths = write_evidence_package(ev)
191
+ ok, problems = ev.verify()
192
+ stats["evidence_verified"] = ok
193
+ if not ok:
194
+ warnings.append(
195
+ "EVIDENCE VERIFICATION FAILED — do not present these findings: "
196
+ + "; ".join(problems[:3]))
197
+
198
+ outputs = write_all(engine.graph, resolution, scope, out,
199
+ show_scores=show_scores, trail=trail)
200
+ if ev is not None:
201
+ outputs += paths
202
+
203
+ return SuiteResult(scope=scope, graph=engine.graph, resolution=resolution,
204
+ trail=trail, evidence=ev, outputs=outputs,
205
+ warnings=warnings, stats=stats)
@@ -0,0 +1,32 @@
1
+ """Version reporting across the suite.
2
+
3
+ Every report and evidence manifest should be able to state which versions
4
+ produced it. A finding that cannot name its toolchain is hard to re-examine
5
+ later, especially once the scoring model has moved.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import importlib
11
+ import importlib.metadata
12
+
13
+ PACKAGES = ("attribution_graph", "adtx_attribution", "handle_correlation")
14
+
15
+
16
+ def versions() -> dict[str, str]:
17
+ out: dict[str, str] = {}
18
+ for name in PACKAGES:
19
+ try:
20
+ mod = importlib.import_module(name)
21
+ out[name] = getattr(mod, "__version__", "unknown")
22
+ except ImportError:
23
+ out[name] = "not installed"
24
+ try:
25
+ out["attribution_suite"] = importlib.metadata.version("attribution-suite")
26
+ except importlib.metadata.PackageNotFoundError:
27
+ out["attribution_suite"] = "dev"
28
+ return out
29
+
30
+
31
+ def banner() -> str:
32
+ return " | ".join(f"{k.replace('_', '-')} {v}" for k, v in versions().items())
@@ -0,0 +1,34 @@
1
+ """Suite wiring."""
2
+
3
+
4
+ from attribution_suite import PACKAGES, versions
5
+ from attribution_suite.cli import main
6
+
7
+
8
+ def test_all_component_packages_import():
9
+ v = versions()
10
+ for p in PACKAGES:
11
+ assert v[p] != "not installed", p
12
+
13
+
14
+ def test_versions_are_aligned():
15
+ v = versions()
16
+ reported = {v[p] for p in PACKAGES}
17
+ assert len(reported) == 1, f"component versions diverge: {v}"
18
+
19
+
20
+ def test_version_command_runs(capsys):
21
+ assert main(["version"]) == 0
22
+ assert "attribution-graph" in capsys.readouterr().out
23
+
24
+
25
+ def test_run_refuses_a_case_without_authorization(tmp_path, capsys):
26
+ c = tmp_path / "bad.yaml"
27
+ c.write_text("case_ref: X\nseeds: [domain:a.example]\n")
28
+ assert main(["run", "--case", str(c), "--out", str(tmp_path / "o")]) == 2
29
+ assert "authorization" in capsys.readouterr().err
30
+
31
+
32
+ def test_registries_delegates_to_component_cli(capsys):
33
+ assert main(["registries", "--jurisdiction", "GB"]) == 0
34
+ assert "Companies House" in capsys.readouterr().out