- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如果我创建一个全新的 Rails 应用程序(使用 Rails 3.0.9)并快速搭建一些脚手架,如下所示:
$ rails new testing
$ rails g scaffold thing name:string
然后 app/controllers/application_controller.rb 默认包含一个“protect_from_forgery”,因此它应该在 POST 创建期间检查 authenticity_token。至少,这是我的理解。
那么,为什么这一行在没有提供 token 的情况下成功创建了一个新事物。
$ curl -F "thing[name]=abc123" http://localhost:3000/things
日志条目说:
Started POST "/things" for 127.0.0.1 at 2011-07-05 08:29:18 +0100
Processing by ThingsController#create as
Parameters: {"thing"=>{"name"=>"abc123"}}
AREL (0.3ms) INSERT INTO "things" ("name", "created_at", "updated_at") VALUES ('abc123', '2011-07-05 07:29:18.484457', '2011-07-05 07:29:18.484457')
Redirected to http://localhost:3000/things/18
Completed 302 Found in 89ms
我也可以这样做来删除记录:
$ curl -X DELETE http://localhost:3000/things/18
同样的事情发生在生产模式。这不会让我的申请对 CSRF 开放吗?
最佳答案
如果您传递无效的 CSRF token 或在没有它的情况下发送请求,Rails 将使 session 无效,因此如果每个人都可以访问您的应用程序,protect_form_forgery
将毫无用处。但如果您有基于 session 的身份验证系统,它将使您的应用程序免受 CSRF 攻击。
关于ruby-on-rails - CSRF 在 Rails 中不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6579445/
假设我的 Web 应用程序使用 CSRF token 防止 CSRF 攻击,此外,它使用 SSL 并防止 XSS 攻击。此外,出于这个问题的目的,假设它仅在最近的浏览器中使用并且它们没有错误。我可以使
很多人都在谈论实现 CSRF 来阻止对网页的跨站点攻击。但我认为破坏 CSRF 并向服务器发出请求非常容易。 那么它是如何工作的呢? 您从一个页面开始,呈现一个表单并使用 CSRF token 保留一
在阅读了许多有关 CSRF 的文档后,我仍然有点困惑。所以我希望有人可以向我解释一下: 假设我有一个仅供经过身份验证的用户使用的个人资料页面,比如说 abc.com/profile,它会显示我所有的私
我们基于 Angular 的 web 应用程序与在不同域和上下文路径上运行的企业门户集成。我正在使用基于 Spring Security 的 CSRF token 来验证传入的请求。该应用程序在本地完
我正在开发一个 Web API。身份验证是通过 cookie 进行的。所有端点通过JSON接收参数在请求正文中。 我需要实现 CSRF token保护他们?这怎么可能被利用呢?是否可以通过正常发送JS
我正在开发一个从 cookie header 解析 CSRF token 的应用程序。我想知道 CSRF token 是否使用 URL 安全字符进行 base64 编码(参见 https://simp
我知道当提交时表单中未包含 csrf token 时会发生此错误,但这次并非如此。 我正在尝试登录管理站点。管理员登录表单包含 csrf token ,我可以看到该 csrf token 的值与 cs
有没有办法对 Controller 的某些操作禁用 CSRF 验证,同时对其他操作保持启用状态? 就我而言,我有几个可配置的 Action 类,它们旨在注入(inject)到 Controller 中
我正在编写一个应用程序(Django,确实如此),我只想了解“CSRF token ”实际上是什么以及它如何保护数据。 如果不使用CSRF token ,发布数据不安全吗? 最佳答案 简单来说跨站请求
来自维基百科关于同源政策 https://en.wikipedia.org/wiki/Same-origin_policy The same-origin policy helps protect s
我在 Vue 环境中使用 axios 与用 Symfony 编写的网络服务对话。每个请求都需要设置一个 X-Auth-Token header 。该值存储在 auth_token cookie 中。
我想保护我的 REST 调用免受 XSRF 攻击。我正在做的是: 服务器在用户成功登录后向浏览器发送一个记录的 cookie。 在每个请求(GET、POST、DELETE)上,我将登录的 cookie
我知道这个问题以前有人问过。我已经尝试了人们给出的几乎所有选项,但我似乎无法解决它。我是一个完整的新手,所以请让我知道我哪里出错了。 我正在尝试编写一个简单的原始表单。到目前为止,我还没有实现任何身份
似乎 Laravel 5 默认将 CSRF 过滤器应用于所有非获取请求。这对于表单 POST 是可以的,但对于 POST DELETE 等的 API 可能是一个问题。 简单的问题: 如何设置没有 CS
当我从客户端向服务器发出 DELETE 请求时,我遇到了错误。 “CSRF token 已关联到此客户端”。响应代码:403 和响应头 { "cache-control": "no-cache,
to prevent CSRF attacks, a random CSRF secret has been generated. 以上内容来自 symfony: http://www.symfony
我正在使用 Django Rest Framework还有 django-rest-auth . 我有标准的 API 端点(/login、/logout、/registration...) 使用我的浏
这个问题在这里已经有了答案: OAuth2.0 Server stack how to use state to prevent CSRF? for draft2.0 v20 (3 个回答) 4年前关
我需要知道如何在 Impresspages cms 中禁用 CSRF 功能。我在之前的帖子中看到了一个可能的答案,但没有完全分类。当我的客户在 cleanwaterpartnership.co.uk
我正在使用 Django 1.7 和 django-rest-framework。 我制作了一个 API,它返回一些 JSON 数据并将其放入我的 settings.py REST_FRAMEWORK
我是一名优秀的程序员,十分优秀!