Skip to content

REST Security Transport layer

Sebastien Dubois edited this page Dec 10, 2016 · 1 revision

Transport layer security is of critical importance.

The following security measures are designed to help protect applications against eavesdropping, man-in-the-middle (MITM) attacks and to protect confidentiality, integrity, ...

Don't even consider exposing a REST API without at the very least the following guidelines respected:

  • everything MUST be served over secure channels: TLS
    • only TLS 1.2 and newer SHOULD be used/proposed/accepted
      • SSLv3: Poodle attack
      • TLS 1.0: Beast attack
      • TLS 1.1: Freak attack
    • servers SHOULD be configured to ensure Perfect Forward Secrecy (PFS)
      • this is to ensure that, even if the private key of a server is leaked at some point, all the data transferred before that between clients and the server will still be protected
      • this is done by using a cipher suite with ephemeral Diffie-Hellman (DHE) or the elliptic-curve variant (ECDHE) the crypto parameters MUST use a secure length that matches the supported keylength of the certificate (>= 2048 bits or equivalent Elliptic Curves)
      • generate individual DH-parameters to get unique prime numbers: openssl dhparam 2048 -out dhparam 2048.pem
    • including static content (images, scripts, css), login and logout pages, ...
      • this SHOULD avoid vectors for MITM and warnings about mixed content
  • the certificate use for an application SHOULD
    • be specific to the application's DNS domain
    • NOT be a wildcard certificate
    • always provide all needed certificates (i.e., a full path from the certificate to the Root CA) so that clients can fully validate the trust chain
    • use AT A MINIMUM SHA-512
    • the OWASP recommendations MUST be followed/applied: https://www.owasp.org/index.php/Transport_Layer_Protection_Cheat_Sheet
  • you MUST NOT mix encrypted and unencrypted content (aka mixed content) on the same host, as the request of any resource through HTTPS might disclose the session identifiers

Some of these security measures SHOULD be taken care of by the infrastructure configuration, but MUST be applied to all applications

History

REST

REST

REST API Design Goals

REST Constraints

REST Resources

REST Resources Design Workflow

REST Resources Naming

REST Resources URIs

REST Resources Parameters

REST Resources Single items and collections

REST Resources Relations

REST Resources Many to many Relations

REST Resources Relations expansion

REST Resources Actions

REST API Versioning

REST API Documentation

HTTP

HTTP Methods

HTTP Status Codes

HTTP Status Codes Success (2xx)

HTTP Status Codes Redirection (3xx)

HTTP Status Codes Client Error (4xx)

HTTP Status Codes Server Error (5xx)

Media types

CRUD Operations

CRUD About

CRUD Create Single item

CRUD Retrieve Single item

CRUD Retrieve Collection

CRUD Update Single item

CRUD Delete Single item

Pagination

Pagination About

Pagination Rules and metadata

Pagination Example

Pagination Out of range/bounds

Filtering

Filtering About

Filtering Using styles

Filtering Using includes

Filtering Using excludes

Sorting

Sorting About

Sorting Metadata

Sorting Example

Searching

Searching About

Searching Local search

Searching Scoped search

Searching Global search

Searching Advanced search

Searching Wildcards

Searching Formatting

Long-running operations

Long-running Operations About

Long-running Operations Flow

Long-running Operations Rules

Long-running Operations Example

Concurrency control

Concurrency About

Concurrency Headers to use

Concurrency vs Delete operation

Concurrency vs Pagination

Caching and conditional requests

Caching and conditional requests About

Caching and conditional requests Rules

Caching and conditional requests HTTP headers

Conditional requests

Cache control

Error handling

Error handling About

Error handling Expectations

Error handling Status codes

Error handling Error details

Error handling Example with a single error

Error handling Example with multiple errors

Error handling Example with parameters

Error handling Example with additional metadata

Error handling Warnings

Compression

Compression About

Bulk operations

Bulk operations About

Bulk operations Types

Bulk operations Atomic

Bulk operations Non-atomic

Bulk operations Asynchronous

Bulk operations HTTP status codes

Bulk operations Resources naming convention

Bulk operations Errors

Bulk operations Creation example

Bulk operations Update example

Bulk operations Create and update example

File upload

File upload About

File upload File sizes

File upload Simple file upload

File upload Simple file upload example

File upload Complex file upload

File upload Complex file upload example

Security recommendations

REST Security General recommendations

REST Security Transport layer

REST Security Error handling

REST Security Insecure direct object references

REST Security CORS

REST Security Updates and consistency

REST Security API keys

Miscellaneous

Data formats

Internationalization

Rate limiting

Null values

Dates and times

Redirections

References

Clone this wiki locally