REST API Security
Cheat sheet · https://pcornel.dk/topic.php?topic=772
Answer
REST API security protects network and automation APIs with HTTPS/TLS and certificate validation, strong authentication (tokens, certificates), least-privilege authorisation, safe token handling and input validation. RESTCONF protocol details are in Automation → RESTCONF.
Remember
A successful HTTP response does not prove correct security policy, least privilege or full service function. Inspect the returned resource/body, effective permissions and independent operational state. Certificate, credential and authorization failures are distinct; keep secrets out of logs, shared command lines and copied Evidence.
First checks
curl -v https://host/… → certificate validated, TLS 1.2 or 1.3. A request without credentials → 401; a write with a read-only identity → 403. Check that API calls are logged with identity and source address.
Verify in this order
HTTPS with a validated certificate → every request authenticated → authorised by role or scope → input validated → rate-limited → logged
Where it usually breaks
physical/link dependency → local object state → peer/control state → policy → forwarding/adjacency → end-to-end result
REST API Security evidence chain
| Boundary | Question | Evidence | Does not prove |
|---|---|---|---|
| Definition | What is configured or intended? | running configuration / controller policy | live operation |
| Counters | Did controlled traffic or an event reach this stage? | scoped counters/timestamps | complete return path |
| Next boundary | What consumes or transports this state? | trusted TLS endpoint → authentication/token → authorization scope → input/schema validation → action/result → audit/revocation | application success |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=772