Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# SuperGood::CSRFProtection

A Rack middleware for CSRF protection using the Sec-Fetch-Site header to prevent cross-site requests.
This Rack middleware provides CSRF protection using the Sec-Fetch-Site header. It is inspired by Go's `http.CrossOriginProtection` which was introduced in Go 1.25. You can read about it [in this article](https://www.alexedwards.net/blog/preventing-csrf-in-go) and find more information about the `Sec-Fetch-Site` header [on MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-Fetch-Site#browser_compatibility).

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'super_good-csrf_protection'
gem "super_good-csrf_protection"
```

And then execute:
Expand All @@ -27,7 +27,7 @@ gem install super_good-csrf_protection
Add the middleware to your Rack application:

```ruby
require 'super_good/csrf_protection'
require "super_good/csrf_protection"

use SuperGood::CSRFProtection
```
Expand Down
12 changes: 2 additions & 10 deletions super_good-csrf_protection.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
spec.authors = ["Sofia Besenski", "Jared Norman", "Alistair Norman", "Senem Soy", "Noah Silvera"]
spec.email = ["sofia@super.gd", "jared@super.gd", "alistair@super.gd", "senem@super.gd", "noah@super.gd"]

spec.summary = "A Rack middleware for handling the Sec-Fetch-Site header."
spec.description = "A Rack middleware for handling the Sec-Fetch-Site header."
spec.summary = "A Rack middleware for preventing CSRF attacks using the Sec-Fetch-Site header"
spec.description = "A Rack middleware for preventing CSRF attacks using the Sec-Fetch-Site header"
spec.homepage = "https://github.com/SuperGoodSoft/csrf_protection"
spec.license = "MIT"
spec.required_ruby_version = ">= 3.2.0"
Expand All @@ -18,8 +18,6 @@ Gem::Specification.new do |spec|
spec.metadata["source_code_uri"] = "https://github.com/SuperGoodSoft/csrf_protection"
spec.metadata["changelog_uri"] = "https://github.com/SuperGoodSoft/csrf_protection/blob/main/CHANGELOG.md"

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
gemspec = File.basename(__FILE__)
spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls|
ls.readlines("\x0", chomp: true).reject do |f|
Expand All @@ -30,10 +28,4 @@ Gem::Specification.new do |spec|
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

# Uncomment to register a new dependency of your gem
# spec.add_dependency "example-gem", "~> 1.0"

# For more information and examples about making a new gem, check out our
# guide at: https://bundler.io/guides/creating_gem.html
end