Skip to interview prep
Apexed

61. What distinct protections do Secure, HttpOnly and SameSite cookie attributes provide?

EasyApplication & data security

Technical
Show model answer

Secure restricts cookie transmission to secure connections, while HttpOnly prevents ordinary client-side scripts from reading the cookie. SameSite controls specified cross-site sending behavior, depending on its setting and browser rules.

Use settings appropriate to the application's flows and test them with the complete session design. These attributes do not correct broken authorization, eliminate every cross-site risk or make a stolen session harmless.

What interviewers listen for

  • Explain each attribute's purpose
  • Test settings against required flows
  • Retain broader session controls
What distinct protections do Secure, HttpOnly and SameSite cookie attributes provide — Cybersecurity interview question — Apexed