CCSP Cloud Application Security Practice Question
A developer is tasked with securely storing a session token in a browser-based web application. Which storage mechanism is most secure?
⚠ Common exam trap
ISC2 often tests the misconception that localStorage or sessionStorage is secure because they are 'client-side only,' but the trap is that both are fully accessible via JavaScript and thus vulnerable to XSS, whereas HTTP-only cookies are the only option that prevents script-level access.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
HTTP-only cookies with Secure and SameSite flags
HTTP-only cookies with Secure and SameSite flags are the most secure storage mechanism for session tokens because they prevent client-side script access (mitigating XSS-based token theft), ensure transmission only over HTTPS (mitigating network eavesdropping), and restrict cross-origin request inclusion (mitigating CSRF). This combination aligns with OWASP best practices for session management, as the token is never exposed to JavaScript or sent over unencrypted channels.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
HTTP-only cookies with Secure and SameSite flags
Why this is correct
HTTP-only cookies are not accessible via JavaScript and Secure flag ensures HTTPS.
- ✗
sessionStorage
Why it's wrong here
sessionStorage is also accessible by JavaScript.
- ✗
URL query parameters
Why it's wrong here
Query strings are logged and exposed.
- ✗
localStorage
Why it's wrong here
localStorage is accessible by JavaScript, vulnerable to XSS.
Go deeper
Related to this question
About these practice questions
This CCSP question is part of Courseiva's 964-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CCSP practice question is part of Courseiva's free ISC2 certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CCSP exam.