PT-AM-CPE practice question 14 of 35
What is the purpose of HTTP-only cookies?
Full set: 100 questionsThe HttpOnly flag is a security attribute set on a cookie by a web server. It instructs the browser to prevent client-side scripts (like JavaScript) from accessing the cookie's value via APIs such as document.cookie. This is a crucial defense mechanism against Cross-Site Scripting (XSS) attacks, where an attacker might inject a malicious script to steal session cookies and hijack a user's session.
B: This describes the Secure cookie attribute, which ensures the cookie is only sent over encrypted (HTTPS) connections. C: The HttpOnly flag does not prevent the server from reading the cookie; the server needs to read it to maintain session state. D: This is incorrect; the flag does not restrict transmission to HTTP and should be used with HTTPS for security.
- Ping Identity, PingAM 7.5 Documentation, "Security", section "Cross-site scripting (XSS) prevention". This section explicitly recommends setting the HttpOnly flag on session cookies.
- IETF, RFC 6265, "HTTP State Management Mechanism", Section 4.1.2.6, "The HttpOnly Attribute". This RFC defines the attribute and its purpose: "The HttpOnly attribute limits the scope of the cookie to HTTP requests... an HttpOnly cookie is not accessible to non-HTTP APIs such as JavaScript."
Keep practicing
Take the free PT-AM-CPE practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other PT-AM-CPE practice questions
- Question 1Which area of PingAM does affinity mode relate to?
- Question 2Which of the following actions can be specified in a policy by default?
- Question 3Which of the following parameters must be provided by the edge client when requesting ste…
- Question 4Which of the following code examples inserts a may_act claim to the resulting token in a …
- Question 5A user enters their credentials, but is faced with the error message "user requires profi…
- Question 6The Core Token Service (CTS) can be used for storing which of the following?
