← PHP / Laravel · Contents

PHP-039 / Intermediate

Missing Secure, HttpOnly and SameSite cookie settings

A05:2021 Security Misconfiguration · CWE-614 Sensitive Cookie Without 'Secure' Attribute · CWE-1004

Why is this a problem?

Plaintext transmission, JavaScript-based theft and cross-site transmission are possible.

How to fix it

php
'secure' => env('SESSION_SECURE_COOKIE', true),
'http_only' => true,
'same_site' => 'lax',

Further reading