csrf

Yii2 How to properly create checkbox column in gridview for bulk actions?

那年仲夏 提交于 2019-11-29 04:36:42
I need to create "bulk actions" similar to wordpress posts management, so you can for example delete multiple records at a time. This is my approach, and works fine, but I'm sure it is not the best approach, since this method is vulnerable to CSRF hacks. Checkbox column in a gridview: GridView::widget([ 'dataProvider' => $dataProvider, 'columns' => [ ['class' => 'yii\grid\CheckboxColumn'], 'id'=>'grid', 'country', ], ]); Button that fires a function <a href="#" onclick="bulkAction('p');"> The function: <script> function bulkAction(a) { var keys = $('#grid').yiiGridView('getSelectedRows');

Set Ring-Anti-Forgery CSRF header token

岁酱吖の 提交于 2019-11-29 03:42:43
I'm attempting to implement the Ring-Anti-Forgery library via setting the X-CSRF-Token in the header. Since I am using static html files I found the built-in hiccup helper, which sets the token in the form, to be useless. This is my first stab at using Clojure for web development so I'm guessing that I am completely missing what should be obvious to someone with experience. The instructions from the README state: The middleware also looks for the token in the X-CSRF-Token and X-XSRF-Token header fields. This behavior can be customized further using the :read-token option: (defn get-custom

Grails 3 CSRF protection

醉酒当歌 提交于 2019-11-29 02:41:58
Is it possible to configure CSRF protection in grails3 app using spring-security plugin, I can't find anything except useToken attribute for grails form and then call withForm inside controller. But this is actually not a very flexible solution. I like approach with filter like here For csrf protection I reused org.springframework.security.web.csrf.CsrfFilter . You need to define new bean in grails resouces.groovy (See snipet below - csrfFilter bean). You can define your own accessDeniedHandler and requireCsrfProtectionMatcher . Here is the snippet from resources.groovy: csrfFilter(CsrfFilter,

Rails - Losing session with Integration Tests and Capybara - CSRF related?

穿精又带淫゛_ 提交于 2019-11-29 02:35:04
问题 I'm using Rails 3.1.0.rc4 and I'm working on doing integration tests with capybara's new Steak-like DSL and Rspec (using Devise authentication) The issue I'm having is that when I run an integration test, the rack-test driver from capybara seems to just completely lose the user's logged in session, in fact, the session seems to just clear out altogether. After days of debugging, I'm at a complete loss as to why. Going line by line through the middleware stack, I believe I've ruled the problem

Spring Security CSRF Token not working with AJAX

邮差的信 提交于 2019-11-29 02:24:31
I have a problem in my spring boot app with the csrf token. I have a form where I can edit a Person. A Person can have Let us now imagine that the person has a car and enter this and store it. The next time he wants to delete this car and enter another one. I have created that so that there is a list of all of his cars -- he has the option to remove this from the list. Now I'm starting from these pills and want to send with the corresponding ID to the server a POST. When I try I get a 403 forbidden and I have no idea why. If I change from POST to GET, then it works. My JavaScript (taken from

Laravel 4: Prevent multiple form submissions - CSRF Token

时光毁灭记忆、已成空白 提交于 2019-11-29 00:28:09
Problem scenario: I'm creating a blog with Laravel 4. The form that's responsible for the creation of new blog posts is secured by the build in CSRF protection ( Laravel Docs: CSRF Protection ). Everything works fine so far, but it seems that laravel does not refresh the csrf token on every request. The problem that occurs is that if the user hits the back button of the browser to return to the submitted form, the entered data persists and the user is able to "re-submit" the form. This might create an open door for spammers. Usually this is prevented by the CSRF token, as it's being refreshed

CSRF: Can I use a cookie?

南楼画角 提交于 2019-11-28 23:04:14
Is it ok to put the CSRF token in a cookie? (and in every form, as a hidden input, so I can check if they match, of course) I heard someone say that doing so, beats the whole purpose of the token, though I don't understand why. It seems secure to me. And if it is secure, is it any less secure than puting the token in the URL's ? Is there any other method? Where can I read more on the subject? UPDATE : So far no one can tell me how is the cookie method insecure, if it still has to match the token from the form, which the attacker shouldn't be able to get, unless he uses another hack like XSS,

Any reason not to trust ASP.NET AntiForgeryToken?

試著忘記壹切 提交于 2019-11-28 21:25:50
I know that Stack Exchange sites do not use the ASP.NET MVC built-in @Html.AntiForgeryToken() for the prevention of XSRF/CSRF attacks. Instead of creating a hidden input named __RequestVerificationToken with a really long value based on the machineKey section of the web.config, the Stack Exchange method creates an input named fkey with a MUCH more succinct value. This is apparently a Guid, and based on evidence from the Stack Exchange Data Explorer project on Google Code , this value is tied to each individual user, remaining fairly constant until you log in or out. Also, the Stack Exchange

XSS和CSRF

不羁岁月 提交于 2019-11-28 20:45:01
CSRF: 在浏览器存有 Web_A 的 Cookie 时访问 Web_B,B 要求访问第三方网站Web_A,此时浏览器会自动带上 Web_A 的Cookie去访问 Web_A,从而拥有 User_C 在 Web_A 的权限,进而使用 User_A 的权限去执行恶意操作。 防御:Token、隐藏令牌、Referer验证(页面来源,只接受本站请求,其他网站请求,服务器拒绝响应,或拦截) XSS: 盗用受害者 Cookie 等敏感隐私信息,发送给攻击者,攻击者冒充受害者登录网站进行恶意操作。 来源: https://www.cnblogs.com/liuxgcn/p/11427195.html

csrf error in django

北城以北 提交于 2019-11-28 20:41:37
I want to realize a login for my site. I basically copied and pasted the following bits from the Django Book together. However I still get an error (CSRF verification failed. Request aborted.), when submitting my registration form. Can somebody tell my what raised this error and how to fix it? Here is my code: views.py: # Create your views here. from django import forms from django.contrib.auth.forms import UserCreationForm from django.http import HttpResponseRedirect from django.shortcuts import render_to_response def register(request): if request.method == 'POST': form = UserCreationForm