csrf

Django Rest Framework, CSRF and Vue.js

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to use Vue.js to do some POST methods to my REST Api that I created with Django Rest Framework. Problem is, I'm getting the CSRF Failed: CSRF token missing or incorrect. error when I post. But I can see the csrf cookie, and it's being added to the headers. Here's my settings: REST_FRAMEWORK = { 'DEFAULT_PERMISSION_CLASSES': ( 'rest_framework.permissions.IsAuthenticated', 'rest_framework.permissions.DjangoModelPermissions' ), 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.SessionAuthentication', 'rest_framework

Laravel 5 CSRF global token hidden field for all forms in a page

匿名 (未验证) 提交于 2019-12-03 01:19:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I recently migrated to Laravel 5, and now CSRF check is on every post submission. I thought about removing it but I want to follow the best practices, so I'll keep it that way. On the other hand, I'm problems submitting ajax requests.. my page has multiple forms and some submissions are not even from forms, just plain ajax calls. My idea is to have one single hidden "token" input on the page and attach it to every submission. Are there any drawbacks on having that universal single token input? Also, how can I output the token?

CSRF token generation

匿名 (未验证) 提交于 2019-12-03 01:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This is a question about generating CSRF tokens. Usually I'd like to generate a token based off of a unique piece of data associated with the user's session, and hashed and salted with a secret key. My question is in regards to generating tokens when there is NO unique user data to use. No sessions are available, cookies are not an option, IP address and things of that nature are not reliable. Is there any reason why I cannot include the string to hash as part of the request as well? Example pseudocode to generate the token and embed it: var

angular, django and csrf

匿名 (未验证) 提交于 2019-12-03 01:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: from http://docs.angularjs.org/api/ng .$http , it says we should set default headers to include the token, so i am following it. my code goes something like this var myapp = angular.module('myapp', ['ngCookies', 'ui.bootstrap']). config(['$routeProvider', function($routeProvider, $httpProvider, $cookies){ $routeProvider. when('/', { templateUrl: '/partials/home.html', controller: HomeCtrl }). when('/game/:gameId/shortlist/create',{ templateUrl: '/partials/create-shortlist.html', controller: CreateShortlistCtrl }). otherwise({redirectTo: '/'}

How to disable Django's CSRF validation?

匿名 (未验证) 提交于 2019-12-03 01:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have commented out csrf processor and middleware lines in settings.py : 122 123 TEMPLATE_CONTEXT_PROCESSORS = ( 124 'django.contrib.auth.context_processors.auth', 125 # 'django.core.context_processors.csrf', 126 'django.core.context_processors.request', 127 'django.core.context_processors.static', 128 'cyathea.processors.static', 129 ) 130 131 MIDDLEWARE_CLASSES = ( 132 'django.middleware.common.CommonMiddleware', 133 'django.contrib.sessions.middleware.SessionMiddleware', 134 # 'django.middleware.csrf.CsrfViewMiddleware', 135 'django

CakePHP ajax CSRF token mismatch

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am making an ajax request with Csrf component load in my AppController However I get the error {"message":"CSRF token mismatch.","url":"\/module_slides\/loadDeck.json","code":403} Here is the request header POST /module_slides/loadDeck.json HTTP/1.1 Host: www.hotelieracademy.com Connection: keep-alive Content-Length: 18 Origin: https://www.hotelieracademy.com X-XSRF-TOKEN: 3d3901b1de9c5182dce2877c9e1d9db36cdf46a6 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari

POST url 403 forbidden in Codeigniter 3

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Hi experts can you give me a suggestion, why I am getting this 403 forbidden on my code igniter currently running on my localhost. 403 forbidden The process is like this: I am using ajax for easy and smoothly access and retrieving of data from model, controller to the view the image below is my code in my views to controller. <div class="modal-header s-example-modal-sm" aria-labelledby="mySmallModalLabel"> × New Question Modal function question_save(){ $.ajax({ url : "<?php echo base_url('Mainx/insert_question_header');?>", crossDomain: true

How to secure websocket application [Spring boot + STOMP]

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Good morning, I've created a simple Spring Boot WebSocket application. Right now I would like to set some security to it. I've trying some examples but I cannot get it worked. I'm getting error: web browser: >>> CONNECT ${_csrf.headerName}:${_csrf.token} accept-version:1.1,1.0 heart-beat:10000,10000 <<< ERROR message:Failed to send message to ExecutorSubscribableChannel[clientInboundChannel]; nested exception is org.springframework.security.web.csrf.MissingCsrfTokenException\c Could not verify the provided CSRF token because your session was

Spring MVC : How to Protect Application from CSRF and XSS

痴心易碎 提交于 2019-12-03 00:47:08
What is the best way to protect our Spring MVC application from CSRF and XSS. Is there native Spring MVC support for this? In Spring: Forms ( globally): <context-param> <param-name>defaultHtmlEscape</param-name> <param-value>true</param-value> </context-param> Forms ( locally): <spring:htmlEscape defaultHtmlEscape="true" /> You can use Spring Security 3.2.0.RELEASE and enable csrf support with this configuration <http> <!-- ... --> <csrf /> </http> Here is a blog about it. http://blog.eyallupu.com/2012/04/csrf-defense-in-spring-mvc-31.html another one. http://web.securityinnovation.com/appsec

How to extend or override BeginForm to include a AntiForgeryToken field

戏子无情 提交于 2019-12-03 00:46:26
I was reading this article ( http://weblogs.asp.net/dixin/archive/2010/05/22/anti-forgery-request-recipes-for-asp-net-mvc-and-ajax.aspx ) about how to prevent CSRF attacks. It seems like the solution is to create a tag inside each form. <%: this.Html.AntiForgeryToken(Constants.AntiForgeryTokenSalt)%> However, I really don't want to copy and paste that code inside of each form. I would like to extend or override the BeginForm to create a BeginSecureForm that automatically adds the AntiForgeryToken. I am not sure how to add content inbetween of the BeginForm and EndForm. Any ideas? You should