security-anomaly-ml 0.1.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.
Files changed (48) hide show
  1. security_anomaly_ml-0.1.0/LICENSE +201 -0
  2. security_anomaly_ml-0.1.0/PKG-INFO +280 -0
  3. security_anomaly_ml-0.1.0/README.md +264 -0
  4. security_anomaly_ml-0.1.0/pyproject.toml +34 -0
  5. security_anomaly_ml-0.1.0/setup.cfg +4 -0
  6. security_anomaly_ml-0.1.0/src/security_anomaly/__init__.py +64 -0
  7. security_anomaly_ml-0.1.0/src/security_anomaly/__main__.py +6 -0
  8. security_anomaly_ml-0.1.0/src/security_anomaly/aggregation.py +99 -0
  9. security_anomaly_ml-0.1.0/src/security_anomaly/cli.py +255 -0
  10. security_anomaly_ml-0.1.0/src/security_anomaly/contracts.py +157 -0
  11. security_anomaly_ml-0.1.0/src/security_anomaly/detector.py +185 -0
  12. security_anomaly_ml-0.1.0/src/security_anomaly/model_bundle.py +230 -0
  13. security_anomaly_ml-0.1.0/src/security_anomaly/package_resources.py +39 -0
  14. security_anomaly_ml-0.1.0/src/security_anomaly/resources/__init__.py +1 -0
  15. security_anomaly_ml-0.1.0/src/security_anomaly/resources/feature-contract-cicflow-v2-128.json +423 -0
  16. security_anomaly_ml-0.1.0/src/security_anomaly/resources/incident-v1.schema.json +55 -0
  17. security_anomaly_ml-0.1.0/src/security_anomaly/resources/model-manifest-context-rf-v2.json +93 -0
  18. security_anomaly_ml-0.1.0/src/security_anomaly/results.py +57 -0
  19. security_anomaly_ml-0.1.0/src/security_anomaly/serialization.py +169 -0
  20. security_anomaly_ml-0.1.0/src/security_anomaly/temporal.py +290 -0
  21. security_anomaly_ml-0.1.0/src/security_anomaly/validation.py +202 -0
  22. security_anomaly_ml-0.1.0/src/security_anomaly_ml.egg-info/PKG-INFO +280 -0
  23. security_anomaly_ml-0.1.0/src/security_anomaly_ml.egg-info/SOURCES.txt +46 -0
  24. security_anomaly_ml-0.1.0/src/security_anomaly_ml.egg-info/dependency_links.txt +1 -0
  25. security_anomaly_ml-0.1.0/src/security_anomaly_ml.egg-info/entry_points.txt +2 -0
  26. security_anomaly_ml-0.1.0/src/security_anomaly_ml.egg-info/requires.txt +5 -0
  27. security_anomaly_ml-0.1.0/src/security_anomaly_ml.egg-info/top_level.txt +1 -0
  28. security_anomaly_ml-0.1.0/tests/test_analyze_incident_aggregation.py +123 -0
  29. security_anomaly_ml-0.1.0/tests/test_analyze_incident_promotion.py +118 -0
  30. security_anomaly_ml-0.1.0/tests/test_analyze_v2_ensemble.py +58 -0
  31. security_anomaly_ml-0.1.0/tests/test_build_temporal_features.py +72 -0
  32. security_anomaly_ml-0.1.0/tests/test_evaluate_v2_feb18_holdout.py +103 -0
  33. security_anomaly_ml-0.1.0/tests/test_explore_cic_unsw_nb15.py +29 -0
  34. security_anomaly_ml-0.1.0/tests/test_fetch_frozen_model.py +104 -0
  35. security_anomaly_ml-0.1.0/tests/test_product_cli.py +225 -0
  36. security_anomaly_ml-0.1.0/tests/test_product_detector.py +201 -0
  37. security_anomaly_ml-0.1.0/tests/test_product_e2e.py +198 -0
  38. security_anomaly_ml-0.1.0/tests/test_product_incident_aggregation.py +125 -0
  39. security_anomaly_ml-0.1.0/tests/test_product_model_bundle.py +133 -0
  40. security_anomaly_ml-0.1.0/tests/test_product_packaging.py +77 -0
  41. security_anomaly_ml-0.1.0/tests/test_product_serialization.py +243 -0
  42. security_anomaly_ml-0.1.0/tests/test_product_temporal_features.py +134 -0
  43. security_anomaly_ml-0.1.0/tests/test_product_validation.py +139 -0
  44. security_anomaly_ml-0.1.0/tests/test_train_v2_ablation.py +29 -0
  45. security_anomaly_ml-0.1.0/tests/test_train_v2_fuzzer_weighting.py +54 -0
  46. security_anomaly_ml-0.1.0/tests/test_train_v2_temporal_stacking.py +68 -0
  47. security_anomaly_ml-0.1.0/tests/test_verify_product_incident_parity.py +87 -0
  48. security_anomaly_ml-0.1.0/tests/test_verify_product_pipeline_parity.py +119 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Ievgen Bondarenko
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,280 @@
1
+ Metadata-Version: 2.4
2
+ Name: security-anomaly-ml
3
+ Version: 0.1.0
4
+ Summary: Label-free CICFlowMeter network-flow triage with a frozen temporal detector
5
+ Author: Security Anomaly ML contributors
6
+ License-Expression: Apache-2.0
7
+ Requires-Python: <3.14,>=3.13
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: numpy==2.5.2
11
+ Requires-Dist: pandas==3.0.5
12
+ Requires-Dist: scikit-learn==1.9.0
13
+ Requires-Dist: joblib==1.5.3
14
+ Requires-Dist: duckdb==1.5.5
15
+ Dynamic: license-file
16
+
17
+ ![Security Anomaly ML](./assets/security-anomaly-ml-banner.svg)
18
+
19
+ # Security Anomaly ML
20
+
21
+ Security Anomaly ML is an open-source batch network-flow anomaly detection system that converts unlabeled CICFlowMeter-compatible flows into promoted, analyst-facing security incidents.
22
+
23
+ [![CI](https://github.com/ibondarenko1/security-anomaly-ml/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/ibondarenko1/security-anomaly-ml/actions/workflows/ci.yml)
24
+ [![Python 3.13](https://img.shields.io/badge/Python-3.13-blue.svg)](https://www.python.org/)
25
+ [![Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-green.svg)](./LICENSE)
26
+ [![Release v0.1.0](https://img.shields.io/badge/release-v0.1.0-blue.svg)](https://github.com/ibondarenko1/security-anomaly-ml/releases/tag/v0.1.0)
27
+
28
+ **v0.1.0 is a usable research/evaluation release. It is not production-ready.** The frozen detector performed well on one future capture day from the same network family, but the remaining alert volume is too high for a normal Tier-1 production queue.
29
+
30
+ ## Quick start
31
+
32
+ Docker is the recommended path. The published image includes the exact verified frozen model, so no separate model download is needed.
33
+
34
+ ```bash
35
+ docker pull ghcr.io/ibondarenko1/security-anomaly-ml:0.1.0
36
+
37
+ docker run --rm --network none \
38
+ -v "$PWD:/data" \
39
+ ghcr.io/ibondarenko1/security-anomaly-ml:0.1.0 \
40
+ validate /data/flows.csv
41
+
42
+ docker run --rm --network none \
43
+ -v "$PWD:/data" \
44
+ ghcr.io/ibondarenko1/security-anomaly-ml:0.1.0 \
45
+ analyze /data/flows.csv \
46
+ --output /data/incidents.jsonl
47
+ ```
48
+
49
+ Windows PowerShell:
50
+
51
+ ```powershell
52
+ docker pull ghcr.io/ibondarenko1/security-anomaly-ml:0.1.0
53
+
54
+ docker run --rm --network none `
55
+ --mount "type=bind,source=$($PWD.Path),target=/data" `
56
+ ghcr.io/ibondarenko1/security-anomaly-ml:0.1.0 `
57
+ validate /data/flows.csv
58
+
59
+ docker run --rm --network none `
60
+ --mount "type=bind,source=$($PWD.Path),target=/data" `
61
+ ghcr.io/ibondarenko1/security-anomaly-ml:0.1.0 `
62
+ analyze /data/flows.csv `
63
+ --output /data/incidents.jsonl
64
+ ```
65
+
66
+ The mounted directory must be writable by the container's non-root UID/GID `10001`. Normal inference works with networking disabled.
67
+
68
+ ## How it works
69
+
70
+ One input row represents one network flow. The product validates the label-free CSV, builds tie-safe causal context, scores each flow, groups flow alerts into deterministic five-minute incidents, and emits only promoted incidents.
71
+
72
+ ```mermaid
73
+ flowchart LR
74
+ A["CICFlowMeter flows"] --> B["Input validation"]
75
+ B --> C["128 causal features"]
76
+ C --> D["context-rf-v2 attack score"]
77
+ D --> E["Flow alert: score >= 0.10"]
78
+ E --> F["Policy B: src IP + dst IP + dst port / 5 min"]
79
+ F --> G["Promotion: max score >= 0.25"]
80
+ G --> H["incident-v1 JSONL"]
81
+ ```
82
+
83
+ The frozen feature contract is:
84
+
85
+ ```text
86
+ 76 CICFlowMeter flow features
87
+ + 9 static port/protocol behavioral features
88
+ + 43 causal temporal-context features
89
+ = 128 model features
90
+ ```
91
+
92
+ Raw IP addresses and timestamps provide temporal and incident context but are not model identity features. Same-timestamp flows are processed as one peer group: all peers are featurized before that timestamp updates state.
93
+
94
+ ## Output
95
+
96
+ The output is newline-delimited `incident-v1` JSON. Each object contains a deterministic incident ID, first/last timestamps, endpoints, destination port, protocols, flow count, aggregate attack scores, and frozen version metadata.
97
+
98
+ ```json
99
+ {
100
+ "schema_version": "incident-v1",
101
+ "incident_id": "inc_<64-hex-digest>",
102
+ "first_seen": "2026-08-20T13:00:00",
103
+ "last_seen": "2026-08-20T13:00:05",
104
+ "src_ip": "192.0.2.10",
105
+ "dst_ip": "198.51.100.20",
106
+ "dst_port": 445,
107
+ "protocols": [6, 17],
108
+ "flow_count": 3,
109
+ "max_attack_score": 0.432590909091,
110
+ "mean_attack_score": 0.418368686869,
111
+ "promoted": true,
112
+ "product_version": "0.1.0",
113
+ "model_version": "context-rf-v2",
114
+ "feature_contract": "cicflow-v2-128"
115
+ }
116
+ ```
117
+
118
+ The synthetic regression fixture at [`tests/fixtures/product-v01/flows.csv`](tests/fixtures/product-v01/flows.csv) deterministically produces:
119
+
120
+ - 12 processed flows;
121
+ - 9 flow alerts;
122
+ - 5 aggregated incidents;
123
+ - 2 promoted incidents.
124
+
125
+ These numbers test runtime stability; they are **not an accuracy benchmark** and contain no copied research-dataset rows.
126
+
127
+ ## Frozen validation results
128
+
129
+ The v0.1 pipeline was frozen before evaluation on the February 18 temporal holdout. No thresholds, features, model parameters, aggregation rules, promotion rules, suppression, or whitelisting were changed after opening it.
130
+
131
+ | Metric | Locked holdout |
132
+ |---|---:|
133
+ | Flow recall | 98.3686% |
134
+ | Flow precision | 67.5499% |
135
+ | Flow FPR | 2.1190% |
136
+ | PR-AUC | 0.898915 |
137
+ | Aggregated incident recall | 99.9917% |
138
+ | Promoted incident recall | 99.9339% |
139
+ | Promoted incident precision | 93.46% |
140
+ | Flow-alert to incident reduction | 83.80% |
141
+ | FP-object reduction | 96.74% |
142
+
143
+ **Verdict: acceptable but operationally noisy.** This is one future capture day with overlapping hosts/environment from the same dataset and network family. It is not evidence of generalization across arbitrary networks, and the remaining workload is too high for normal Tier-1 production use.
144
+
145
+ ## Input format
146
+
147
+ Input must be a UTF-8 CICFlowMeter-compatible CSV containing:
148
+
149
+ - `Src IP`, `Src Port`, `Dst IP`, `Dst Port`, `Protocol`, and `Timestamp`;
150
+ - all 76 baseline numeric fields defined by [`cicflow-v2-128`](contracts/feature-contract-cicflow-v2-128.json);
151
+ - optional `Flow ID`.
152
+
153
+ `Label`, `label`, and `attack_cat` are not required and are removed if present. Validation rejects missing or duplicate columns, reserved derived fields, malformed timestamps, invalid ports/protocols, and non-numeric or non-finite model inputs. Source timestamps are timezone-naive; v0.1 does not invent a timezone.
154
+
155
+ Use `validate` before analysis when integrating a new exporter:
156
+
157
+ ```bash
158
+ security-anomaly validate flows.csv
159
+ ```
160
+
161
+ ## Docker
162
+
163
+ The immutable release tag is:
164
+
165
+ ```text
166
+ ghcr.io/ibondarenko1/security-anomaly-ml:0.1.0
167
+ ```
168
+
169
+ It includes Python 3.13, the installed package, contracts, pinned runtime dependencies, and the verified model. It runs as non-root and requires no network during inference. Build and operational details are in [`docs/DOCKER.md`](docs/DOCKER.md).
170
+
171
+ No mutable `latest` tag is published for v0.1.0.
172
+
173
+ ## Python CLI
174
+
175
+ Download the wheel from the [v0.1.0 GitHub Release](https://github.com/ibondarenko1/security-anomaly-ml/releases/tag/v0.1.0), then install it into Python 3.13:
176
+
177
+ ```bash
178
+ python3.13 -m venv .venv
179
+ source .venv/bin/activate
180
+ python -m pip install security_anomaly_ml-0.1.0-py3-none-any.whl
181
+ security-anomaly version
182
+ ```
183
+
184
+ The Python wheel intentionally does not embed the model. Obtain the existing artifact from the [`model-context-rf-v2` release](https://github.com/ibondarenko1/security-anomaly-ml/releases/tag/model-context-rf-v2), or from a source checkout run:
185
+
186
+ ```bash
187
+ python tools/fetch_frozen_model.py \
188
+ --tag model-context-rf-v2 \
189
+ --destination models/context-rf-v2.joblib
190
+
191
+ security-anomaly model-info --model models/context-rf-v2.joblib
192
+ security-anomaly analyze flows.csv \
193
+ --model models/context-rf-v2.joblib \
194
+ --output incidents.jsonl
195
+ ```
196
+
197
+ The downloader verifies the frozen SHA-256 before success and never silently replaces a different file. Full CLI behavior and exit codes are documented in [`docs/CLI.md`](docs/CLI.md).
198
+
199
+ ## Reproducibility and CI
200
+
201
+ Public CI runs on every pull request and push to `main` and requires only a clean checkout plus the public frozen-model release. It verifies:
202
+
203
+ - unit and frozen-contract tests;
204
+ - pinned runtime dependency vulnerability audit;
205
+ - clean wheel/sdist build and outside-checkout installation;
206
+ - public model download and SHA verification;
207
+ - real-model end-to-end golden regression;
208
+ - non-root offline Docker build and byte-identical golden output;
209
+ - exclusion of datasets and research artifacts from the runtime image.
210
+
211
+ Goldens are never rewritten automatically. Details are in [`docs/CI.md`](docs/CI.md).
212
+
213
+ ## Model artifact
214
+
215
+ | Field | Frozen value |
216
+ |---|---|
217
+ | Model version | `context-rf-v2` |
218
+ | Release tag | [`model-context-rf-v2`](https://github.com/ibondarenko1/security-anomaly-ml/releases/tag/model-context-rf-v2) |
219
+ | Filename | `context-rf-v2.joblib` |
220
+ | SHA-256 | `4730a06506d8c5f2af93679c492e1544b3c2b11acd16fe74120d64d4dbfc5c72` |
221
+ | Python | `3.13.7` |
222
+ | Feature builder | `causal-temporal-v2` |
223
+ | Feature contract | `cicflow-v2-128` |
224
+ | Flow threshold | `>= 0.10` |
225
+ | Incident policy | Policy B, gap `> 300s` |
226
+ | Promotion | `max_attack_score >= 0.25` |
227
+
228
+ Scores are ranking signals, not calibrated real-world probabilities. The model is excluded from Git history and is never reserialized by the product build.
229
+
230
+ ## Security and privacy
231
+
232
+ Security Anomaly ML processes sensitive network-flow metadata locally. Normal inference performs no telemetry, cloud upload, hidden download, or other outbound network call; the Docker path is tested with `--network none`.
233
+
234
+ - Vulnerability reporting: [`SECURITY.md`](SECURITY.md)
235
+ - Data handling and privacy: [`docs/PRIVACY.md`](docs/PRIVACY.md)
236
+
237
+ Do not attach real packet captures, raw flow exports, internal IP inventories, or unredacted incidents to public issues.
238
+
239
+ ## Limitations
240
+
241
+ - Research/evaluation grade; not production-ready and not a SOC replacement.
242
+ - Batch CSV processing only; no streaming, API, dashboard, or persistent state service.
243
+ - CICFlowMeter-compatible input only.
244
+ - Frozen Python 3.13 serialization/runtime compatibility.
245
+ - Input timestamps have source-defined, timezone-naive semantics and one-second granularity.
246
+ - Validation covers one future day from an overlapping network/dataset family, not arbitrary networks.
247
+ - Flow-level weaknesses remain concentrated in Fuzzers and Analysis traffic.
248
+ - The score is not calibrated as a real-world attack probability.
249
+ - Alert workload remains too high for normal Tier-1 production operations.
250
+
251
+ ## Research methodology
252
+
253
+ The production-facing v0.1 pipeline was selected using chronological capture days:
254
+
255
+ ```text
256
+ 2015-01-22 -> training
257
+ 2015-02-17 -> validation
258
+ 2015-02-18 -> locked temporal holdout
259
+ ```
260
+
261
+ Temporal context resets at split and batch boundaries. February 18 was not used for training, feature selection, threshold selection, aggregation selection, or promotion selection. Research scripts remain available for audit, but datasets and generated evaluation artifacts are not redistributed.
262
+
263
+ The research uses UNSW-NB15 and CIC-UNSW-NB15 under their publishers' terms. Third-party dataset terms are not covered by this repository's Apache-2.0 license.
264
+
265
+ ## Development and tests
266
+
267
+ Python 3.13 is required for the frozen product runtime.
268
+
269
+ ```bash
270
+ python3.13 -m venv .venv
271
+ source .venv/bin/activate
272
+ python -m pip install -r requirements.txt
273
+ python -m pytest -q
274
+ ```
275
+
276
+ Some research-reproduction tests require non-redistributed datasets or generated artifacts and skip explicitly in a clean public checkout. Product CI is fully reproducible from public inputs.
277
+
278
+ ## License
279
+
280
+ Original source code is licensed under the [Apache License 2.0](LICENSE). Dataset licenses and terms remain with their original publishers.