feat(commons): sign and verify requests from core to country config #14397
All Vouch review confidence checks passed
Residual risk 0.35 = Change Risk (0.65) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.65 · 342 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.349
Shallow Review Depth
shallow_review_depth
0.344
Sensitive Paths
sensitive_paths
0.065
Real PR Conversation Timeline
1 comments
"Review active on #14397"
general
weight: 0.35
panva
Part 1 of 6 of #14240. Nothing in the running system changes in this PR.
Summary
The profile of RFC 9421 that #14240 describes: label
core, components"@method" "@path" "@query" "content-digest",alg="ed25519",tag="opencrvs-core-request", and a window of 300 s.Who uses which part:
| Export | Package | User |
|---|---|---|
|
withCoreSignature,loadCoreSigningKeyFile,toPublicJwk,verifyCoreRequest|@opencrvs/commons/request-signing| core (later slices) ||
coreRequestAuth,createTestCoreKey|@opencrvs/toolkit/request-signing| country config |Differences from #14240, on purpose:
signCoreRequestandverifyCoreRequest. Country config needs only thecorestrategy, andcreateTestCoreKeyto test its routes.Evidence
After: unit tests in
signature.test.ts,keys.test.ts(RFC 8037 test vectors),key-list.test.ts,hapi.test.tsandtesting.test.ts, for example:- a request signed with the key →
200; one changed byte in the body →403- a signature older than 300 s, an unknown kid, a missing header →
403, with the reason only in the log- an unknown kid fetches the key list again, at most once a minute
- a request from
createTestCoreKeypasses thecorestrategy, both withfindPublicKeyand with its JWKSMerge Danger
Door: two-way
Only new code, which nothing calls yet.
Blast Radius: none
🤖 Generated with Claude Code