Foundations

Trust Boundaries & Input Validation

Foundational

A trust boundary is the line where data crosses from somewhere you do not control into somewhere you do. At its root, every serious security failure is a trust boundary that was not enforced: input treated as safe that was not. Know exactly where your boundaries are, validate hard at each one, and never trust the same data twice.

Inside a boundary you can reason about data. Outside it, anything is possible, including data sent on purpose to attack you. The discipline is to find every boundary (the public API, a webhook, a queue message, a file upload, even another internal service) and to validate, canonicalise, and constrain data as it crosses. Then everything downstream can treat it as trusted, because it has been made trustworthy.

The subtle trap is to assume data is safe because of where it came from: our own database, an internal service, a 'trusted' partner. It is not. Unvalidated input you stored yesterday is still unvalidated input today. The Finperiti webhook finding is the clear example: a boundary (the internet) was treated as trusted because the data looked internal.

Validate at the boundary

Trusting an inbound callback [HttpPost("/webhooks/kyc")]
public IActionResult OnKyc(KycResult body) {
customer.Status = body.Status; // acted on, unverified
...
}

Anyone on the internet can POST a forged 'approved' result. The boundary (untrusted internet to trusted decision) was never enforced. This is exactly the Finperiti unsigned-webhook failure.

Authenticate, then validate, then act if (!signature.Verify(rawBody, header)) return Unauthorized();
var result = Parse(rawBody); // validate shape and allowed values
if (!result.IsKnownStatus) return BadRequest();
Apply(result);

Authenticity is proven, the payload is validated against allowed values, and only then does it cross into trusted logic.

Don't re-trust, don't under-trust

Self-review checklist

Why it matters: Injection, forged webhooks, path traversal, and cross-tenant leaks all trace back to one mistake: trusting data that crossed a boundary without being made trustworthy. Enforcing boundaries with allow-list validation, authenticity checks, and safe sink APIs removes whole classes of the most damaging vulnerabilities at once.