Tools about security.txt for Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Update dependencies May 15, 2018
db Initial rails engine & middleware Jan 12, 2018
test Add a parser of security.txt Jan 15, 2018
.gitignore add .dea/ for rubymine users Feb 4, 2018
Gemfile Initial rails engine & middleware Jan 12, 2018
Gemfile.lock Update dependencies May 15, 2018
MIT-LICENSE Fix typo Jun 1, 2018
Rakefile Initial rails engine & middleware Jan 12, 2018
securitytxt.gemspec add command path and name Feb 4, 2018

Security.txt toolbox for your Ruby app

This gem provides a Rack middleware and matching Rails engine that will provide a nicely formatted security.txt for your application. It also includes a generator and parser of security.txt files.



Add this line to your application's Gemfile:

  gem 'securitytxt'

And then execute:

$ bundle

Using the Rails engine

Create an initializer with the policy you want to set:

# config/initializers/securitytxt.rb = ""
SecurityTxt.encryption = ""

Using the Rack middleware

Add the middleware to your chain in your

require 'securitytxt'

policy = {
  "contact" => "",
  "encryption" => ""
use SecurityTxt::Middleware, policy

Parsing a Security.txt

Simply passing a string should be enough to get data back

require "securitytxt/parser"
require "open-uri""").read)
# Outputs {"contact"=>"", "encryption"=>"", "acknowledgements"=>""}

Generating a Security.txt

require 'securitytxt/generator'
puts{"contact"=>"", "encryption"=>"", "acknowledgements"=>""}).generate
# Outputs
# Contact:
# Encryption:
# Acknowledgements:

CLI usage

Securitytxt - A CLI tool to parse and generate securitytxt content.

Help menu:
   -p, --parse FILE | URL           Parse securitytxt file or URL
   -g, --generate                   Generate a securitytxt string.
   -c, --contact DETAILS            List of contact details separated by comma(,) without spaces. (used with -g/--generate)
   -e, --encryption URL             Link to a page which contains your key.(used with -g/--generate)
   -a, --acknowledgements URL       Link to a page where security researchers are recognized for their reports.(used with -g/--generate)
   -h, --help                       Show this help message


The gem is available as open source under the terms of the MIT License.