Skip to content

Ogenschijnlijk tegenstrijdige suggesties voor CORS-headers openapi.json #242

@wandernauta

Description

@wandernauta

De regel /core/publish-openapi eist in versie 2.1.0-rc.1 wat betreft het OAS-document dat...

the CORS policy for this URI MUST allow external domains to read the documentation from a browser environment.

en

The CORS header Access-Control-Allow-Origin MUST allow all origins.

De regel /core/transport/security-headers specificeert...

The following headers SHOULD be included in all API responses: ..., Access-Control-Allow-Origin, ...

En de regel /core/transport/cors vervolgens zegt dat...

Using a wildcard * in the Access-Control-Allow-Origin response header is NOT RECOMMENDED, because it disables CORS-security measures. Only for an open API which has to be accessed by numerous other websites this is appropriate.

Mijn vermoeden zou zijn dat daar bedoeld wordt: geef altijd * terug voor openapi.json, ook al heeft jouw client dat niet nodig; geef idealiter helemaal geen Access-Control-Allow-Origin header voor alle andere resources, of desnoods een Access-Control-Allow-Origin header op basis van een allowlist als dat echt nodig is voor bekende clients.

Klopt dit? Het is wat hypothetisch allemaal, maar zoals beschreven lijken deze regels elkaar te bijten; het zou wellicht duidelijker zijn om expliciet te maken hoe dat rechtgetrokken moet worden.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions