iack-framework 0.2.0__tar.gz → 0.3.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.
- iack_framework-0.3.0/PKG-INFO +67 -0
- iack_framework-0.3.0/README.md +53 -0
- {iack_framework-0.2.0 → iack_framework-0.3.0}/pyproject.toml +4 -2
- {iack_framework-0.2.0 → iack_framework-0.3.0}/src/iack/mappings/csf_mapping.py +14 -2
- iack_framework-0.3.0/src/iack/metrics/pqc.py +260 -0
- {iack_framework-0.2.0 → iack_framework-0.3.0}/src/iack/validators/assessment_validator.py +0 -1
- iack_framework-0.3.0/src/iack_framework.egg-info/PKG-INFO +67 -0
- {iack_framework-0.2.0 → iack_framework-0.3.0}/src/iack_framework.egg-info/SOURCES.txt +3 -0
- {iack_framework-0.2.0 → iack_framework-0.3.0}/src/iack_framework.egg-info/entry_points.txt +1 -0
- iack_framework-0.3.0/tests/test_artifact_integrity.py +76 -0
- {iack_framework-0.2.0 → iack_framework-0.3.0}/tests/test_cli_smoke.py +14 -4
- {iack_framework-0.2.0 → iack_framework-0.3.0}/tests/test_csf_mapping.py +27 -3
- {iack_framework-0.2.0 → iack_framework-0.3.0}/tests/test_model.py +1 -0
- iack_framework-0.3.0/tests/test_pqc.py +151 -0
- {iack_framework-0.2.0 → iack_framework-0.3.0}/tests/test_report_writer.py +1 -2
- {iack_framework-0.2.0 → iack_framework-0.3.0}/tests/test_validator.py +2 -4
- iack_framework-0.2.0/PKG-INFO +0 -86
- iack_framework-0.2.0/README.md +0 -72
- iack_framework-0.2.0/src/iack_framework.egg-info/PKG-INFO +0 -86
- {iack_framework-0.2.0 → iack_framework-0.3.0}/LICENSE +0 -0
- {iack_framework-0.2.0 → iack_framework-0.3.0}/setup.cfg +0 -0
- {iack_framework-0.2.0 → iack_framework-0.3.0}/src/iack/__init__.py +0 -0
- {iack_framework-0.2.0 → iack_framework-0.3.0}/src/iack/mappings/__init__.py +0 -0
- {iack_framework-0.2.0 → iack_framework-0.3.0}/src/iack/metrics/__init__.py +0 -0
- {iack_framework-0.2.0 → iack_framework-0.3.0}/src/iack/metrics/model.py +0 -0
- {iack_framework-0.2.0 → iack_framework-0.3.0}/src/iack/outputs/__init__.py +0 -0
- {iack_framework-0.2.0 → iack_framework-0.3.0}/src/iack/outputs/report_writer.py +0 -0
- {iack_framework-0.2.0 → iack_framework-0.3.0}/src/iack/validators/__init__.py +0 -0
- {iack_framework-0.2.0 → iack_framework-0.3.0}/src/iack_framework.egg-info/dependency_links.txt +0 -0
- {iack_framework-0.2.0 → iack_framework-0.3.0}/src/iack_framework.egg-info/requires.txt +0 -0
- {iack_framework-0.2.0 → iack_framework-0.3.0}/src/iack_framework.egg-info/top_level.txt +0 -0
- {iack_framework-0.2.0 → iack_framework-0.3.0}/tests/test_pipeline_integration.py +0 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: iack-framework
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Integrity-Authenticity-Confidentiality-Key management cybersecurity framework
|
|
5
|
+
Author-email: Felix Cepeda <felicepeda@hotmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Provides-Extra: dev
|
|
11
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
12
|
+
Requires-Dist: ruff>=0.5.0; extra == "dev"
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# IACK Framework
|
|
16
|
+
|
|
17
|
+
**IACK** stands for **Integrity, Authenticity, Confidentiality, Key Management**: the four security properties it assesses.
|
|
18
|
+
|
|
19
|
+
*Motto: Integrate · Analyze · Collaborate · Protect.*
|
|
20
|
+
|
|
21
|
+
IACK is an open-source framework for evidence-based security assessment. Each metric has a score, a weight, a pass threshold and the evidence behind it. IACK validates that input, scores it with an explicit formula, and produces repeatable, interpretable and auditable results.
|
|
22
|
+
|
|
23
|
+
> **Limit:** results are only as accurate as the assessed values and the evidence behind them. IACK makes them transparent and checkable; it does not make them true.
|
|
24
|
+
|
|
25
|
+
See [docs/DEFINITION.md](docs/DEFINITION.md) for the full definition, what IACK does not do, and which ideas are still research.
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
```powershell
|
|
30
|
+
python -m pip install -e .
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Import
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from iack.metrics import model
|
|
37
|
+
from iack.validators import assessment_validator
|
|
38
|
+
from iack.mappings import csf_mapping
|
|
39
|
+
from iack.outputs import report_writer
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Example inputs
|
|
43
|
+
|
|
44
|
+
- `examples/assessment-input.json`
|
|
45
|
+
- `examples/expected-output.json`
|
|
46
|
+
|
|
47
|
+
## Run tests
|
|
48
|
+
|
|
49
|
+
```powershell
|
|
50
|
+
pytest
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Package layout
|
|
54
|
+
|
|
55
|
+
The package is distributed from `src/iack/` only. Legacy root-level modules are not part of the wheel.
|
|
56
|
+
|
|
57
|
+
## Command line
|
|
58
|
+
|
|
59
|
+
```powershell
|
|
60
|
+
iack-validate examples/assessment-input.json # check the input
|
|
61
|
+
iack-score examples/assessment-input.json # weighted score and per-metric results
|
|
62
|
+
iack-report examples/assessment-input.json # JSON, CSV and Markdown reports in data/output/
|
|
63
|
+
iack-map-csf examples/assessment-input.json # add NIST CSF function mapping
|
|
64
|
+
iack-pqc examples/pqc-inventory.json --weight 0.1 # post-quantum readiness metrics (Key Management)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`iack-pqc` reads a cryptographic inventory and prints three Key Management metrics: inventory coverage, harvest-now-decrypt-later exposure and post-quantum migration progress. Add them to your assessment and rebalance the weights so they sum to 1. The inventory must state its assumption for the years until a cryptographically relevant quantum computer, with a source. See [docs/DEFINITION.md](docs/DEFINITION.md#post-quantum-readiness-key-management).
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# IACK Framework
|
|
2
|
+
|
|
3
|
+
**IACK** stands for **Integrity, Authenticity, Confidentiality, Key Management**: the four security properties it assesses.
|
|
4
|
+
|
|
5
|
+
*Motto: Integrate · Analyze · Collaborate · Protect.*
|
|
6
|
+
|
|
7
|
+
IACK is an open-source framework for evidence-based security assessment. Each metric has a score, a weight, a pass threshold and the evidence behind it. IACK validates that input, scores it with an explicit formula, and produces repeatable, interpretable and auditable results.
|
|
8
|
+
|
|
9
|
+
> **Limit:** results are only as accurate as the assessed values and the evidence behind them. IACK makes them transparent and checkable; it does not make them true.
|
|
10
|
+
|
|
11
|
+
See [docs/DEFINITION.md](docs/DEFINITION.md) for the full definition, what IACK does not do, and which ideas are still research.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```powershell
|
|
16
|
+
python -m pip install -e .
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Import
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from iack.metrics import model
|
|
23
|
+
from iack.validators import assessment_validator
|
|
24
|
+
from iack.mappings import csf_mapping
|
|
25
|
+
from iack.outputs import report_writer
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Example inputs
|
|
29
|
+
|
|
30
|
+
- `examples/assessment-input.json`
|
|
31
|
+
- `examples/expected-output.json`
|
|
32
|
+
|
|
33
|
+
## Run tests
|
|
34
|
+
|
|
35
|
+
```powershell
|
|
36
|
+
pytest
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Package layout
|
|
40
|
+
|
|
41
|
+
The package is distributed from `src/iack/` only. Legacy root-level modules are not part of the wheel.
|
|
42
|
+
|
|
43
|
+
## Command line
|
|
44
|
+
|
|
45
|
+
```powershell
|
|
46
|
+
iack-validate examples/assessment-input.json # check the input
|
|
47
|
+
iack-score examples/assessment-input.json # weighted score and per-metric results
|
|
48
|
+
iack-report examples/assessment-input.json # JSON, CSV and Markdown reports in data/output/
|
|
49
|
+
iack-map-csf examples/assessment-input.json # add NIST CSF function mapping
|
|
50
|
+
iack-pqc examples/pqc-inventory.json --weight 0.1 # post-quantum readiness metrics (Key Management)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`iack-pqc` reads a cryptographic inventory and prints three Key Management metrics: inventory coverage, harvest-now-decrypt-later exposure and post-quantum migration progress. Add them to your assessment and rebalance the weights so they sum to 1. The inventory must state its assumption for the years until a cryptographically relevant quantum computer, with a source. See [docs/DEFINITION.md](docs/DEFINITION.md#post-quantum-readiness-key-management).
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "iack-framework"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.3.0"
|
|
8
8
|
description = "Integrity-Authenticity-Confidentiality-Key management cybersecurity framework"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -20,6 +20,7 @@ iack-validate = "iack.validators.assessment_validator:main"
|
|
|
20
20
|
iack-score = "iack.metrics.model:main"
|
|
21
21
|
iack-map-csf = "iack.mappings.csf_mapping:main"
|
|
22
22
|
iack-report = "iack.outputs.report_writer:main"
|
|
23
|
+
iack-pqc = "iack.metrics.pqc:main"
|
|
23
24
|
|
|
24
25
|
[project.optional-dependencies]
|
|
25
26
|
dev = [
|
|
@@ -28,6 +29,7 @@ dev = [
|
|
|
28
29
|
]
|
|
29
30
|
|
|
30
31
|
[tool.pytest.ini_options]
|
|
32
|
+
pythonpath = [".", "src"]
|
|
31
33
|
testpaths = ["tests"]
|
|
32
34
|
|
|
33
35
|
[tool.ruff]
|
|
@@ -36,4 +38,4 @@ line-length = 100
|
|
|
36
38
|
[tool.setuptools.packages.find]
|
|
37
39
|
where = ["src"]
|
|
38
40
|
include = ["iack*"]
|
|
39
|
-
namespaces = false
|
|
41
|
+
namespaces = false
|
|
@@ -4,7 +4,6 @@ from pathlib import Path
|
|
|
4
4
|
|
|
5
5
|
from iack.metrics.model import score_assessment
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
DOMAIN_TO_CSF = {
|
|
9
8
|
"confidentiality": {
|
|
10
9
|
"csf_function": "Protect",
|
|
@@ -21,6 +20,14 @@ DOMAIN_TO_CSF = {
|
|
|
21
20
|
"csf_code": "DE",
|
|
22
21
|
"rationale": "Integrity issues often require monitoring, verification, and detection of unauthorized changes."
|
|
23
22
|
},
|
|
23
|
+
"key_management": {
|
|
24
|
+
"csf_function": "Protect",
|
|
25
|
+
"csf_code": "PR",
|
|
26
|
+
"rationale": (
|
|
27
|
+
"Key lifecycle management (generation, storage, rotation, retirement) "
|
|
28
|
+
"supports data security and credential protection outcomes."
|
|
29
|
+
),
|
|
30
|
+
},
|
|
24
31
|
"governance": {
|
|
25
32
|
"csf_function": "Govern",
|
|
26
33
|
"csf_code": "GV",
|
|
@@ -34,11 +41,16 @@ DOMAIN_TO_CSF = {
|
|
|
34
41
|
}
|
|
35
42
|
|
|
36
43
|
|
|
44
|
+
def normalize_domain(domain: str) -> str:
|
|
45
|
+
"""Return the canonical domain key, e.g. "Key Management" -> "key_management"."""
|
|
46
|
+
return "_".join(str(domain).strip().lower().replace("-", " ").split())
|
|
47
|
+
|
|
48
|
+
|
|
37
49
|
def apply_csf_mapping(result: dict) -> dict:
|
|
38
50
|
mapped_results = []
|
|
39
51
|
|
|
40
52
|
for metric in result["metric_results"]:
|
|
41
|
-
domain = metric["domain"]
|
|
53
|
+
domain = normalize_domain(metric["domain"])
|
|
42
54
|
mapping = DOMAIN_TO_CSF.get(
|
|
43
55
|
domain,
|
|
44
56
|
{
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"""Post-quantum readiness metrics for the Key Management pillar.
|
|
2
|
+
|
|
3
|
+
Turns a cryptographic inventory into three IACK metrics:
|
|
4
|
+
|
|
5
|
+
- KM-PQC-01 Cryptographic inventory coverage
|
|
6
|
+
- KM-PQC-02 Harvest-now-decrypt-later (HNDL) exposure
|
|
7
|
+
- KM-PQC-03 Post-quantum migration progress
|
|
8
|
+
|
|
9
|
+
Algorithm classification follows NIST FIPS 203/204/205 (ML-KEM, ML-DSA, SLH-DSA),
|
|
10
|
+
SP 800-208 (LMS, XMSS) and NIST IR 8547, which deprecates quantum-vulnerable public-key
|
|
11
|
+
algorithms (RSA, DH, ECDH, DSA, ECDSA, EdDSA) after 2030 and disallows them after 2035.
|
|
12
|
+
Symmetric algorithms and hashes (AES, ChaCha20, SHA-2, SHA-3, HMAC) are not treated as
|
|
13
|
+
quantum-vulnerable, in line with IR 8547.
|
|
14
|
+
|
|
15
|
+
HNDL exposure uses Mosca's inequality: data protected today by a quantum-vulnerable
|
|
16
|
+
algorithm is exposed if shelf_life + migration_time > years_to_crqc. The number of years
|
|
17
|
+
until a cryptographically relevant quantum computer (CRQC) is an assumption that the
|
|
18
|
+
assessor must state, with its source. IACK does not predict it.
|
|
19
|
+
|
|
20
|
+
Limits: the metrics are only as accurate as the inventory. IACK does not discover
|
|
21
|
+
cryptography, test implementations, or verify the evidence cited for each asset.
|
|
22
|
+
"""
|
|
23
|
+
from __future__ import annotations
|
|
24
|
+
|
|
25
|
+
import argparse
|
|
26
|
+
import json
|
|
27
|
+
import re
|
|
28
|
+
import sys
|
|
29
|
+
from pathlib import Path
|
|
30
|
+
|
|
31
|
+
PQC_TOKENS = ("MLKEM", "MLDSA", "SLHDSA", "FNDSA", "HQC", "LMS", "HSS", "XMSS")
|
|
32
|
+
VULNERABLE_TOKENS = (
|
|
33
|
+
"RSA", "ECDSA", "ECDH", "EDDSA", "ED25519", "ED448", "X25519", "X448", "ECC",
|
|
34
|
+
"P256", "P384", "P521", "SECP", "BRAINPOOL", "FFDH", "DHE", "DH", "DSA",
|
|
35
|
+
)
|
|
36
|
+
SYMMETRIC_TOKENS = (
|
|
37
|
+
"AES", "CHACHA20", "SHA2", "SHA224", "SHA256", "SHA384", "SHA512", "SHA3",
|
|
38
|
+
"HMAC", "SHAKE", "KMAC",
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
CONFIDENTIALITY_USES = ("key_establishment", "encryption")
|
|
42
|
+
VALID_USES = (*CONFIDENTIALITY_USES, "signature")
|
|
43
|
+
|
|
44
|
+
CATEGORY_VULNERABLE = "quantum_vulnerable"
|
|
45
|
+
CATEGORY_HYBRID = "hybrid"
|
|
46
|
+
CATEGORY_PQC = "post_quantum"
|
|
47
|
+
CATEGORY_SYMMETRIC = "symmetric"
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def classify_algorithm(name: str) -> str | None:
|
|
51
|
+
"""Classify an algorithm name. Returns None when the name is not recognised."""
|
|
52
|
+
key = re.sub(r"[^A-Z0-9]", "", str(name).upper())
|
|
53
|
+
if not key:
|
|
54
|
+
return None
|
|
55
|
+
has_pqc = any(token in key for token in PQC_TOKENS)
|
|
56
|
+
stripped = key
|
|
57
|
+
for token in PQC_TOKENS:
|
|
58
|
+
stripped = stripped.replace(token, "")
|
|
59
|
+
has_vulnerable = any(token in stripped for token in VULNERABLE_TOKENS)
|
|
60
|
+
if has_pqc:
|
|
61
|
+
return CATEGORY_HYBRID if has_vulnerable else CATEGORY_PQC
|
|
62
|
+
if has_vulnerable:
|
|
63
|
+
return CATEGORY_VULNERABLE
|
|
64
|
+
if any(token in key for token in SYMMETRIC_TOKENS):
|
|
65
|
+
return CATEGORY_SYMMETRIC
|
|
66
|
+
return None
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _is_number(value) -> bool:
|
|
70
|
+
return isinstance(value, (int, float)) and not isinstance(value, bool)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def validate_inventory(inventory: dict) -> list[str]:
|
|
74
|
+
errors: list[str] = []
|
|
75
|
+
for field in ("inventory_id", "assessment_date", "systems_total", "assumptions", "assets"):
|
|
76
|
+
if field not in inventory:
|
|
77
|
+
errors.append(f"Missing top-level field: {field}")
|
|
78
|
+
|
|
79
|
+
total = inventory.get("systems_total")
|
|
80
|
+
if not isinstance(total, int) or isinstance(total, bool) or total < 1:
|
|
81
|
+
errors.append("systems_total must be a positive integer")
|
|
82
|
+
|
|
83
|
+
assumptions = inventory.get("assumptions") or {}
|
|
84
|
+
years = assumptions.get("years_to_crqc")
|
|
85
|
+
if not _is_number(years) or years <= 0:
|
|
86
|
+
errors.append("assumptions.years_to_crqc must be a positive number")
|
|
87
|
+
if not str(assumptions.get("source", "")).strip():
|
|
88
|
+
errors.append("assumptions.source must state where the years_to_crqc assumption comes from")
|
|
89
|
+
|
|
90
|
+
assets = inventory.get("assets")
|
|
91
|
+
if not isinstance(assets, list) or not assets:
|
|
92
|
+
errors.append("assets must be a non-empty list")
|
|
93
|
+
return errors
|
|
94
|
+
|
|
95
|
+
seen_ids: set[str] = set()
|
|
96
|
+
for index, asset in enumerate(assets, start=1):
|
|
97
|
+
label = asset.get("asset_id", f"Asset #{index}")
|
|
98
|
+
for field in ("asset_id", "system", "algorithm", "use", "evidence"):
|
|
99
|
+
if field not in asset:
|
|
100
|
+
errors.append(f"{label} missing field: {field}")
|
|
101
|
+
if asset.get("asset_id") in seen_ids:
|
|
102
|
+
errors.append(f"{label} is duplicated")
|
|
103
|
+
seen_ids.add(asset.get("asset_id"))
|
|
104
|
+
|
|
105
|
+
if "algorithm" in asset and classify_algorithm(asset["algorithm"]) is None:
|
|
106
|
+
errors.append(f"{label} algorithm not recognised: {asset['algorithm']!r}")
|
|
107
|
+
if "use" in asset and asset["use"] not in VALID_USES:
|
|
108
|
+
errors.append(f"{label} use must be one of {', '.join(VALID_USES)}")
|
|
109
|
+
if asset.get("use") in CONFIDENTIALITY_USES:
|
|
110
|
+
for field in ("data_shelf_life_years", "migration_time_years"):
|
|
111
|
+
value = asset.get(field)
|
|
112
|
+
if not _is_number(value) or value < 0:
|
|
113
|
+
errors.append(f"{label} {field} must be a number >= 0")
|
|
114
|
+
evidence = asset.get("evidence")
|
|
115
|
+
if not isinstance(evidence, list) or not evidence:
|
|
116
|
+
errors.append(f"{label} must include at least one evidence item")
|
|
117
|
+
|
|
118
|
+
if isinstance(total, int) and not isinstance(total, bool) and total >= 1:
|
|
119
|
+
systems = {a.get("system") for a in assets}
|
|
120
|
+
if len(systems) > total:
|
|
121
|
+
errors.append(f"assets cover {len(systems)} systems but systems_total is {total}")
|
|
122
|
+
|
|
123
|
+
if not any(
|
|
124
|
+
a.get("use") in CONFIDENTIALITY_USES
|
|
125
|
+
and classify_algorithm(a.get("algorithm", "")) not in (None, CATEGORY_SYMMETRIC)
|
|
126
|
+
for a in assets
|
|
127
|
+
):
|
|
128
|
+
errors.append(
|
|
129
|
+
"no public-key key_establishment or encryption assets: HNDL exposure cannot be assessed"
|
|
130
|
+
)
|
|
131
|
+
return errors
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def _evidence(assets: list[dict]) -> list[str]:
|
|
135
|
+
seen: list[str] = []
|
|
136
|
+
for asset in assets:
|
|
137
|
+
for item in asset["evidence"]:
|
|
138
|
+
if item not in seen:
|
|
139
|
+
seen.append(item)
|
|
140
|
+
return seen
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def compute_pqc_metrics(inventory: dict, weight: float, threshold: float = 0.7) -> list[dict]:
|
|
144
|
+
"""Return the three post-quantum readiness metrics in IACK assessment format.
|
|
145
|
+
|
|
146
|
+
Raises ValueError if the inventory is invalid.
|
|
147
|
+
"""
|
|
148
|
+
errors = validate_inventory(inventory)
|
|
149
|
+
if errors:
|
|
150
|
+
raise ValueError("; ".join(errors))
|
|
151
|
+
|
|
152
|
+
assets = inventory["assets"]
|
|
153
|
+
years_to_crqc = inventory["assumptions"]["years_to_crqc"]
|
|
154
|
+
category = {a["asset_id"]: classify_algorithm(a["algorithm"]) for a in assets}
|
|
155
|
+
|
|
156
|
+
public_key = [a for a in assets if category[a["asset_id"]] != CATEGORY_SYMMETRIC]
|
|
157
|
+
confidentiality = [a for a in public_key if a["use"] in CONFIDENTIALITY_USES]
|
|
158
|
+
exposed = [
|
|
159
|
+
a for a in confidentiality
|
|
160
|
+
if category[a["asset_id"]] == CATEGORY_VULNERABLE
|
|
161
|
+
and a["data_shelf_life_years"] + a["migration_time_years"] > years_to_crqc
|
|
162
|
+
]
|
|
163
|
+
migrated = [a for a in public_key if category[a["asset_id"]] in (CATEGORY_PQC, CATEGORY_HYBRID)]
|
|
164
|
+
systems = sorted({a["system"] for a in assets})
|
|
165
|
+
|
|
166
|
+
def metric(metric_id, name, score, evidence, details):
|
|
167
|
+
return {
|
|
168
|
+
"metric_id": metric_id,
|
|
169
|
+
"metric_name": name,
|
|
170
|
+
"domain": "key_management",
|
|
171
|
+
"weight": weight,
|
|
172
|
+
"threshold": threshold,
|
|
173
|
+
"confidence_rule": "evidence_count",
|
|
174
|
+
"score": round(score, 4),
|
|
175
|
+
"evidence": evidence,
|
|
176
|
+
"details": details,
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
metrics = [
|
|
180
|
+
metric(
|
|
181
|
+
"KM-PQC-01", "Cryptographic inventory coverage",
|
|
182
|
+
len(systems) / inventory["systems_total"], _evidence(assets),
|
|
183
|
+
{"systems_inventoried": len(systems), "systems_total": inventory["systems_total"]},
|
|
184
|
+
),
|
|
185
|
+
metric(
|
|
186
|
+
"KM-PQC-02", "Harvest-now-decrypt-later exposure",
|
|
187
|
+
1 - len(exposed) / len(confidentiality), _evidence(confidentiality),
|
|
188
|
+
{
|
|
189
|
+
"rule": (
|
|
190
|
+
"exposed if quantum-vulnerable and "
|
|
191
|
+
"data_shelf_life_years + migration_time_years > years_to_crqc"
|
|
192
|
+
),
|
|
193
|
+
"years_to_crqc": years_to_crqc,
|
|
194
|
+
"years_to_crqc_source": inventory["assumptions"]["source"],
|
|
195
|
+
"confidentiality_assets": len(confidentiality),
|
|
196
|
+
"exposed_assets": [a["asset_id"] for a in exposed],
|
|
197
|
+
},
|
|
198
|
+
),
|
|
199
|
+
metric(
|
|
200
|
+
"KM-PQC-03", "Post-quantum migration progress",
|
|
201
|
+
len(migrated) / len(public_key), _evidence(public_key),
|
|
202
|
+
{
|
|
203
|
+
"public_key_assets": len(public_key),
|
|
204
|
+
"post_quantum_or_hybrid": [a["asset_id"] for a in migrated],
|
|
205
|
+
"quantum_vulnerable": [
|
|
206
|
+
a["asset_id"]
|
|
207
|
+
for a in public_key
|
|
208
|
+
if category[a["asset_id"]] == CATEGORY_VULNERABLE
|
|
209
|
+
],
|
|
210
|
+
},
|
|
211
|
+
),
|
|
212
|
+
]
|
|
213
|
+
return metrics
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def main(argv: list[str] | None = None) -> int:
|
|
217
|
+
parser = argparse.ArgumentParser(
|
|
218
|
+
description="Compute IACK post-quantum readiness metrics from a cryptographic inventory."
|
|
219
|
+
)
|
|
220
|
+
parser.add_argument("inventory", help="path to the cryptographic inventory JSON")
|
|
221
|
+
parser.add_argument(
|
|
222
|
+
"--weight",
|
|
223
|
+
type=float,
|
|
224
|
+
required=True,
|
|
225
|
+
help="weight for each metric; rebalance the assessment's weights so they sum to 1",
|
|
226
|
+
)
|
|
227
|
+
parser.add_argument(
|
|
228
|
+
"--threshold", type=float, default=0.7, help="pass threshold for each metric (default 0.7)"
|
|
229
|
+
)
|
|
230
|
+
parser.add_argument("--output", help="write the metrics to this file instead of printing")
|
|
231
|
+
args = parser.parse_args(argv)
|
|
232
|
+
|
|
233
|
+
path = Path(args.inventory)
|
|
234
|
+
if not path.exists():
|
|
235
|
+
print(f"Input file not found: {path}")
|
|
236
|
+
return 1
|
|
237
|
+
if not (0 <= args.weight <= 1 and 0 <= args.threshold <= 1):
|
|
238
|
+
print("--weight and --threshold must be between 0 and 1")
|
|
239
|
+
return 1
|
|
240
|
+
|
|
241
|
+
inventory = json.loads(path.read_text(encoding="utf-8-sig"))
|
|
242
|
+
try:
|
|
243
|
+
metrics = compute_pqc_metrics(inventory, args.weight, args.threshold)
|
|
244
|
+
except ValueError as exc:
|
|
245
|
+
print("Inventory validation failed:")
|
|
246
|
+
for error in str(exc).split("; "):
|
|
247
|
+
print(f"- {error}")
|
|
248
|
+
return 1
|
|
249
|
+
|
|
250
|
+
text = json.dumps(metrics, indent=2)
|
|
251
|
+
if args.output:
|
|
252
|
+
Path(args.output).write_text(text + "\n", encoding="utf-8")
|
|
253
|
+
print(f"Wrote: {args.output}")
|
|
254
|
+
else:
|
|
255
|
+
print(text)
|
|
256
|
+
return 0
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
if __name__ == "__main__":
|
|
260
|
+
sys.exit(main())
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: iack-framework
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Integrity-Authenticity-Confidentiality-Key management cybersecurity framework
|
|
5
|
+
Author-email: Felix Cepeda <felicepeda@hotmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Provides-Extra: dev
|
|
11
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
12
|
+
Requires-Dist: ruff>=0.5.0; extra == "dev"
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# IACK Framework
|
|
16
|
+
|
|
17
|
+
**IACK** stands for **Integrity, Authenticity, Confidentiality, Key Management**: the four security properties it assesses.
|
|
18
|
+
|
|
19
|
+
*Motto: Integrate · Analyze · Collaborate · Protect.*
|
|
20
|
+
|
|
21
|
+
IACK is an open-source framework for evidence-based security assessment. Each metric has a score, a weight, a pass threshold and the evidence behind it. IACK validates that input, scores it with an explicit formula, and produces repeatable, interpretable and auditable results.
|
|
22
|
+
|
|
23
|
+
> **Limit:** results are only as accurate as the assessed values and the evidence behind them. IACK makes them transparent and checkable; it does not make them true.
|
|
24
|
+
|
|
25
|
+
See [docs/DEFINITION.md](docs/DEFINITION.md) for the full definition, what IACK does not do, and which ideas are still research.
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
```powershell
|
|
30
|
+
python -m pip install -e .
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Import
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from iack.metrics import model
|
|
37
|
+
from iack.validators import assessment_validator
|
|
38
|
+
from iack.mappings import csf_mapping
|
|
39
|
+
from iack.outputs import report_writer
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Example inputs
|
|
43
|
+
|
|
44
|
+
- `examples/assessment-input.json`
|
|
45
|
+
- `examples/expected-output.json`
|
|
46
|
+
|
|
47
|
+
## Run tests
|
|
48
|
+
|
|
49
|
+
```powershell
|
|
50
|
+
pytest
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Package layout
|
|
54
|
+
|
|
55
|
+
The package is distributed from `src/iack/` only. Legacy root-level modules are not part of the wheel.
|
|
56
|
+
|
|
57
|
+
## Command line
|
|
58
|
+
|
|
59
|
+
```powershell
|
|
60
|
+
iack-validate examples/assessment-input.json # check the input
|
|
61
|
+
iack-score examples/assessment-input.json # weighted score and per-metric results
|
|
62
|
+
iack-report examples/assessment-input.json # JSON, CSV and Markdown reports in data/output/
|
|
63
|
+
iack-map-csf examples/assessment-input.json # add NIST CSF function mapping
|
|
64
|
+
iack-pqc examples/pqc-inventory.json --weight 0.1 # post-quantum readiness metrics (Key Management)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`iack-pqc` reads a cryptographic inventory and prints three Key Management metrics: inventory coverage, harvest-now-decrypt-later exposure and post-quantum migration progress. Add them to your assessment and rebalance the weights so they sum to 1. The inventory must state its assumption for the years until a cryptographically relevant quantum computer, with a source. See [docs/DEFINITION.md](docs/DEFINITION.md#post-quantum-readiness-key-management).
|
|
@@ -6,6 +6,7 @@ src/iack/mappings/__init__.py
|
|
|
6
6
|
src/iack/mappings/csf_mapping.py
|
|
7
7
|
src/iack/metrics/__init__.py
|
|
8
8
|
src/iack/metrics/model.py
|
|
9
|
+
src/iack/metrics/pqc.py
|
|
9
10
|
src/iack/outputs/__init__.py
|
|
10
11
|
src/iack/outputs/report_writer.py
|
|
11
12
|
src/iack/validators/__init__.py
|
|
@@ -16,9 +17,11 @@ src/iack_framework.egg-info/dependency_links.txt
|
|
|
16
17
|
src/iack_framework.egg-info/entry_points.txt
|
|
17
18
|
src/iack_framework.egg-info/requires.txt
|
|
18
19
|
src/iack_framework.egg-info/top_level.txt
|
|
20
|
+
tests/test_artifact_integrity.py
|
|
19
21
|
tests/test_cli_smoke.py
|
|
20
22
|
tests/test_csf_mapping.py
|
|
21
23
|
tests/test_model.py
|
|
22
24
|
tests/test_pipeline_integration.py
|
|
25
|
+
tests/test_pqc.py
|
|
23
26
|
tests/test_report_writer.py
|
|
24
27
|
tests/test_validator.py
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import importlib.util
|
|
2
|
+
import json
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
SCRIPT = Path(__file__).resolve().parents[1] / "scripts" / "verify-artifacts.py"
|
|
6
|
+
spec = importlib.util.spec_from_file_location("verify_artifacts", SCRIPT)
|
|
7
|
+
verify_artifacts = importlib.util.module_from_spec(spec)
|
|
8
|
+
spec.loader.exec_module(verify_artifacts)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def make_artifacts(root: Path) -> None:
|
|
12
|
+
for index, artifact in enumerate(verify_artifacts.ARTIFACTS):
|
|
13
|
+
path = root / artifact
|
|
14
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
15
|
+
path.write_text(f'{{"artifact": {index}}}\n', encoding="utf-8")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_written_manifest_verifies(tmp_path):
|
|
19
|
+
make_artifacts(tmp_path)
|
|
20
|
+
assert verify_artifacts.write_manifest(tmp_path) == []
|
|
21
|
+
assert verify_artifacts.verify_manifest(tmp_path) == []
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_manifest_uses_relative_paths(tmp_path):
|
|
25
|
+
make_artifacts(tmp_path)
|
|
26
|
+
verify_artifacts.write_manifest(tmp_path)
|
|
27
|
+
manifest = (tmp_path / verify_artifacts.MANIFEST).read_text(encoding="utf-8")
|
|
28
|
+
assert str(tmp_path) not in manifest
|
|
29
|
+
assert "outputs/metrics-output.json" in manifest
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def test_modified_artifact_fails(tmp_path):
|
|
33
|
+
make_artifacts(tmp_path)
|
|
34
|
+
verify_artifacts.write_manifest(tmp_path)
|
|
35
|
+
target = tmp_path / verify_artifacts.ARTIFACTS[1]
|
|
36
|
+
target.write_text('{"artifact": "tampered"}\n', encoding="utf-8")
|
|
37
|
+
errors = verify_artifacts.verify_manifest(tmp_path)
|
|
38
|
+
assert errors == [f"hash mismatch: {verify_artifacts.ARTIFACTS[1].as_posix()}"]
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def test_missing_artifact_fails(tmp_path):
|
|
42
|
+
make_artifacts(tmp_path)
|
|
43
|
+
verify_artifacts.write_manifest(tmp_path)
|
|
44
|
+
(tmp_path / verify_artifacts.ARTIFACTS[0]).unlink()
|
|
45
|
+
errors = verify_artifacts.verify_manifest(tmp_path)
|
|
46
|
+
assert errors == [f"missing artifact: {verify_artifacts.ARTIFACTS[0].as_posix()}"]
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def test_missing_manifest_fails(tmp_path):
|
|
50
|
+
make_artifacts(tmp_path)
|
|
51
|
+
errors = verify_artifacts.verify_manifest(tmp_path)
|
|
52
|
+
assert errors and errors[0].startswith("manifest not found")
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def test_line_endings_do_not_change_hash(tmp_path):
|
|
56
|
+
lf = tmp_path / "lf.json"
|
|
57
|
+
crlf = tmp_path / "crlf.json"
|
|
58
|
+
lf.write_bytes(b'{\n "a": 1\n}\n')
|
|
59
|
+
crlf.write_bytes(b'{\r\n "a": 1\r\n}\r\n')
|
|
60
|
+
assert verify_artifacts.file_hash(lf) == verify_artifacts.file_hash(crlf)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def test_repository_artifacts_match_manifest():
|
|
64
|
+
assert verify_artifacts.verify_manifest() == []
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def test_generate_metrics_has_no_hardcoded_scores():
|
|
68
|
+
source = (SCRIPT.parent / "generate-metrics.py").read_text(encoding="utf-8")
|
|
69
|
+
assert "IACK_INTEGRITY_SCORE_PATCH" not in source
|
|
70
|
+
assert "max(domain_scores" not in source
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def test_mitre_mapping_uses_validated_or_review():
|
|
74
|
+
path = SCRIPT.parents[1] / "assets" / "data" / "iack-mitre-mapping.json"
|
|
75
|
+
mapping = json.loads(path.read_text(encoding="utf-8-sig"))
|
|
76
|
+
assert {item["status"] for item in mapping["items"]} <= {"Validated", "Review"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import json
|
|
2
|
+
import os
|
|
2
3
|
import subprocess
|
|
3
4
|
import sys
|
|
5
|
+
from pathlib import Path
|
|
4
6
|
|
|
5
7
|
|
|
6
8
|
def make_valid_assessment():
|
|
@@ -50,11 +52,16 @@ def test_cli_smoke_pipeline(tmp_path):
|
|
|
50
52
|
input_file = tmp_path / "assessment.json"
|
|
51
53
|
input_file.write_text(json.dumps(make_valid_assessment()), encoding="utf-8")
|
|
52
54
|
|
|
55
|
+
env = dict(os.environ)
|
|
56
|
+
repo_root = str(Path(__file__).resolve().parents[1])
|
|
57
|
+
env["PYTHONPATH"] = repo_root + (os.pathsep + env["PYTHONPATH"] if env.get("PYTHONPATH") else "")
|
|
58
|
+
|
|
53
59
|
result_validator = subprocess.run(
|
|
54
60
|
[sys.executable, "-m", "iack.validators.assessment_validator", str(input_file)],
|
|
55
61
|
capture_output=True,
|
|
56
62
|
text=True,
|
|
57
|
-
cwd=tmp_path
|
|
63
|
+
cwd=tmp_path,
|
|
64
|
+
check=False,
|
|
58
65
|
)
|
|
59
66
|
assert result_validator.returncode == 0
|
|
60
67
|
assert "Validation passed." in result_validator.stdout
|
|
@@ -63,7 +70,8 @@ def test_cli_smoke_pipeline(tmp_path):
|
|
|
63
70
|
[sys.executable, "-m", "iack.metrics.model", str(input_file)],
|
|
64
71
|
capture_output=True,
|
|
65
72
|
text=True,
|
|
66
|
-
cwd=tmp_path
|
|
73
|
+
cwd=tmp_path,
|
|
74
|
+
check=False,
|
|
67
75
|
)
|
|
68
76
|
assert result_model.returncode == 0
|
|
69
77
|
assert '"assessment_id": "IACK-SMOKE-0001"' in result_model.stdout
|
|
@@ -72,7 +80,8 @@ def test_cli_smoke_pipeline(tmp_path):
|
|
|
72
80
|
[sys.executable, "-m", "iack.mappings.csf_mapping", str(input_file)],
|
|
73
81
|
capture_output=True,
|
|
74
82
|
text=True,
|
|
75
|
-
cwd=tmp_path
|
|
83
|
+
cwd=tmp_path,
|
|
84
|
+
check=False,
|
|
76
85
|
)
|
|
77
86
|
assert result_mapping.returncode == 0
|
|
78
87
|
assert "assessment_result_mapped.json" in result_mapping.stdout
|
|
@@ -81,7 +90,8 @@ def test_cli_smoke_pipeline(tmp_path):
|
|
|
81
90
|
[sys.executable, "-m", "iack.outputs.report_writer", str(input_file)],
|
|
82
91
|
capture_output=True,
|
|
83
92
|
text=True,
|
|
84
|
-
cwd=tmp_path
|
|
93
|
+
cwd=tmp_path,
|
|
94
|
+
check=False,
|
|
85
95
|
)
|
|
86
96
|
assert result_report.returncode == 0
|
|
87
97
|
assert "assessment_result.json" in result_report.stdout
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
from iack.mappings.csf_mapping import DOMAIN_TO_CSF, apply_csf_mapping, main, normalize_domain
|
|
2
4
|
|
|
3
5
|
|
|
4
6
|
def make_scored_result():
|
|
@@ -112,8 +114,6 @@ def test_apply_csf_mapping_uses_default_mapping_for_unknown_domain():
|
|
|
112
114
|
assert unknown_metric["csf_code"] == "ID"
|
|
113
115
|
assert "Default mapping used" in unknown_metric["rationale"]
|
|
114
116
|
|
|
115
|
-
import json
|
|
116
|
-
from iack.mappings.csf_mapping import main
|
|
117
117
|
|
|
118
118
|
|
|
119
119
|
def make_input_assessment():
|
|
@@ -190,3 +190,27 @@ def test_csf_mapping_main_writes_expected_file(monkeypatch, capsys, tmp_path):
|
|
|
190
190
|
assert rc == 0
|
|
191
191
|
assert "assessment_result_mapped.json" in captured.out
|
|
192
192
|
assert (tmp_path / "data" / "output" / "assessment_result_mapped.json").exists()
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def test_every_pillar_has_a_csf_mapping():
|
|
196
|
+
for pillar in ("integrity", "authenticity", "confidentiality", "key_management"):
|
|
197
|
+
assert pillar in DOMAIN_TO_CSF
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def test_key_management_maps_to_protect():
|
|
201
|
+
result = make_scored_result()
|
|
202
|
+
result["metric_results"][0]["domain"] = "key_management"
|
|
203
|
+
mapped = apply_csf_mapping(result)
|
|
204
|
+
assert mapped["metric_results"][0]["csf_function"] == "Protect"
|
|
205
|
+
assert "Default mapping" not in mapped["metric_results"][0]["rationale"]
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def test_domain_names_are_normalized():
|
|
209
|
+
assert normalize_domain("Key Management") == "key_management"
|
|
210
|
+
assert normalize_domain(" key-management ") == "key_management"
|
|
211
|
+
assert normalize_domain("Integrity") == "integrity"
|
|
212
|
+
|
|
213
|
+
result = make_scored_result()
|
|
214
|
+
result["metric_results"][0]["domain"] = "Key Management"
|
|
215
|
+
mapped = apply_csf_mapping(result)
|
|
216
|
+
assert mapped["metric_results"][0]["csf_function"] == "Protect"
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import copy
|
|
2
|
+
import json
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
from iack.metrics.model import score_assessment
|
|
8
|
+
from iack.metrics.pqc import (
|
|
9
|
+
CATEGORY_HYBRID,
|
|
10
|
+
CATEGORY_PQC,
|
|
11
|
+
CATEGORY_SYMMETRIC,
|
|
12
|
+
CATEGORY_VULNERABLE,
|
|
13
|
+
classify_algorithm,
|
|
14
|
+
compute_pqc_metrics,
|
|
15
|
+
main,
|
|
16
|
+
validate_inventory,
|
|
17
|
+
)
|
|
18
|
+
from iack.validators.assessment_validator import validate_assessment
|
|
19
|
+
|
|
20
|
+
EXAMPLE = Path(__file__).resolve().parents[1] / "examples" / "pqc-inventory.json"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def load_example():
|
|
24
|
+
return json.loads(EXAMPLE.read_text(encoding="utf-8"))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@pytest.mark.parametrize(
|
|
28
|
+
("name", "expected"),
|
|
29
|
+
[
|
|
30
|
+
("RSA-2048", CATEGORY_VULNERABLE),
|
|
31
|
+
("RSA-OAEP-3072", CATEGORY_VULNERABLE),
|
|
32
|
+
("ECDHE-X25519", CATEGORY_VULNERABLE),
|
|
33
|
+
("ECDSA P-256", CATEGORY_VULNERABLE),
|
|
34
|
+
("Ed25519", CATEGORY_VULNERABLE),
|
|
35
|
+
("secp384r1", CATEGORY_VULNERABLE),
|
|
36
|
+
("FFDHE2048", CATEGORY_VULNERABLE),
|
|
37
|
+
("DSA-2048", CATEGORY_VULNERABLE),
|
|
38
|
+
("ML-KEM-768", CATEGORY_PQC),
|
|
39
|
+
("ML-DSA-65", CATEGORY_PQC),
|
|
40
|
+
("SLH-DSA-SHA2-128s", CATEGORY_PQC),
|
|
41
|
+
("FN-DSA-512", CATEGORY_PQC),
|
|
42
|
+
("LMS", CATEGORY_PQC),
|
|
43
|
+
("XMSS", CATEGORY_PQC),
|
|
44
|
+
("X25519MLKEM768", CATEGORY_HYBRID),
|
|
45
|
+
("ECDSA-P256+ML-DSA-44", CATEGORY_HYBRID),
|
|
46
|
+
("AES-256-GCM", CATEGORY_SYMMETRIC),
|
|
47
|
+
("ChaCha20-Poly1305", CATEGORY_SYMMETRIC),
|
|
48
|
+
("HMAC-SHA256", CATEGORY_SYMMETRIC),
|
|
49
|
+
("SuperCrypt-9000", None),
|
|
50
|
+
("", None),
|
|
51
|
+
],
|
|
52
|
+
)
|
|
53
|
+
def test_classify_algorithm(name, expected):
|
|
54
|
+
assert classify_algorithm(name) == expected
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def test_example_inventory_scores():
|
|
58
|
+
metrics = {m["metric_id"]: m for m in compute_pqc_metrics(load_example(), weight=0.1)}
|
|
59
|
+
|
|
60
|
+
# 6 distinct systems inventoried out of 8
|
|
61
|
+
assert metrics["KM-PQC-01"]["score"] == round(6 / 8, 4)
|
|
62
|
+
# A-01, A-02, A-03 are public-key confidentiality assets; only A-02 is exposed (25 + 3 > 15)
|
|
63
|
+
assert metrics["KM-PQC-02"]["score"] == round(1 - 1 / 3, 4)
|
|
64
|
+
assert metrics["KM-PQC-02"]["details"]["exposed_assets"] == ["A-02"]
|
|
65
|
+
# 5 public-key assets; A-03 (hybrid) and A-05 (ML-DSA) are migrated
|
|
66
|
+
assert metrics["KM-PQC-03"]["score"] == round(2 / 5, 4)
|
|
67
|
+
|
|
68
|
+
for metric in metrics.values():
|
|
69
|
+
assert metric["domain"] == "key_management"
|
|
70
|
+
assert metric["evidence"]
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def test_symmetric_assets_are_not_counted_as_exposed():
|
|
74
|
+
metrics = compute_pqc_metrics(load_example(), weight=0.1)
|
|
75
|
+
hndl = next(m for m in metrics if m["metric_id"] == "KM-PQC-02")
|
|
76
|
+
assert "A-06" not in hndl["details"]["exposed_assets"]
|
|
77
|
+
assert hndl["details"]["confidentiality_assets"] == 3
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def test_mosca_boundary_is_not_exposed():
|
|
81
|
+
inventory = load_example()
|
|
82
|
+
inventory["assets"][1]["data_shelf_life_years"] = 12 # 12 + 3 == 15, not greater
|
|
83
|
+
hndl = compute_pqc_metrics(inventory, weight=0.1)[1]
|
|
84
|
+
assert hndl["details"]["exposed_assets"] == []
|
|
85
|
+
assert hndl["score"] == 1.0
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def test_input_is_not_modified():
|
|
89
|
+
inventory = load_example()
|
|
90
|
+
before = copy.deepcopy(inventory)
|
|
91
|
+
compute_pqc_metrics(inventory, weight=0.1)
|
|
92
|
+
assert inventory == before
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def test_assumption_source_is_required():
|
|
96
|
+
inventory = load_example()
|
|
97
|
+
inventory["assumptions"]["source"] = " "
|
|
98
|
+
assert any("source" in e for e in validate_inventory(inventory))
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def test_unknown_algorithm_is_rejected():
|
|
102
|
+
inventory = load_example()
|
|
103
|
+
inventory["assets"][0]["algorithm"] = "SuperCrypt-9000"
|
|
104
|
+
with pytest.raises(ValueError, match="not recognised"):
|
|
105
|
+
compute_pqc_metrics(inventory, weight=0.1)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def test_more_systems_than_total_is_rejected():
|
|
109
|
+
inventory = load_example()
|
|
110
|
+
inventory["systems_total"] = 3
|
|
111
|
+
assert any("systems_total" in e for e in validate_inventory(inventory))
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def test_missing_lifetimes_for_confidentiality_asset_is_rejected():
|
|
115
|
+
inventory = load_example()
|
|
116
|
+
del inventory["assets"][0]["migration_time_years"]
|
|
117
|
+
assert any("migration_time_years" in e for e in validate_inventory(inventory))
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def test_inventory_without_confidentiality_assets_is_rejected():
|
|
121
|
+
inventory = load_example()
|
|
122
|
+
inventory["assets"] = [a for a in inventory["assets"] if a["use"] == "signature"]
|
|
123
|
+
assert any("HNDL exposure cannot be assessed" in e for e in validate_inventory(inventory))
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def test_metrics_fit_a_valid_assessment():
|
|
127
|
+
assessment = json.loads(
|
|
128
|
+
(EXAMPLE.parent / "assessment-input.json").read_text(encoding="utf-8-sig")
|
|
129
|
+
)
|
|
130
|
+
for metric in assessment["metrics"]:
|
|
131
|
+
metric["weight"] = 0.175 # 4 x 0.175 = 0.70
|
|
132
|
+
assessment["metrics"].extend(compute_pqc_metrics(load_example(), weight=0.1)) # 3 x 0.1 = 0.30
|
|
133
|
+
assert validate_assessment(assessment) == []
|
|
134
|
+
result = score_assessment(assessment)
|
|
135
|
+
assert len(result["metric_results"]) == 7
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def test_cli_writes_metrics(tmp_path, capsys):
|
|
139
|
+
output = tmp_path / "pqc-metrics.json"
|
|
140
|
+
assert main([str(EXAMPLE), "--weight", "0.1", "--output", str(output)]) == 0
|
|
141
|
+
metrics = json.loads(output.read_text(encoding="utf-8"))
|
|
142
|
+
assert [m["metric_id"] for m in metrics] == ["KM-PQC-01", "KM-PQC-02", "KM-PQC-03"]
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def test_cli_reports_validation_errors(tmp_path, capsys):
|
|
146
|
+
inventory = load_example()
|
|
147
|
+
inventory["assumptions"]["years_to_crqc"] = 0
|
|
148
|
+
path = tmp_path / "bad.json"
|
|
149
|
+
path.write_text(json.dumps(inventory), encoding="utf-8")
|
|
150
|
+
assert main([str(path), "--weight", "0.1"]) == 1
|
|
151
|
+
assert "years_to_crqc" in capsys.readouterr().out
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import csv
|
|
2
2
|
import json
|
|
3
3
|
|
|
4
|
-
from iack.outputs.report_writer import write_csv, write_json, write_markdown
|
|
4
|
+
from iack.outputs.report_writer import main, write_csv, write_json, write_markdown
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
def make_result():
|
|
@@ -89,7 +89,6 @@ def test_write_markdown_creates_expected_sections(tmp_path):
|
|
|
89
89
|
assert "| Metric ID | Metric Name | Domain | Score | Threshold | Passed | Confidence | Evidence Count |" in content
|
|
90
90
|
assert "| CONF-001 | Confidentiality Control Strength | confidentiality | 0.82 | 0.7 | True | high | 3 |" in content
|
|
91
91
|
|
|
92
|
-
from iack.outputs.report_writer import main
|
|
93
92
|
|
|
94
93
|
|
|
95
94
|
def make_input_assessment():
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import json
|
|
2
2
|
|
|
3
|
-
from iack.validators.assessment_validator import validate_assessment
|
|
3
|
+
from iack.validators.assessment_validator import main, validate_assessment
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
def make_valid_assessment():
|
|
@@ -116,8 +116,6 @@ def test_validate_assessment_rejects_non_list_evidence():
|
|
|
116
116
|
result = validate_assessment(data)
|
|
117
117
|
assert "AUTH-001 evidence must be a list" in result
|
|
118
118
|
|
|
119
|
-
import json
|
|
120
|
-
from iack.validators.assessment_validator import main
|
|
121
119
|
|
|
122
120
|
|
|
123
121
|
def test_validator_main_returns_1_when_no_args(monkeypatch, capsys):
|
iack_framework-0.2.0/PKG-INFO
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: iack-framework
|
|
3
|
-
Version: 0.2.0
|
|
4
|
-
Summary: Integrity-Authenticity-Confidentiality-Key management cybersecurity framework
|
|
5
|
-
Author-email: Felix Cepeda <felicepeda@hotmail.com>
|
|
6
|
-
License-Expression: MIT
|
|
7
|
-
Requires-Python: >=3.11
|
|
8
|
-
Description-Content-Type: text/markdown
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
Provides-Extra: dev
|
|
11
|
-
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
12
|
-
Requires-Dist: ruff>=0.5.0; extra == "dev"
|
|
13
|
-
Dynamic: license-file
|
|
14
|
-
|
|
15
|
-
# IACK Framework
|
|
16
|
-
|
|
17
|
-
IACK is an Integrity-Authenticity-Confidentiality-Key management framework for cybersecurity assessment and validation.
|
|
18
|
-
|
|
19
|
-
## Install
|
|
20
|
-
|
|
21
|
-
```powershell
|
|
22
|
-
python -m pip install -e .
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## CLI usage
|
|
26
|
-
|
|
27
|
-
The IACK package exposes four CLI commands for validation, scoring, CSF mapping, and report generation.
|
|
28
|
-
|
|
29
|
-
```powershell
|
|
30
|
-
python -m pip install -e .
|
|
31
|
-
iack-validate .\examples\assessment-input.json
|
|
32
|
-
iack-score .\examples\assessment-input.json
|
|
33
|
-
iack-map-csf .\examples\assessment-input.json
|
|
34
|
-
iack-report .\examples\assessment-input.json
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### Output files
|
|
38
|
-
|
|
39
|
-
- `data/output/assessment_result.json`
|
|
40
|
-
- `data/output/assessment_result.csv`
|
|
41
|
-
- `data/output/assessment_result.md`
|
|
42
|
-
- `data/output/assessment_result_mapped.json`
|
|
43
|
-
|
|
44
|
-
## Assessment flow
|
|
45
|
-
|
|
46
|
-
```python
|
|
47
|
-
import json
|
|
48
|
-
from pathlib import Path
|
|
49
|
-
|
|
50
|
-
from iack.validators.assessment_validator import validate_assessment
|
|
51
|
-
from iack.metrics.model import score_assessment
|
|
52
|
-
from iack.mappings.csf_mapping import apply_csf_mapping
|
|
53
|
-
from iack.outputs.report_writer import write_json, write_csv, write_markdown
|
|
54
|
-
|
|
55
|
-
input_path = Path("examples/assessment-input.json")
|
|
56
|
-
data = json.loads(input_path.read_text(encoding="utf-8-sig"))
|
|
57
|
-
|
|
58
|
-
errors = validate_assessment(data)
|
|
59
|
-
if errors:
|
|
60
|
-
raise ValueError(f"Assessment validation failed: {errors}")
|
|
61
|
-
|
|
62
|
-
result = score_assessment(data)
|
|
63
|
-
mapped_result = apply_csf_mapping(result)
|
|
64
|
-
|
|
65
|
-
output_dir = Path("data/output")
|
|
66
|
-
output_dir.mkdir(parents=True, exist_ok=True)
|
|
67
|
-
|
|
68
|
-
write_json(output_dir / "assessment_result.json", mapped_result)
|
|
69
|
-
write_csv(output_dir / "assessment_result.csv", mapped_result["metric_results"])
|
|
70
|
-
write_markdown(output_dir / "assessment_result.md", mapped_result)
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Example inputs
|
|
74
|
-
|
|
75
|
-
- `examples/assessment-input.json`
|
|
76
|
-
- `examples/expected-output.json`
|
|
77
|
-
|
|
78
|
-
## Run tests
|
|
79
|
-
|
|
80
|
-
```powershell
|
|
81
|
-
pytest
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Package layout
|
|
85
|
-
|
|
86
|
-
The installable package lives under `src/iack/`. Root-level files such as `README.md`, `pyproject.toml`, `tests/`, and `examples/` support packaging, documentation, and validation.
|
iack_framework-0.2.0/README.md
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# IACK Framework
|
|
2
|
-
|
|
3
|
-
IACK is an Integrity-Authenticity-Confidentiality-Key management framework for cybersecurity assessment and validation.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```powershell
|
|
8
|
-
python -m pip install -e .
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## CLI usage
|
|
12
|
-
|
|
13
|
-
The IACK package exposes four CLI commands for validation, scoring, CSF mapping, and report generation.
|
|
14
|
-
|
|
15
|
-
```powershell
|
|
16
|
-
python -m pip install -e .
|
|
17
|
-
iack-validate .\examples\assessment-input.json
|
|
18
|
-
iack-score .\examples\assessment-input.json
|
|
19
|
-
iack-map-csf .\examples\assessment-input.json
|
|
20
|
-
iack-report .\examples\assessment-input.json
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### Output files
|
|
24
|
-
|
|
25
|
-
- `data/output/assessment_result.json`
|
|
26
|
-
- `data/output/assessment_result.csv`
|
|
27
|
-
- `data/output/assessment_result.md`
|
|
28
|
-
- `data/output/assessment_result_mapped.json`
|
|
29
|
-
|
|
30
|
-
## Assessment flow
|
|
31
|
-
|
|
32
|
-
```python
|
|
33
|
-
import json
|
|
34
|
-
from pathlib import Path
|
|
35
|
-
|
|
36
|
-
from iack.validators.assessment_validator import validate_assessment
|
|
37
|
-
from iack.metrics.model import score_assessment
|
|
38
|
-
from iack.mappings.csf_mapping import apply_csf_mapping
|
|
39
|
-
from iack.outputs.report_writer import write_json, write_csv, write_markdown
|
|
40
|
-
|
|
41
|
-
input_path = Path("examples/assessment-input.json")
|
|
42
|
-
data = json.loads(input_path.read_text(encoding="utf-8-sig"))
|
|
43
|
-
|
|
44
|
-
errors = validate_assessment(data)
|
|
45
|
-
if errors:
|
|
46
|
-
raise ValueError(f"Assessment validation failed: {errors}")
|
|
47
|
-
|
|
48
|
-
result = score_assessment(data)
|
|
49
|
-
mapped_result = apply_csf_mapping(result)
|
|
50
|
-
|
|
51
|
-
output_dir = Path("data/output")
|
|
52
|
-
output_dir.mkdir(parents=True, exist_ok=True)
|
|
53
|
-
|
|
54
|
-
write_json(output_dir / "assessment_result.json", mapped_result)
|
|
55
|
-
write_csv(output_dir / "assessment_result.csv", mapped_result["metric_results"])
|
|
56
|
-
write_markdown(output_dir / "assessment_result.md", mapped_result)
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Example inputs
|
|
60
|
-
|
|
61
|
-
- `examples/assessment-input.json`
|
|
62
|
-
- `examples/expected-output.json`
|
|
63
|
-
|
|
64
|
-
## Run tests
|
|
65
|
-
|
|
66
|
-
```powershell
|
|
67
|
-
pytest
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Package layout
|
|
71
|
-
|
|
72
|
-
The installable package lives under `src/iack/`. Root-level files such as `README.md`, `pyproject.toml`, `tests/`, and `examples/` support packaging, documentation, and validation.
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: iack-framework
|
|
3
|
-
Version: 0.2.0
|
|
4
|
-
Summary: Integrity-Authenticity-Confidentiality-Key management cybersecurity framework
|
|
5
|
-
Author-email: Felix Cepeda <felicepeda@hotmail.com>
|
|
6
|
-
License-Expression: MIT
|
|
7
|
-
Requires-Python: >=3.11
|
|
8
|
-
Description-Content-Type: text/markdown
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
Provides-Extra: dev
|
|
11
|
-
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
12
|
-
Requires-Dist: ruff>=0.5.0; extra == "dev"
|
|
13
|
-
Dynamic: license-file
|
|
14
|
-
|
|
15
|
-
# IACK Framework
|
|
16
|
-
|
|
17
|
-
IACK is an Integrity-Authenticity-Confidentiality-Key management framework for cybersecurity assessment and validation.
|
|
18
|
-
|
|
19
|
-
## Install
|
|
20
|
-
|
|
21
|
-
```powershell
|
|
22
|
-
python -m pip install -e .
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## CLI usage
|
|
26
|
-
|
|
27
|
-
The IACK package exposes four CLI commands for validation, scoring, CSF mapping, and report generation.
|
|
28
|
-
|
|
29
|
-
```powershell
|
|
30
|
-
python -m pip install -e .
|
|
31
|
-
iack-validate .\examples\assessment-input.json
|
|
32
|
-
iack-score .\examples\assessment-input.json
|
|
33
|
-
iack-map-csf .\examples\assessment-input.json
|
|
34
|
-
iack-report .\examples\assessment-input.json
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### Output files
|
|
38
|
-
|
|
39
|
-
- `data/output/assessment_result.json`
|
|
40
|
-
- `data/output/assessment_result.csv`
|
|
41
|
-
- `data/output/assessment_result.md`
|
|
42
|
-
- `data/output/assessment_result_mapped.json`
|
|
43
|
-
|
|
44
|
-
## Assessment flow
|
|
45
|
-
|
|
46
|
-
```python
|
|
47
|
-
import json
|
|
48
|
-
from pathlib import Path
|
|
49
|
-
|
|
50
|
-
from iack.validators.assessment_validator import validate_assessment
|
|
51
|
-
from iack.metrics.model import score_assessment
|
|
52
|
-
from iack.mappings.csf_mapping import apply_csf_mapping
|
|
53
|
-
from iack.outputs.report_writer import write_json, write_csv, write_markdown
|
|
54
|
-
|
|
55
|
-
input_path = Path("examples/assessment-input.json")
|
|
56
|
-
data = json.loads(input_path.read_text(encoding="utf-8-sig"))
|
|
57
|
-
|
|
58
|
-
errors = validate_assessment(data)
|
|
59
|
-
if errors:
|
|
60
|
-
raise ValueError(f"Assessment validation failed: {errors}")
|
|
61
|
-
|
|
62
|
-
result = score_assessment(data)
|
|
63
|
-
mapped_result = apply_csf_mapping(result)
|
|
64
|
-
|
|
65
|
-
output_dir = Path("data/output")
|
|
66
|
-
output_dir.mkdir(parents=True, exist_ok=True)
|
|
67
|
-
|
|
68
|
-
write_json(output_dir / "assessment_result.json", mapped_result)
|
|
69
|
-
write_csv(output_dir / "assessment_result.csv", mapped_result["metric_results"])
|
|
70
|
-
write_markdown(output_dir / "assessment_result.md", mapped_result)
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Example inputs
|
|
74
|
-
|
|
75
|
-
- `examples/assessment-input.json`
|
|
76
|
-
- `examples/expected-output.json`
|
|
77
|
-
|
|
78
|
-
## Run tests
|
|
79
|
-
|
|
80
|
-
```powershell
|
|
81
|
-
pytest
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Package layout
|
|
85
|
-
|
|
86
|
-
The installable package lives under `src/iack/`. Root-level files such as `README.md`, `pyproject.toml`, `tests/`, and `examples/` support packaging, documentation, and validation.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{iack_framework-0.2.0 → iack_framework-0.3.0}/src/iack_framework.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|