feat: Implement DefaultCryptoHmac for compliance-aware HMAC operations
- Added DefaultCryptoHmac class implementing ICryptoHmac interface. - Introduced purpose-based HMAC computation methods. - Implemented verification methods for HMACs with constant-time comparison. - Created HmacAlgorithms and HmacPurpose classes for well-known identifiers. - Added compliance profile support for HMAC algorithms. - Included asynchronous methods for HMAC computation from streams.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
9408221415b389f6dad1c235de160e88721555b406ab0e2bdbfa3119c6696a4d README.md
|
||||
96926cd81dfb6ff02d62d1fde5d7b2b7b5b3950e50eb651e51b8ae3042ac9506 risk-api-samples.json
|
||||
|
||||
61
docs/risk/samples/api/risk-api-samples.json
Normal file
61
docs/risk/samples/api/risk-api-samples.json
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"submit_job_request": {
|
||||
"method": "POST",
|
||||
"path": "/api/v1/risk/jobs",
|
||||
"headers": {
|
||||
"Content-Type": "application/json",
|
||||
"X-Stella-Tenant": "tenant-default"
|
||||
},
|
||||
"body": {
|
||||
"tenant_id": "tenant-default",
|
||||
"context_id": "ctx-001",
|
||||
"profile_id": "default-profile",
|
||||
"findings": [
|
||||
{
|
||||
"finding_id": "finding-123",
|
||||
"component_purl": "pkg:npm/lodash@4.17.20",
|
||||
"advisory_id": "CVE-2024-1234",
|
||||
"trigger": "created"
|
||||
}
|
||||
],
|
||||
"priority": "normal",
|
||||
"requested_at": "2025-12-05T00:00:00Z"
|
||||
},
|
||||
"response": {
|
||||
"status": 202,
|
||||
"body": {"job_id": "job-001", "status": "queued"}
|
||||
}
|
||||
},
|
||||
"get_job_status": {
|
||||
"method": "GET",
|
||||
"path": "/api/v1/risk/jobs/job-001",
|
||||
"response": {
|
||||
"status": 200,
|
||||
"body": {
|
||||
"job_id": "job-001",
|
||||
"status": "completed",
|
||||
"results": [
|
||||
{
|
||||
"finding_id": "finding-123",
|
||||
"profile_id": "default-profile",
|
||||
"profile_version": "1.0.0",
|
||||
"raw_score": 0.75,
|
||||
"normalized_score": 0.85,
|
||||
"severity": "high",
|
||||
"signal_values": {"cvss": 7.5, "kev": true, "reachability": 0.9},
|
||||
"signal_contributions": {"cvss": 0.4, "kev": 0.3, "reachability": 0.3},
|
||||
"scored_at": "2025-12-05T00:00:02Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"get_explain": {
|
||||
"method": "GET",
|
||||
"path": "/api/v1/risk/explain/job-001",
|
||||
"response": {
|
||||
"status": 200,
|
||||
"body_ref": "../explain/explain-trace.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
30a64dcc9fb41d06774a9c125456c212a29915a083cd1d2170f16f343bd0764f README.md
|
||||
1d2e56eebf0a266f80519f073e1db532c4a4f2d7fa604ea5c05d4e208719cc7c explain-trace.json
|
||||
|
||||
34
docs/risk/samples/explain/explain-trace.json
Normal file
34
docs/risk/samples/explain/explain-trace.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"job_id": "job-001",
|
||||
"tenant_id": "tenant-default",
|
||||
"context_id": "ctx-001",
|
||||
"profile_id": "default-profile",
|
||||
"profile_version": "1.0.0",
|
||||
"profile_hash": "sha256:profilehash",
|
||||
"finding_id": "finding-123",
|
||||
"raw_score": 0.75,
|
||||
"normalized_score": 0.85,
|
||||
"severity": "high",
|
||||
"signal_values": {
|
||||
"cvss": 7.5,
|
||||
"kev": true,
|
||||
"reachability": 0.9
|
||||
},
|
||||
"signal_contributions": {
|
||||
"cvss": 0.4,
|
||||
"kev": 0.3,
|
||||
"reachability": 0.3
|
||||
},
|
||||
"override_applied": "kev-boost",
|
||||
"override_reason": "Known Exploited Vulnerability",
|
||||
"gates_triggered": ["kev_and_reachability"],
|
||||
"scored_at": "2025-12-05T00:00:02Z",
|
||||
"provenance": {
|
||||
"job_hash": "sha256:jobhash",
|
||||
"fixtures": [
|
||||
"sha256:cvsshash",
|
||||
"sha256:kevhash",
|
||||
"sha256:reachhash"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
5b7eee78aed1ee13378737c35cd2b5e91aa4abbbd0e70029219d5e357b40ab1f README.md
|
||||
13cf45be5a287a38d000aff4db266616e765fc1acdc1df9f37b2e03eb729d1d2 factors-normalized.json
|
||||
|
||||
44
docs/risk/samples/factors/factors-normalized.json
Normal file
44
docs/risk/samples/factors/factors-normalized.json
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"profile_id": "default-profile",
|
||||
"context_id": "ctx-001",
|
||||
"factors": [
|
||||
{
|
||||
"name": "cvss",
|
||||
"source": "nvd",
|
||||
"type": "numeric",
|
||||
"path": "/cvss/base_score",
|
||||
"raw_value": 7.5,
|
||||
"normalized_value": 0.75,
|
||||
"weight": 0.4,
|
||||
"contribution": 0.4,
|
||||
"timestamp_utc": "2025-12-05T00:00:00Z",
|
||||
"provenance": "sha256:cvsshash"
|
||||
},
|
||||
{
|
||||
"name": "kev",
|
||||
"source": "cisa",
|
||||
"type": "boolean",
|
||||
"path": "/kev/in_catalog",
|
||||
"raw_value": true,
|
||||
"normalized_value": 1.0,
|
||||
"weight": 0.3,
|
||||
"contribution": 0.3,
|
||||
"timestamp_utc": "2025-12-05T00:00:00Z",
|
||||
"provenance": "sha256:kevhash"
|
||||
},
|
||||
{
|
||||
"name": "reachability",
|
||||
"source": "scanner",
|
||||
"type": "numeric",
|
||||
"path": "/reachability/score",
|
||||
"raw_value": 0.9,
|
||||
"normalized_value": 0.9,
|
||||
"weight": 0.3,
|
||||
"contribution": 0.3,
|
||||
"timestamp_utc": "2025-12-05T00:00:01Z",
|
||||
"provenance": "sha256:reachhash"
|
||||
}
|
||||
],
|
||||
"ordering": "factor_type->source->timestamp_utc",
|
||||
"precision": 4
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
e9d2913ad6fe38423ffeea7b5a33f6e15a59d93784200d0686a9b26a80dd3885 README.md
|
||||
c8242d4051232152d024dd37324b346dcf019a5e46b7b82fae8349ad802affab default-profile.json
|
||||
|
||||
18
docs/risk/samples/profiles/default-profile.json
Normal file
18
docs/risk/samples/profiles/default-profile.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"id": "default-profile",
|
||||
"version": "1.0.0",
|
||||
"description": "Default risk profile for vulnerability prioritization",
|
||||
"extends": "base-profile",
|
||||
"signals": [
|
||||
{ "name": "cvss", "source": "nvd", "type": "numeric", "path": "/cvss/base_score", "transform": "normalize_10", "unit": "score" },
|
||||
{ "name": "kev", "source": "cisa", "type": "boolean", "path": "/kev/in_catalog" },
|
||||
{ "name": "reachability", "source": "scanner", "type": "numeric", "path": "/reachability/score", "unit": "score" }
|
||||
],
|
||||
"weights": { "cvss": 0.4, "kev": 0.3, "reachability": 0.3 },
|
||||
"overrides": {
|
||||
"severity": [ { "when": { "kev": true }, "set": "critical" } ],
|
||||
"decisions": [ { "when": { "kev": true, "reachability": { "$gt": 0.8 } }, "action": "deny", "reason": "KEV with high reachability" } ]
|
||||
},
|
||||
"metadata": { "author": "docs-guild", "created_at": "2025-12-05T00:00:00Z" },
|
||||
"provenance": { "hash": "sha256:placeholder", "signed": false }
|
||||
}
|
||||
Reference in New Issue
Block a user