curl --request POST \
--url https://app.trustivan.com/api/v1/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {},
"occurred_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://app.trustivan.com/api/v1/events"
payload = {
"event_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {},
"occurred_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
event_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
data: {},
occurred_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://app.trustivan.com/api/v1/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/events"
payload := strings.NewReader("{\n \"event_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"data\": {},\n \"occurred_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"event": "<string>",
"event_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"duplicate": true
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}Publish an NHI Security event for delivery
Hands one NHI Security fact to this deployment’s outbound planes: the
signed webhook outbox (every enabled endpoint subscribed to the kind)
and the notification outbox (every enabled destination subscribed to
it, after its min_severity and only_blocking filters). One Jira or
PagerDuty destination therefore serves both products: a target’s
events array may name AppSec kinds, NHI kinds, or both.
Implemented and fixture-verified. NHI Security has not been deployed to production and no connector has authenticated to a live provider, so this path has not carried real traffic. What is verified is the behaviour described here, against tests and recorded fixtures.
The organization comes from the credential
Always, and from nothing else. There is no organization parameter, no
path segment and no header that selects one: the tenant is the one the
presented workload credential resolves to. A body that names an
organization (organization_id or org_id, whether it matches or
not) is refused with 422, because a field nothing reads is a field
somebody will one day read.
Authenticate with a workload credential (Authorization: Bearer twa_…), which carries scans:create delegated by a named human and
expires within twelve hours. There is deliberately no shared service
token for the sibling stack: that would be a credential with no
delegator, no expiry and no revocation.
Retries
event_id is a UUID the publisher chooses, and it is what makes a
retry harmless: the same id publishes exactly once, however many times
it arrives. A first publish answers 202; a replay answers 200 with
duplicate: true and fans nothing out a second time. The same id
presented with DIFFERENT content is 409 rather than a silent
suppression of the event that already used it. Ids are scoped per
organization, so two tenants cannot collide.
The kinds
Three, and only these three: an AppSec kind (scan.completed,
verdict.recorded, finding.state_changed, finding.sla_breached,
audit.recorded) is
refused here, because each of those is produced inside the
transaction that produces the fact and one accepted over HTTP would be
a gate decision no policy ever evaluated.
event | what it reports |
|---|---|
nhi.finding.state_changed | An NHI posture finding opened, was triaged, was resolved, or was suppressed. Carries the finding’s kind, policy and fingerprint, so an exposed credential, an orphaned identity and an over-privileged role arrive under one subscribable name and are told apart by payload. |
nhi.credential.expiring | A discovered credential is close to its expiry (expiring) or past it (expired), with the deadline itself. A deadline rather than a judgement, which is why it is not a finding. |
nhi.action.denied | The runtime mediation boundary refused (deny) or challenged (challenge) an action an agent asked to take. Refusals only: an allow is normal operation, and subscribing a pager to it would be subscribing to nothing being wrong. |
Every severity is one of info, low, medium, high,
critical, the ladder a destination’s min_severity ranks against.
A value outside it is refused, because it would make a customer’s
severity filter silently match nothing.
Bounds
The body is at most 64 KiB and any single string in data at most
1024 bytes; both are refused rather than truncated. Fields this
contract does not declare are dropped rather than forwarded, and no
error message quotes a value back, only the field and the rule.
curl --request POST \
--url https://app.trustivan.com/api/v1/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {},
"occurred_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://app.trustivan.com/api/v1/events"
payload = {
"event_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {},
"occurred_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
event_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
data: {},
occurred_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://app.trustivan.com/api/v1/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/events"
payload := strings.NewReader("{\n \"event_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"data\": {},\n \"occurred_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"event": "<string>",
"event_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"duplicate": true
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}Authorizations
Body
The payload for this event. Every kind requires
summary, severity and occurred_at; beyond those:
nhi.finding.state_changed:finding_id,fingerprint,policy,kind,status(one ofopen,acknowledged,in_progress,resolved,risk_accepted,false_positive); optionallyfrom,subject_kind,subject_id,actor.nhi.credential.expiring:credential_id,identity_id,provider,standing(expiringorexpired),expires_at; optionallycredential_type.nhi.action.denied:action_id,identity_id,requested_operation,decision(denyorchallenge),decision_basis; optionallyagent_id,action_class.
Credential material never appears in a payload, and an actor is named only as a KIND: a payload travels to a destination the customer chose.
Response
Already published under this id. Nothing was fanned out again; duplicate is true.