2.5 KiB
2.5 KiB
AttackTracer Ninja V2 n8n Contract
Purpose
This document defines the concrete webhook contract between the endpoint client and n8n.
Request
Method:
POST
Content type:
application/json
Webhook URL:
- example:
https://n8n.example.com/webhook/attacktracer-ingest
Required headers
X-ATN-DeviceX-ATN-TimestampX-ATN-NonceX-ATN-VersionX-ATN-Payload-SHA256X-ATN-Signature
Header semantics
X-ATN-Device- endpoint machine name used for attribution
X-ATN-Timestamp- UTC timestamp in ISO 8601 format
X-ATN-Nonce- unique per request, used for replay protection
X-ATN-Version- client version string
X-ATN-Payload-SHA256- SHA-256 over the JSON body, lowercase hex
X-ATN-Signature- HMAC-SHA256 over the canonical signing string, lowercase hex
Canonical signing string
The client signs this exact string:
device + "\n" + timestamp + "\n" + nonce + "\n" + version + "\n" + payloadSha256
Signature algorithm
HMAC-SHA256
Recommended n8n validation
- Reject when a required header is missing.
- Reject when timestamp skew exceeds allowed tolerance.
- Reject when nonce was already seen.
- Recompute payload hash and compare to
X-ATN-Payload-SHA256. - Recompute HMAC and compare to
X-ATN-Signature. - Parse JSON only after headers and signature validation pass.
Suggested timestamp tolerance
- 5 minutes
Suggested replay protection persistence
Persist nonce records in Postgres with:
- nonce
- device
- timestamp
- first_seen_utc
JSON body schema
The body is a ScanResult JSON document with schema version 2.0.
Key fields:
schemaVersionmachineNamegeneratedAtUtcclientVersionlookbackDaysalertStatebaseAlertStatetotalEventsuniqueIpCounterrorsvulnerabilityCorrelationruntime
Example body
See:
n8n response recommendation
On success:
- HTTP
200or202 - JSON body with minimal confirmation
Example:
{
"accepted": true,
"device": "WSUS",
"nonce": "f53a3f0b0c2c466ea1717d88d55fd393"
}
On failure:
- HTTP
4xxfor validation/signature problems - HTTP
5xxfor processing/storage problems
Device identity guidance
The webhook should not trust machineName alone for authorization.
For initial rollout, use the shared secret as the trust anchor. For later hardening, add a per-device secret or enrollment identity.