httponly

Set httpOnly flag for CSRF token in Laravel

孤街浪徒 提交于 2020-12-29 09:57:33
问题 I'm building an application in Laravel 5.1 for a client. After I finished the application I got back an pentest report which tells me to add a HttpOnly flag. I added 'secure' => true and 'http_only' => true to app/config/session.php. The httpOnly flag is set for all sessions, except the XSRF-TOKEN session. How am I able to set this flag as well? 回答1: You are able to overwrite the method addCookieToResponse($request, $response) in App\Http\Middleware\VerifyCsrfToken /** * Add the CSRF token to

Set httpOnly flag for CSRF token in Laravel

China☆狼群 提交于 2020-12-29 09:57:19
问题 I'm building an application in Laravel 5.1 for a client. After I finished the application I got back an pentest report which tells me to add a HttpOnly flag. I added 'secure' => true and 'http_only' => true to app/config/session.php. The httpOnly flag is set for all sessions, except the XSRF-TOKEN session. How am I able to set this flag as well? 回答1: You are able to overwrite the method addCookieToResponse($request, $response) in App\Http\Middleware\VerifyCsrfToken /** * Add the CSRF token to

Edit Cookie HttpOnly value

不想你离开。 提交于 2020-03-03 07:28:10
问题 Due to PCI regulations, most cookies in my application need to be secure and httponly. I have achieved that through this line in my Apache config file: Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure However this breaks part of the application where a single cookie, let's call it foobar, must be read by javascript. Therefore I need to remove the httponly for this cookie only. I've played around with several approaches including mod_rewrite but I can't get the httponly to drop off the cookie.

Making JSESSIONID cookie be httpOnly in Jetty 7

本秂侑毒 提交于 2020-01-02 10:26:06
问题 We're running grails 2.0 + jetty 7.6.6 and need to set JSESSIONID cookie to be httpOnly. All of the answers on stackoverflow seem to refer to either Servlet 3.0 (which requires jetty 8) or to tomcat. Can anyone provide me with a clear way of setting the JSESSIONID cookie be httpOnly for jetty 7.x? I have tried adding jetty-web.xml file with the following contents, but it still didn't work (i.e. the JSESSIONID wasn't marked as httpOnly): <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE

Django CSRF cookie HttpOnly

≯℡__Kan透↙ 提交于 2019-12-30 05:57:07
问题 Is it possible to set the django csrf cookie to be http-only? Alike to SESSION_COOKIE_HTTPONLY with session cookie, but for the csrf one? 回答1: A new setting, CSRF_COOKIE_HTTPONLY, is available in Django 1.6+. 回答2: For Django1.6+, check the accepted answer. For Django1.5 and prev, there is not setting option for this. You could override the process_response() method of django.middleware.csrf.CsrfViewMiddleware and using the customized one instead of CsrfViewMiddleware in MIDDLEWARE_CLASSES

Setting httponly in JSESSIONID cookie (Java EE 5)

99封情书 提交于 2019-12-30 02:10:14
问题 I'm trying to set the httponly flag on the JSESSIONID cookie. I'm working in Java EE 5, however, and can't use setHttpOnly() . First I tried to create my own JSESSIONID cookie from within the servlet's doPost() by using response.setHeader() . When that didn't work, I tried response.addHeader() . That didn't work either. Then, I learned that the servlet handled converting the session into a JSESSIONID cookie and inserting it into the http header so if I want to play with that cookie, I'll have

JSessionId (httponly cookie) not sent to web service from Javascript

◇◆丶佛笑我妖孽 提交于 2019-12-25 00:36:29
问题 We have a web applet that loads under the URL https://secure-ausomxeja.crmondemand.com/OnDemand/... from where we are making a web service call within the same domain (https://secure-ausomxeja.crmondemand.com/Services/Integration) using JQuery. We are not able to understand the fact that JSessionId (a httponly cookie) is not getting passed in the JQuery web service call even though everything is happening in the same domain. Interestingly, if the web service URL would start with https:/

Destroy http-only cookie with cookie-parser

自闭症网瘾萝莉.ら 提交于 2019-12-24 22:12:20
问题 I am using cookie-parser to create a http-only cookie that holds the token for a logged-in user. Then I need to either destroy that cookie or make it expire, when the user hits "logout". How can I destroy (or at least edit) the cookie? Will the following do the trick ? res.cookie("SESSIONID", null, {httpOnly:true, secure:true}); Thank you 来源: https://stackoverflow.com/questions/51116246/destroy-http-only-cookie-with-cookie-parser