KantoorWeb.Plugs.DavGuard (Kantoor v1.0.0)

First line of defence for /dav and the /.well-known/{caldav,carddav} entries, placed in the endpoint before the body parsers.

  • Cookies are dropped: a signed-in browser session never authenticates DAV (that would be CSRF-able) and DAV never sets a cookie.
  • Body size is capped (config :kantoor, KantoorWeb.Plugs.DavGuard, max_body_bytes: ..., default 6 MiB): a larger Content-Length is 413, and a body without a length (chunked) is 411, so the DAV plug never reads an unbounded body.
  • Plug.Parsers is told the body is already handled, so DAV bodies (including +json jCal) reach the DAV plug unread.