Skip to content

option to disable CSRF for list of endpoints #6784

Open
@ghostebony

Description

@ghostebony

Describe the problem

With the new csrf protection I can't receive webhooks without disabling csrf on all routes

Describe the proposed solution

In the csrf config, it would be nice to have a "exclude" setting to disable csrf protection in some routes.

// svelte.config.js

const config = {
    kit: {
        csrf: {
            checkOrigin: true,
            // exclude: [ "/webhooks/*" ],
            // AND/OR
            // exclude [ "/webhooks/1", "/webhooks/2" ]
        },
    },
};

export default config;

and/or

// src/routes/+(page.)server.js

export const csrf = false;

Alternatives considered

No response

Importance

would make my life easier

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions