http-headers-verifier 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f47911e699a60879db447c6d25411e367d65dfc7ef459db22bce8fff74613868
4
+ data.tar.gz: 9b16eacb1997b18effa0a7dfcdb1dfe7adfa476ad1c0d1270ac1e93da462d36a
5
+ SHA512:
6
+ metadata.gz: 464460fce9599c6f9c2a3bf4bdba6349237a5bcbede82611a56f6f7f9e5ac1cbc30e6ca485f4a32db27ad2b02df22e69653f2eff738a0e1fb95301f7eae951b3
7
+ data.tar.gz: c5546804ddc65920f3eedfe78d6646be858d9341244fbaf31bfc7e3f83341d21e3259c491905d0eac21598f81e1d371024c521aaed6e79f3a0ccd1b4af29da57
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1 @@
1
+ ruby >= 2.7.1
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.3
7
+ before_install: gem install bundler -v 1.17.2
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at israbirding@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ gemspec
@@ -0,0 +1,41 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ http-headers-verifier (0.0.1)
5
+ typhoeus (~> 1.4)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ byebug (9.1.0)
11
+ diff-lcs (1.4.4)
12
+ ethon (0.12.0)
13
+ ffi (>= 1.3.0)
14
+ ffi (1.13.1)
15
+ rspec (3.9.0)
16
+ rspec-core (~> 3.9.0)
17
+ rspec-expectations (~> 3.9.0)
18
+ rspec-mocks (~> 3.9.0)
19
+ rspec-core (3.9.2)
20
+ rspec-support (~> 3.9.3)
21
+ rspec-expectations (3.9.2)
22
+ diff-lcs (>= 1.2.0, < 2.0)
23
+ rspec-support (~> 3.9.0)
24
+ rspec-mocks (3.9.1)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.9.0)
27
+ rspec-support (3.9.3)
28
+ typhoeus (1.4.0)
29
+ ethon (>= 0.9.0)
30
+
31
+ PLATFORMS
32
+ ruby
33
+
34
+ DEPENDENCIES
35
+ bundler (~> 1.17)
36
+ byebug (~> 9.0)
37
+ http-headers-verifier!
38
+ rspec (~> 3.0)
39
+
40
+ BUNDLED WITH
41
+ 1.17.2
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Avner Cohen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,99 @@
1
+ # Http Headers Verifier
2
+
3
+ Verify a pre-defined HTTP headers configurations.
4
+ Unlike some other similar projects, this is not meant to enforce best practices, instead it is meant to define policies on top of headers and enforce them.
5
+ As a side effect, this means you can define specific OWASP (for example) best practices and verify them, but unlike testing for best practices, this is inteneded to verify an expected headers configuration behavior.
6
+
7
+ Relevant use cases are for example when updating nginx/caddy configuration or when moving from one web-server to another and expecting to maintain a specific set of header config.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'http-headers-verifier'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install http-headers-verifier
24
+
25
+ ### Usage
26
+
27
+ ```sh
28
+ usage: http-headers-verifier [comma seperated policy names] [url] [?verbose]
29
+ ```
30
+
31
+ #### Example
32
+
33
+ ```sh
34
+ $> ./http-headers-verifier.rb default,hs-default https://my.login.page/login verbose
35
+
36
+ Starting verification of policies default, hs-default, hs-production:
37
+ 🍏 Expected Header 'Cache-Control' matched!
38
+ 🍏 Expected Header 'Content-Type' matched!
39
+ 🍏 Expected Header 'Vary' matched!
40
+ 🍏 Expected Header 'Content-Security-Policy' matched!
41
+ 🍏 Expected Header 'Expires' matched!
42
+ 🍏 Expected Header 'X-Frame-Options' matched!
43
+ 🍏 Expected Header 'X-XSS-Protection' matched!
44
+ 🍏 Expected Header 'X-Content-Type-Options' matched!
45
+ 🍏 Expected Header 'X-Whoami' matched!
46
+ 🍏 Expected Header 'Strict-Transport-Security' matched!
47
+ 🍏 Extra Header 'date' marked for ignore!
48
+ 🍏 Extra Header 'content-length' marked for ignore!
49
+ 🍏 Cookie 'AWSALB' passed verification!
50
+ 🍏 Cookie 'AWSALBCORS' passed verification!
51
+ 🍏 Cookie 'session' passed verification!
52
+ 😎 Success !
53
+ ```
54
+
55
+ Or in non-verbose mode:
56
+
57
+ ```sh
58
+ $>./http-headers-verifier.rb default,hs-default https://my.login.page/loginlogin
59
+ Starting verification of policies default, hs-default, hs-production:
60
+ 🛑 Invalid cookie config 'COOKIE_NAME':
61
+ 👺 Cookie not secure.
62
+ 😱 Failed !
63
+ ```
64
+
65
+
66
+ ### Configuration
67
+
68
+ Policy configuration is a series of YAML files, with the following naming convention:
69
+ `headers-rules-*.yml`
70
+
71
+ Where \* is the policy named to be used in the command line.
72
+
73
+ Configuration has the following YMAL blockes:
74
+
75
+ ```yaml
76
+ ---
77
+ headers:
78
+
79
+ cookie_attr:
80
+
81
+ ignored_headers:
82
+
83
+ headers_to_avoid:
84
+
85
+ ```
86
+
87
+ [Example](headers-rules-example.yml)
88
+
89
+ ## Contributing
90
+
91
+ Bug reports and pull requests are welcome on GitHub at https://github.com/AvnerCohen/http-headers-verifier. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
92
+
93
+ ## License
94
+
95
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
96
+
97
+ ## Code of Conduct
98
+
99
+ Everyone interacting in the Http::Headers::Verifier project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/http-headers-verifier/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env ruby
2
+ require 'yaml'
3
+ require 'byebug'
4
+
5
+ require 'typhoeus'
6
+
7
+ require_relative './lib/naive_cookie'
8
+ require_relative './lib/http_headers_validations'
9
+ require_relative './lib/http_headers_utils'
10
+
11
+ FILE_NAME_PREFIX = 'headers-rules-'
12
+ HTTP_TIMEOUT_IN_SECONDS = 3
13
+
14
+ if ARGV.length != 3 && ARGV.length != 2
15
+ print "usage: http-headers-verifier.rb [comma seperated policy names] [url] [?verbose]"
16
+ exit 2
17
+ end
18
+
19
+ policy_arg, url, verbose = ARGV
20
+ @policies = policy_arg.split(',')
21
+
22
+ HttpHeadersUtils.verbose = !verbose.nil?
23
+
24
+ actual_headers = Typhoeus.get(url, timeout: HTTP_TIMEOUT_IN_SECONDS, followlocation: true).headers
25
+
26
+ def verify_headers!(actual_headers, rules)
27
+ puts "Starting verification of policies #{HttpHeadersUtils.bold(@policies.join(", "))}:"
28
+ errors = []
29
+ checked_already = Set.new
30
+ rules[:headers].each do |expected_pair|
31
+ expected_header = expected_pair.keys[0]
32
+ expected_value = expected_pair[expected_header]
33
+ actual_value = actual_headers[expected_header]
34
+ checked_already.add(expected_header.downcase)
35
+ epected_header_error = HttpHeadersValidations.assert_expected_header(expected_header, expected_value, actual_value)
36
+ errors.push(epected_header_error) unless epected_header_error.nil?
37
+ end
38
+
39
+ actual_headers.each do |expected_pair|
40
+ actual_header, actual_value = expected_pair[0]
41
+ next if checked_already.include? actual_header
42
+ next if actual_header.downcase == 'set-cookie'
43
+ actual_value = actual_headers[actual_header]
44
+ actual_header_errors = HttpHeadersValidations.assert_extra_header(actual_header, actual_value,
45
+ rules[:ignored_headers], rules[:headers_to_avoid])
46
+ errors.push(actual_header_errors) unless actual_header_errors.nil?
47
+ end
48
+
49
+ unless actual_headers["set-cookie"].nil?
50
+ [actual_headers["set-cookie"]].flatten.each do |cookie_str|
51
+ parsed_cookie = NaiveCookie.new(cookie_str)
52
+ error_text, failed = HttpHeadersValidations.assert_cookie_value(parsed_cookie, rules[:cookie_attr])
53
+ errors.push(error_text) if failed
54
+ end
55
+ end
56
+
57
+ if errors.compact.length > 0
58
+ return false
59
+ else
60
+ return true
61
+ end
62
+ end
63
+
64
+ def read_policies!(policy_files_names)
65
+ settings = {headers: [], ignored_headers: [], cookie_attr: {}, headers_to_avoid: []}
66
+ policy_files_names.each do |policy_name|
67
+ policy_data = YAML.load_file("./#{FILE_NAME_PREFIX}#{policy_name}.yml")
68
+
69
+ settings[:headers].push(policy_data['headers']) unless policy_data['headers'].nil?
70
+ settings[:ignored_headers].push(policy_data['ignored_headers']) unless policy_data['ignored_headers'].nil?
71
+ settings[:cookie_attr].merge!(policy_data['cookie_attr']) unless policy_data['cookie_attr'].nil?
72
+ settings[:headers_to_avoid].push(policy_data['headers_to_avoid']) unless policy_data['headers_to_avoid'].nil?
73
+ end
74
+
75
+ settings[:headers].flatten!
76
+ settings[:ignored_headers] = settings[:ignored_headers].uniq.flatten.map(&:downcase)
77
+ settings[:headers_to_avoid] = settings[:headers_to_avoid].uniq.flatten.map(&:downcase)
78
+
79
+ return settings
80
+ end
81
+
82
+
83
+ if verify_headers!(actual_headers, read_policies!(@policies))
84
+ puts "😎 Success !"
85
+ exit 0
86
+ else
87
+ puts "😱 Failed !"
88
+ exit 1
89
+ end
90
+
91
+
@@ -0,0 +1,14 @@
1
+ ---
2
+ headers_to_avoid:
3
+ - X-Powered-By
4
+ - X-Aspnet-Version
5
+ - Via
6
+ - Server
7
+ - X-Cache
8
+ - X-Request-Id
9
+ - X-AspNet-Version
10
+ - X-Amzd-Requestid
11
+ ignored_headers:
12
+ - Date
13
+ - Content-Length
14
+
@@ -0,0 +1,21 @@
1
+ ---
2
+ headers:
3
+ - Cache-Control: no-store
4
+ - Content-Type: text/html; charset=UTF-8
5
+ - Vary: 'Accept-Encoding'
6
+ - Content-Security-Policy: "block-all-mixed-content;img-src 'self' blob: data:"
7
+ - Expires: 0
8
+ - X-Frame-Options: SAMEORIGIN
9
+ - X-XSS-Protection: 1; mode=block
10
+ - Strict-Transport-Security: max-age=31536000;
11
+ - X-Content-Type-Options: nosniff
12
+ cookie_attr:
13
+ session:
14
+ - Path: /
15
+ - Secured: true
16
+ - HttpOnly: true
17
+ - SameSite: None
18
+ ignored_headers:
19
+ - Content-Length
20
+ - Date
21
+ - Set-Cookie
@@ -0,0 +1,41 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require_relative "./lib/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "http-headers-verifier"
8
+ spec.version = HttpHeadersVerifier::VERSION
9
+ spec.authors = ["Avner Cohen"]
10
+ spec.email = ["israbirding@gmail.com"]
11
+
12
+ spec.summary = %q{Verify a pre-defined HTTP headers configurations.}
13
+ spec.description = %q{Verify a pre-defined HTTP headers configurations. Unlike some other similar projects, this is not meant to enforce best practices, instead it is meant to define policies on top of headers and enforce them.}
14
+ spec.homepage = "https://github.com/AvnerCohen/http-headers-verifier"
15
+ spec.license = "MIT"
16
+
17
+ if spec.respond_to?(:metadata)
18
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
19
+
20
+ spec.metadata["homepage_uri"] = spec.homepage
21
+ # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
22
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
23
+ else
24
+ raise "RubyGems 2.0 or newer is required to protect against " \
25
+ "public gem pushes."
26
+ end
27
+
28
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
29
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
30
+ end
31
+ spec.bindir = "exe"
32
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
+ spec.require_paths = ["lib"]
34
+
35
+ spec.add_development_dependency "bundler", "~> 1.17"
36
+ spec.add_development_dependency "rspec", "~> 3.0"
37
+ spec.add_development_dependency "byebug", "~> 9.0"
38
+
39
+ spec.add_runtime_dependency "typhoeus", "~> 1.4"
40
+
41
+ end
@@ -0,0 +1,11 @@
1
+ module HttpHeadersUtils
2
+
3
+ class << self
4
+ attr_accessor :verbose
5
+ end
6
+
7
+ def self.bold(str)
8
+ "\e[1m#{str}\e[22m"
9
+ end
10
+
11
+ end
@@ -0,0 +1,68 @@
1
+ require_relative './http_headers_utils'
2
+
3
+ module HttpHeadersValidations
4
+
5
+ def self.report(text, failed, icon)
6
+ if failed || HttpHeadersUtils.verbose
7
+ puts "\t#{icon} #{text}"
8
+ end
9
+ end
10
+
11
+ def self.assert_expected_header(expected_header, expected_value, actual_value)
12
+ if (expected_value.is_a?(Regexp) && actual_value.match?(expected_value)) ||
13
+ (expected_value.to_s == actual_value.to_s)
14
+ failed = false
15
+ text = "Expected Header '#{expected_header}' matched!"
16
+ else
17
+ failed = true
18
+ text = "Expected Header '#{HttpHeadersUtils.bold(expected_header)}' failed! '#{expected_value}' was '#{actual_value}'."
19
+ end
20
+ icon = failed ? "🛑" : "🍏"
21
+
22
+ report(text, failed, icon)
23
+
24
+ return text if failed
25
+ end
26
+
27
+ def self.assert_extra_header(actual_header, actual_value, ignored_headers, avoid_headers)
28
+
29
+ if avoid_headers.include? actual_header.downcase
30
+ icon = "🛑"
31
+ failed = true
32
+ text = "Extra Header '#{actual_header}' is not allowed!"
33
+ elsif ignored_headers.include? actual_header.downcase
34
+ icon = "🍏"
35
+ failed = false
36
+ text = "Extra Header '#{actual_header}' marked for ignore!"
37
+ else
38
+ icon = "⚠️"
39
+ failed = false
40
+ text = "Warning: Extra Header '#{HttpHeadersUtils.bold(actual_header)}' with value '#{actual_value}' wasn't unexpected."
41
+ end
42
+
43
+ report(text, failed, icon)
44
+
45
+ return text if failed
46
+ end
47
+
48
+ def self.assert_cookie_value(parsed_cookie, cookie_rules)
49
+ if cookie_rules[parsed_cookie.name]
50
+ valid_cookie = parsed_cookie.validate!(cookie_rules[parsed_cookie.name])
51
+ if valid_cookie.nil?
52
+ failed = false
53
+ text = "Cookie '#{parsed_cookie.name}' passed verification!"
54
+ else
55
+ failed = true
56
+ text = "Invalid cookie config '#{HttpHeadersUtils.bold(parsed_cookie.name)}':\n #{valid_cookie.join("\n")}"
57
+ end
58
+ else
59
+ failed = true
60
+ text = "Missing config for cookie '#{HttpHeadersUtils.bold(parsed_cookie.name)}'."
61
+ end
62
+ icon = failed ? "🛑" : "🍏"
63
+
64
+ report(text, failed, icon)
65
+ return [text, failed]
66
+ end
67
+
68
+ end
@@ -0,0 +1,69 @@
1
+ class NaiveCookie
2
+ # Super naive cookie implementation
3
+ # It is not meant in any way to check the validity of the cookie
4
+ # It is only meant to check specific properties of cookies that are assumed to be present.
5
+
6
+ def initialize(cookie_str)
7
+ @data = cookie_str.split("; ").map{ |s|
8
+ s.index('=') ? s.split('=') : [s, true]
9
+ }.to_h
10
+ end
11
+
12
+ def validate!(rules)
13
+ errors = []
14
+
15
+ if rules.key?("Path") && self.path != rules["Path"]
16
+ errors.push(error("Path #{self.path} not matching #{rules["Path"]}."))
17
+ end
18
+
19
+ if rules.key?("Secure") && self.secure? != rules["Secure"]
20
+ errors.push(error("Cookie not secure."))
21
+ end
22
+
23
+ if rules.key?("HttpOnly") && self.http_only? != rules["HttpOnly"]
24
+ errors.push(error("Cookie expected to be set as HttpOnly."))
25
+ end
26
+
27
+ if rules.key?("SameSite") && self.same_site != rules["SameSite"]
28
+ errors.push(error("SameSite #{self.same_site} not matching #{rules["SameSite"]}."))
29
+ end
30
+
31
+ if errors.length > 0
32
+ return errors
33
+ else
34
+ return nil
35
+ end
36
+ end
37
+
38
+ def error(text)
39
+ return "\t\t👺 #{text}"
40
+ end
41
+
42
+ def to_s
43
+ "#{self.name}, #{self.path}"
44
+ end
45
+
46
+ def secure?
47
+ !@data.keys.find{ |item| item.downcase == "secure"}.nil?
48
+ end
49
+
50
+ def http_only?
51
+ !@data.keys.find{ |item| item.downcase == "httponly"}.nil?
52
+ end
53
+
54
+ def same_site
55
+ @data[@data.keys.find{ |item| item.downcase == "samesite"}]
56
+ end
57
+
58
+ def path
59
+ @data[@data.keys.find{ |item| item.downcase == "path"}]
60
+ end
61
+
62
+ def name
63
+ @data.keys[0]
64
+ end
65
+
66
+ def expires
67
+ @data[@data.keys.find{ |item| item.downcase == "expires"}]
68
+ end
69
+ end
@@ -0,0 +1,3 @@
1
+ module HttpHeadersVerifier
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: http-headers-verifier
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Avner Cohen
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-07-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: byebug
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '9.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '9.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: typhoeus
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.4'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.4'
69
+ description: Verify a pre-defined HTTP headers configurations. Unlike some other similar
70
+ projects, this is not meant to enforce best practices, instead it is meant to define
71
+ policies on top of headers and enforce them.
72
+ email:
73
+ - israbirding@gmail.com
74
+ executables:
75
+ - http-headers-verifier.rb
76
+ extensions: []
77
+ extra_rdoc_files: []
78
+ files:
79
+ - ".gitignore"
80
+ - ".rspec"
81
+ - ".tool-versions"
82
+ - ".travis.yml"
83
+ - CODE_OF_CONDUCT.md
84
+ - Gemfile
85
+ - Gemfile.lock
86
+ - LICENSE.txt
87
+ - README.md
88
+ - exe/http-headers-verifier.rb
89
+ - headers-rules-default.yml
90
+ - headers-rules-example.yml
91
+ - http-headers-verifier.gemspec
92
+ - lib/http_headers_utils.rb
93
+ - lib/http_headers_validations.rb
94
+ - lib/naive_cookie.rb
95
+ - lib/version.rb
96
+ homepage: https://github.com/AvnerCohen/http-headers-verifier
97
+ licenses:
98
+ - MIT
99
+ metadata:
100
+ allowed_push_host: https://rubygems.org
101
+ homepage_uri: https://github.com/AvnerCohen/http-headers-verifier
102
+ post_install_message:
103
+ rdoc_options: []
104
+ require_paths:
105
+ - lib
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ requirements: []
117
+ rubygems_version: 3.0.3
118
+ signing_key:
119
+ specification_version: 4
120
+ summary: Verify a pre-defined HTTP headers configurations.
121
+ test_files: []