veracode_api_signing 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/codeql-analysis.yml +70 -0
- data/.github/workflows/tests.yml +53 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +27 -0
- data/.rubocop_todo.yml +87 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +78 -0
- data/LICENSE.txt +21 -0
- data/README.md +52 -0
- data/Rakefile +28 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/veracode_api_signing/credentials.rb +57 -0
- data/lib/veracode_api_signing/exception.rb +12 -0
- data/lib/veracode_api_signing/formatters.rb +41 -0
- data/lib/veracode_api_signing/hmac_auth.rb +78 -0
- data/lib/veracode_api_signing/plugins/faraday_middleware.rb +57 -0
- data/lib/veracode_api_signing/regions.rb +31 -0
- data/lib/veracode_api_signing/utils.rb +57 -0
- data/lib/veracode_api_signing/validation.rb +91 -0
- data/lib/veracode_api_signing/version.rb +5 -0
- data/lib/veracode_api_signing.rb +7 -0
- data/shell.nix +84 -0
- data/veracode_api_signing.gemspec +43 -0
- metadata +214 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 81116e99b04c7860e24ea32f2f2aaee4d8c84f8b45d094acfbeb89b668198a06
|
4
|
+
data.tar.gz: 85540edb0fe3b0e723bc2260f70bc980e135845a2fe8d561c8677926b0b92f62
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e101221d2ef7f19af442c2a7e2c47e4fae6af13d40b8ada771b08554db6cf4d6ccbd9efe550ac1adbdf7ee796408c0bd90ccedeed77bd324437e46ffc63e026f
|
7
|
+
data.tar.gz: ee9f009356caa2b78ed466cefedccc50974ee70ed4f0de0f5a7e69255e670b2c121648a1ae879183a1a496fba4eb9b867739adef215e8f83030ef1af537b37a2
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
2
|
+
# to commit it to your repository.
|
3
|
+
#
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
5
|
+
# or to provide custom queries or build logic.
|
6
|
+
#
|
7
|
+
# ******** NOTE ********
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
10
|
+
# supported CodeQL languages.
|
11
|
+
#
|
12
|
+
name: "CodeQL"
|
13
|
+
|
14
|
+
on:
|
15
|
+
push:
|
16
|
+
branches: [ main ]
|
17
|
+
pull_request:
|
18
|
+
# The branches below must be a subset of the branches above
|
19
|
+
branches: [ main ]
|
20
|
+
schedule:
|
21
|
+
- cron: '29 8 * * 5'
|
22
|
+
|
23
|
+
jobs:
|
24
|
+
analyze:
|
25
|
+
name: Analyze
|
26
|
+
runs-on: ubuntu-latest
|
27
|
+
permissions:
|
28
|
+
actions: read
|
29
|
+
contents: read
|
30
|
+
security-events: write
|
31
|
+
|
32
|
+
strategy:
|
33
|
+
fail-fast: false
|
34
|
+
matrix:
|
35
|
+
language: [ 'ruby' ]
|
36
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
37
|
+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
38
|
+
|
39
|
+
steps:
|
40
|
+
- name: Checkout repository
|
41
|
+
uses: actions/checkout@v2
|
42
|
+
|
43
|
+
# Initializes the CodeQL tools for scanning.
|
44
|
+
- name: Initialize CodeQL
|
45
|
+
uses: github/codeql-action/init@v1
|
46
|
+
with:
|
47
|
+
languages: ${{ matrix.language }}
|
48
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
49
|
+
# By default, queries listed here will override any specified in a config file.
|
50
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
51
|
+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
52
|
+
|
53
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
54
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
55
|
+
- name: Autobuild
|
56
|
+
uses: github/codeql-action/autobuild@v1
|
57
|
+
|
58
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
59
|
+
# 📚 https://git.io/JvXDl
|
60
|
+
|
61
|
+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
62
|
+
# and modify them (or add more) to build your code if your project
|
63
|
+
# uses a compiled language
|
64
|
+
|
65
|
+
#- run: |
|
66
|
+
# make bootstrap
|
67
|
+
# make release
|
68
|
+
|
69
|
+
- name: Perform CodeQL Analysis
|
70
|
+
uses: github/codeql-action/analyze@v1
|
@@ -0,0 +1,53 @@
|
|
1
|
+
name: VeracodeApiSigning
|
2
|
+
on:
|
3
|
+
pull_request:
|
4
|
+
branches-ignore:
|
5
|
+
- 'gh-pages'
|
6
|
+
push:
|
7
|
+
branches-ignore:
|
8
|
+
- 'gh-pages'
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
strategy:
|
12
|
+
fail-fast: false
|
13
|
+
matrix:
|
14
|
+
os: [ubuntu-latest, macos-latest]
|
15
|
+
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
|
16
|
+
ruby: [2.7, '3.0', truffleruby, truffleruby-head]
|
17
|
+
runs-on: ${{ matrix.os }}
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v2
|
20
|
+
- uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby }}
|
23
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
24
|
+
- run: bundle exec rake
|
25
|
+
|
26
|
+
deploy:
|
27
|
+
needs: test
|
28
|
+
if: github.ref == 'refs/heads/main'
|
29
|
+
runs-on: ubuntu-latest
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@v2
|
32
|
+
with:
|
33
|
+
persist-credentials: false
|
34
|
+
|
35
|
+
- uses: ruby/setup-ruby@v1
|
36
|
+
with:
|
37
|
+
ruby-version: '3.0'
|
38
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
39
|
+
|
40
|
+
- name: Yard documents
|
41
|
+
run: |
|
42
|
+
bundle exec rake yard
|
43
|
+
|
44
|
+
- name: Deploy pages
|
45
|
+
if: github.event_name == 'push'
|
46
|
+
uses: JamesIves/github-pages-deploy-action@4.1.5
|
47
|
+
with:
|
48
|
+
SSH: false
|
49
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
50
|
+
BRANCH: gh-pages
|
51
|
+
FOLDER: doc
|
52
|
+
CLEAN: true
|
53
|
+
CLEAN_EXCLUDE: '[".gitattributes", ".gitignore", "CNAME", "LICENSE"]'
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
require:
|
4
|
+
- rubocop-performance
|
5
|
+
- rubocop-rake
|
6
|
+
- rubocop-rspec
|
7
|
+
|
8
|
+
AllCops:
|
9
|
+
NewCops: enable
|
10
|
+
TargetRubyVersion: 2.7
|
11
|
+
|
12
|
+
Style/StringLiterals:
|
13
|
+
Enabled: true
|
14
|
+
EnforcedStyle: double_quotes
|
15
|
+
|
16
|
+
Style/StringLiteralsInInterpolation:
|
17
|
+
Enabled: true
|
18
|
+
EnforcedStyle: double_quotes
|
19
|
+
|
20
|
+
RSpec/ExampleLength:
|
21
|
+
Max: 50
|
22
|
+
|
23
|
+
RSpec/NestedGroups:
|
24
|
+
Max: 4
|
25
|
+
|
26
|
+
Metrics/BlockLength:
|
27
|
+
Max: 100
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2021-10-29 23:02:10 UTC using RuboCop version 1.22.3.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# Configuration parameters: Include.
|
11
|
+
# Include: **/*.gemspec
|
12
|
+
Gemspec/RequiredRubyVersion:
|
13
|
+
Exclude:
|
14
|
+
- 'veracode_api_signing.gemspec'
|
15
|
+
|
16
|
+
# Offense count: 1
|
17
|
+
# Cop supports --auto-correct.
|
18
|
+
# Configuration parameters: EnforcedStyle.
|
19
|
+
# SupportedStyles: runtime_error, standard_error
|
20
|
+
Lint/InheritException:
|
21
|
+
Exclude:
|
22
|
+
- 'lib/veracode_api_signing/exception.rb'
|
23
|
+
|
24
|
+
# Offense count: 1
|
25
|
+
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
26
|
+
Metrics/AbcSize:
|
27
|
+
Max: 38
|
28
|
+
|
29
|
+
# Offense count: 5
|
30
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
31
|
+
Metrics/MethodLength:
|
32
|
+
Max: 15
|
33
|
+
|
34
|
+
# Offense count: 1
|
35
|
+
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
36
|
+
Metrics/ParameterLists:
|
37
|
+
Max: 6
|
38
|
+
|
39
|
+
# Offense count: 3
|
40
|
+
Naming/AccessorMethodName:
|
41
|
+
Exclude:
|
42
|
+
- 'lib/veracode_api_signing/credentials.rb'
|
43
|
+
- 'lib/veracode_api_signing/utils.rb'
|
44
|
+
|
45
|
+
# Offense count: 3
|
46
|
+
# Configuration parameters: ForbiddenDelimiters.
|
47
|
+
# ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
|
48
|
+
Naming/HeredocDelimiterNaming:
|
49
|
+
Exclude:
|
50
|
+
- 'spec/veracode_api_signing/credentials_spec.rb'
|
51
|
+
|
52
|
+
# Offense count: 2
|
53
|
+
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
|
54
|
+
# Include: **/*_spec*rb*, **/spec/**/*
|
55
|
+
RSpec/FilePath:
|
56
|
+
Exclude:
|
57
|
+
- 'spec/veracode_api_signing/exception_spec.rb'
|
58
|
+
- 'spec/veracode_api_signing/version_spec.rb'
|
59
|
+
|
60
|
+
# Offense count: 8
|
61
|
+
# Configuration parameters: AllowedConstants.
|
62
|
+
Style/Documentation:
|
63
|
+
Exclude:
|
64
|
+
- 'spec/**/*'
|
65
|
+
- 'test/**/*'
|
66
|
+
- 'lib/veracode_api_signing.rb'
|
67
|
+
- 'lib/veracode_api_signing/credentials.rb'
|
68
|
+
- 'lib/veracode_api_signing/formatters.rb'
|
69
|
+
- 'lib/veracode_api_signing/hmac_auth.rb'
|
70
|
+
- 'lib/veracode_api_signing/plugins/faraday_middleware.rb'
|
71
|
+
- 'lib/veracode_api_signing/regions.rb'
|
72
|
+
- 'lib/veracode_api_signing/utils.rb'
|
73
|
+
- 'lib/veracode_api_signing/validation.rb'
|
74
|
+
|
75
|
+
# Offense count: 4
|
76
|
+
# Configuration parameters: MinBodyLength.
|
77
|
+
Style/GuardClause:
|
78
|
+
Exclude:
|
79
|
+
- 'lib/veracode_api_signing/hmac_auth.rb'
|
80
|
+
- 'lib/veracode_api_signing/validation.rb'
|
81
|
+
|
82
|
+
# Offense count: 14
|
83
|
+
# Cop supports --auto-correct.
|
84
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
85
|
+
# URISchemes: http, https
|
86
|
+
Layout/LineLength:
|
87
|
+
Max: 312
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
veracode_api_signing (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.2)
|
10
|
+
brakeman (5.1.2)
|
11
|
+
diff-lcs (1.4.4)
|
12
|
+
docile (1.4.0)
|
13
|
+
parallel (1.21.0)
|
14
|
+
parser (3.0.2.0)
|
15
|
+
ast (~> 2.4.1)
|
16
|
+
rainbow (3.0.0)
|
17
|
+
rake (13.0.6)
|
18
|
+
regexp_parser (2.1.1)
|
19
|
+
rexml (3.2.5)
|
20
|
+
rspec (3.10.0)
|
21
|
+
rspec-core (~> 3.10.0)
|
22
|
+
rspec-expectations (~> 3.10.0)
|
23
|
+
rspec-mocks (~> 3.10.0)
|
24
|
+
rspec-core (3.10.1)
|
25
|
+
rspec-support (~> 3.10.0)
|
26
|
+
rspec-expectations (3.10.1)
|
27
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
+
rspec-support (~> 3.10.0)
|
29
|
+
rspec-mocks (3.10.2)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.10.0)
|
32
|
+
rspec-support (3.10.2)
|
33
|
+
rubocop (1.22.3)
|
34
|
+
parallel (~> 1.10)
|
35
|
+
parser (>= 3.0.0.0)
|
36
|
+
rainbow (>= 2.2.2, < 4.0)
|
37
|
+
regexp_parser (>= 1.8, < 3.0)
|
38
|
+
rexml
|
39
|
+
rubocop-ast (>= 1.12.0, < 2.0)
|
40
|
+
ruby-progressbar (~> 1.7)
|
41
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
42
|
+
rubocop-ast (1.12.0)
|
43
|
+
parser (>= 3.0.1.1)
|
44
|
+
rubocop-performance (1.11.5)
|
45
|
+
rubocop (>= 1.7.0, < 2.0)
|
46
|
+
rubocop-ast (>= 0.4.0)
|
47
|
+
rubocop-rake (0.6.0)
|
48
|
+
rubocop (~> 1.0)
|
49
|
+
rubocop-rspec (2.5.0)
|
50
|
+
rubocop (~> 1.19)
|
51
|
+
ruby-progressbar (1.11.0)
|
52
|
+
simplecov (0.21.2)
|
53
|
+
docile (~> 1.1)
|
54
|
+
simplecov-html (~> 0.11)
|
55
|
+
simplecov_json_formatter (~> 0.1)
|
56
|
+
simplecov-html (0.12.3)
|
57
|
+
simplecov_json_formatter (0.1.3)
|
58
|
+
unicode-display_width (2.1.0)
|
59
|
+
yard (0.9.26)
|
60
|
+
|
61
|
+
PLATFORMS
|
62
|
+
ruby
|
63
|
+
|
64
|
+
DEPENDENCIES
|
65
|
+
brakeman (~> 5.1)
|
66
|
+
bundler (~> 2.0)
|
67
|
+
rake (~> 13.0)
|
68
|
+
rspec (~> 3.0)
|
69
|
+
rubocop (~> 1.2)
|
70
|
+
rubocop-performance (~> 1.1)
|
71
|
+
rubocop-rake (~> 0.6)
|
72
|
+
rubocop-rspec (~> 2.5)
|
73
|
+
simplecov (~> 0.21.2)
|
74
|
+
veracode_api_signing!
|
75
|
+
yard (~> 0.9.26)
|
76
|
+
|
77
|
+
BUNDLED WITH
|
78
|
+
2.2.30
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Corban Raun
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# VeracodeApiSigning
|
2
|
+
|
3
|
+
![tests](https://github.com/CorbanR/veracode_api_signing/actions/workflows/tests.yml/badge.svg)
|
4
|
+
|
5
|
+
Library which uses HMAC to generate signed requests for Veracode API
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'veracode_api_signing'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install veracode_api_signing
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
### Nix development
|
34
|
+
If you have [nix](https://nixos.org/download.html) installed, you can run
|
35
|
+
- `nix-shell`
|
36
|
+
- `gem install bundler`
|
37
|
+
- `bundle install`
|
38
|
+
- `bundle exec rspec`
|
39
|
+
|
40
|
+
Optional tools
|
41
|
+
- [direnv](https://direnv.net/)
|
42
|
+
- [lorri](https://github.com/target/lorri)
|
43
|
+
|
44
|
+
**NOTE:** At some point [nix flakes](https://nixos.wiki/wiki/Flakes) will become stable, and, if you choose to use something like `lorri`, you can just use `nix` with `direnv`!
|
45
|
+
|
46
|
+
## Contributing
|
47
|
+
|
48
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/veracode_api_signing.
|
49
|
+
|
50
|
+
## License
|
51
|
+
|
52
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
|
8
|
+
require "rubocop/rake_task"
|
9
|
+
|
10
|
+
RuboCop::RakeTask.new
|
11
|
+
|
12
|
+
require "yard"
|
13
|
+
|
14
|
+
YARD::Rake::YardocTask.new
|
15
|
+
|
16
|
+
namespace :brakeman do
|
17
|
+
desc "Run Brakeman"
|
18
|
+
task :run, :output_files do |_t, args|
|
19
|
+
require "brakeman"
|
20
|
+
|
21
|
+
files = args[:output_files].split if args[:output_files]
|
22
|
+
Brakeman.run app_path: ".", output_files: files, print_report: true, run_all_checks: true, force_scan: true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
multitask mytasks: %i[spec rubocop yard brakeman:run]
|
27
|
+
|
28
|
+
task default: %i[mytasks]
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "veracode_api_signing"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "veracode_api_signing/exception"
|
4
|
+
|
5
|
+
module VeracodeApiSigning
|
6
|
+
class Credentials
|
7
|
+
PROFILE_DEFAULT = "default"
|
8
|
+
|
9
|
+
ENV_API_KEY_NAME = "VERACODE_API_KEY_ID"
|
10
|
+
ENV_API_SECRET_KEY_NAME = "VERACODE_API_KEY_SECRET"
|
11
|
+
ENV_PROFILE = "VERACODE_API_PROFILE"
|
12
|
+
|
13
|
+
FIX_INSTRUCTIONS = "Please consult the documentation to get your Veracode credentials set up."
|
14
|
+
|
15
|
+
# Get credentials from supported sources. Precedence is 1) env vars, 2) file.
|
16
|
+
def get_credentials(auth_file = "#{Dir.home}/.veracode/credentials")
|
17
|
+
credentials_from_environment = get_credentials_from_environment_variables
|
18
|
+
return credentials_from_environment if credentials_from_environment.compact.length == 2
|
19
|
+
|
20
|
+
credentials_from_filesystem = get_credentials_from_filesystem(auth_file)
|
21
|
+
if credentials_from_filesystem.compact.length == 2
|
22
|
+
credentials_from_filesystem
|
23
|
+
else
|
24
|
+
raise VeracodeApiSigning::CredentialsError,
|
25
|
+
"Unable to determine credentials. Set environment variables #{ENV_API_KEY_NAME}, and #{ENV_API_SECRET_KEY_NAME} or create credentials file #{Dir.home}/.veracode/credentials"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def get_credentials_from_environment_variables
|
32
|
+
[ENV[ENV_API_KEY_NAME], ENV[ENV_API_SECRET_KEY_NAME]]
|
33
|
+
end
|
34
|
+
|
35
|
+
def get_credentials_from_filesystem(auth_file)
|
36
|
+
unless File.exist?(auth_file)
|
37
|
+
raise VeracodeApiSigning::CredentialsError,
|
38
|
+
"Could not read credentials file #{auth_file}"
|
39
|
+
end
|
40
|
+
|
41
|
+
credentials_section_name = get_credentials_profile
|
42
|
+
raw_creds = File.read(auth_file)
|
43
|
+
api_key_id = raw_creds.match(/(\[#{credentials_section_name}\].*\n)(.*#{ENV_API_KEY_NAME.downcase}.*=)(.*\S)/) do |g|
|
44
|
+
g[3]
|
45
|
+
end&.strip&.tr('"', "")
|
46
|
+
api_secret_key = raw_creds.match(/(\[#{credentials_section_name}\].*\n)(.*\n#{ENV_API_SECRET_KEY_NAME.downcase}.*=)(.*\S)/) do |g|
|
47
|
+
g[3]
|
48
|
+
end&.strip&.tr('"', "")
|
49
|
+
|
50
|
+
[api_key_id, api_secret_key]
|
51
|
+
end
|
52
|
+
|
53
|
+
def get_credentials_profile
|
54
|
+
ENV.fetch(ENV_PROFILE, PROFILE_DEFAULT)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module VeracodeApiSigning
|
4
|
+
# Generic error thrown when anything goes wrong
|
5
|
+
class Exception < StandardError; end
|
6
|
+
|
7
|
+
# Thrown if there is anything Veracode credentials, such as not found, improper format ... etc
|
8
|
+
class CredentialsError < Exception; end
|
9
|
+
|
10
|
+
# Thrown if there is anything Veracode credentials, such as not found, improper format ... etc
|
11
|
+
class UnsupportedAuthSchemeException < CredentialsError; end
|
12
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "veracode_api_signing/regions"
|
4
|
+
|
5
|
+
module VeracodeApiSigning
|
6
|
+
module Formatters
|
7
|
+
include Regions
|
8
|
+
# @param api_key_id [String] the veracode api key
|
9
|
+
# @param host [String] the url host
|
10
|
+
# @param url [String] the url path
|
11
|
+
# @param method [String] method to use [get, post, put, patch, delete]
|
12
|
+
# @example
|
13
|
+
# format_signing_data("0123456789abcdef", "veracode.com", "/home", "GET") #=> "id=0123456789abcdef&host=veracode.com&url=/home&method=GET"
|
14
|
+
# @example
|
15
|
+
# format_signing_data("0123456789abcdef", "VERACODE.com", "/home", "get") #=> "id=0123456789abcdef&host=veracode.com&url=/home&method=GET"
|
16
|
+
# @return [String] the formatted signing data
|
17
|
+
def format_signing_data(api_key_id, host, url, method)
|
18
|
+
# Ensure some things are in the right case.
|
19
|
+
# Note: that path (url) is allowed to be case-sensitive (because path is sent along verbatim)
|
20
|
+
api_key_id = remove_prefix_from_api_credential(api_key_id).downcase
|
21
|
+
host = host.downcase
|
22
|
+
method = method.upcase
|
23
|
+
|
24
|
+
"id=#{api_key_id}&host=#{host}&url=#{url}&method=#{method}"
|
25
|
+
end
|
26
|
+
|
27
|
+
# @param auth_scheme [String] the veracode auth scheme
|
28
|
+
# @param api_key_id [String] the veracode api key
|
29
|
+
# @param timestamp [String] the epoch timestamp
|
30
|
+
# @param nonce [String] the random nonce
|
31
|
+
# @param signature [String] the veracode signature
|
32
|
+
# @example
|
33
|
+
# format_veracode_hmac_header(auth_scheme="VERACODE-HMAC-SHA-256", api_key_id="702a1650", timestamp="1445452792746", nonce="3b1974fbaa7c97cc", signature="b81c0315b8df360778083d1b408916f8") => "VERACODE-HMAC-SHA-256 id=702a1650,ts=1445452792746,nonce=3b1974fbaa7c97cc,sig=b81c0315b8df360778083d1b408916f8"
|
34
|
+
# @return [String] the formatted hmac header
|
35
|
+
def format_veracode_hmac_header(auth_scheme, api_key_id, timestamp, nonce, signature)
|
36
|
+
# NOTE: This should _NOT_ manipulate case and so-on, that would likely break things.
|
37
|
+
api_key_id = remove_prefix_from_api_credential(api_key_id)
|
38
|
+
"#{auth_scheme} id=#{api_key_id},ts=#{timestamp},nonce=#{nonce},sig=#{signature}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "openssl"
|
4
|
+
require "veracode_api_signing/exception"
|
5
|
+
require "veracode_api_signing/formatters"
|
6
|
+
require "veracode_api_signing/regions"
|
7
|
+
require "veracode_api_signing/utils"
|
8
|
+
require "veracode_api_signing/validation"
|
9
|
+
|
10
|
+
module VeracodeApiSigning
|
11
|
+
class HMACAuth
|
12
|
+
include Validation
|
13
|
+
include Utils
|
14
|
+
include Formatters
|
15
|
+
include Regions
|
16
|
+
|
17
|
+
DEFAULT_AUTH_SCHEME = "VERACODE-HMAC-SHA-256"
|
18
|
+
|
19
|
+
# @param host [String] The host of the request("api.veracode.com")
|
20
|
+
# @param path [String] The path of the request("/v1/results")
|
21
|
+
# @param method [String] The method of the request("GET", "POST")
|
22
|
+
# @param api_key_id [String] The user's API key
|
23
|
+
# @param api_key_secret [String] The user's API secret key
|
24
|
+
# @param auth_scheme [String] What authentication algorithm will be used to create the signature of the request
|
25
|
+
# @return [String] The value of Veracode compliant HMAC header
|
26
|
+
def generate_veracode_hmac_header(host, path, method, api_key_id, api_key_secret, auth_scheme = DEFAULT_AUTH_SCHEME)
|
27
|
+
signing_data = format_signing_data(api_key_id, host, path, method)
|
28
|
+
timestamp = get_current_timestamp
|
29
|
+
nonce = generate_nonce
|
30
|
+
signature = create_signature(auth_scheme, api_key_secret, signing_data, timestamp, nonce)
|
31
|
+
format_veracode_hmac_header(auth_scheme, api_key_id, timestamp, nonce, signature)
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
# @param auth_scheme [String] Used to describe what algorithm to use when creating the signature
|
37
|
+
# @param api_key_secret [String] The user's API secret key
|
38
|
+
# @param signing_data [String] The data to be signed (usually consists of host, path, request method and other data)
|
39
|
+
# @param timestamp [String] A unix timestamp to millisecond precision
|
40
|
+
# @param nonce [String] A random value to prevent replay attacks
|
41
|
+
# @return [String] The signature according to algorithm specified
|
42
|
+
# @raise [VeracodeApiSigning::UnsupportedAuthSchemeException] if auth scheme is not supported
|
43
|
+
def create_signature(auth_scheme, api_key_secret, signing_data, timestamp, nonce)
|
44
|
+
if auth_scheme == "VERACODE-HMAC-SHA-256"
|
45
|
+
create_hmac_sha_256_signature(api_key_secret, signing_data, timestamp, nonce)
|
46
|
+
else
|
47
|
+
raise VeracodeApiSigning::UnsupportedAuthSchemeException, "Auth scheme #{auth_scheme} not supported"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# @param api_key_secret [String] The user's API secret key
|
52
|
+
# @param signing_data [String] The data to be signed (usually consists of host, path, request method and other data)
|
53
|
+
# @param timestamp [String] A unix timestamp to millisecond precision
|
54
|
+
# @param nonce [String] A random value to prevent replay attacks
|
55
|
+
# @return [String] An HMAC-SHA-256 signature
|
56
|
+
def create_hmac_sha_256_signature(api_key_secret, signing_data, timestamp, nonce)
|
57
|
+
api_key_secret = remove_prefix_from_api_credential(api_key_secret)
|
58
|
+
key_nonce = generate_digest(hex_to_bin(api_key_secret), hex_to_bin(nonce))
|
59
|
+
key_date = generate_digest(key_nonce, timestamp.to_s.encode)
|
60
|
+
signature_key = generate_digest(key_date, "vcode_request_version_1".encode)
|
61
|
+
|
62
|
+
OpenSSL::HMAC.hexdigest("sha256", signature_key, signing_data.encode)
|
63
|
+
end
|
64
|
+
|
65
|
+
# @param hex_string [String] the hex string
|
66
|
+
# @return [String] The hex string converted to binary
|
67
|
+
# @raise [VeracodeApiSigning::Exception] if string is NOT valid hex
|
68
|
+
def hex_to_bin(hex_string)
|
69
|
+
raise VeracodeApiSigning::Exception, "String is not valid hex: #{hex_string}" unless valid_hex?(hex_string)
|
70
|
+
|
71
|
+
hex_string.scan(/../).map { |x| x.hex.chr }.join
|
72
|
+
end
|
73
|
+
|
74
|
+
def generate_digest(key, data)
|
75
|
+
OpenSSL::HMAC.digest("sha256", key, data)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "faraday"
|
4
|
+
require "faraday/request"
|
5
|
+
require "veracode_api_signing/credentials"
|
6
|
+
require "veracode_api_signing/utils"
|
7
|
+
require "veracode_api_signing/hmac_auth"
|
8
|
+
require "veracode_api_signing/validation"
|
9
|
+
|
10
|
+
module VeracodeApiSigning
|
11
|
+
module Plugins
|
12
|
+
class FaradayMiddleware < Faraday::Middleware
|
13
|
+
include Utils
|
14
|
+
include Validation
|
15
|
+
|
16
|
+
KEY = "Authorization"
|
17
|
+
|
18
|
+
attr_reader :api_key_id, :api_secret_key
|
19
|
+
|
20
|
+
# @param app [#call]
|
21
|
+
# @param api_key_id [String] the veracode api key
|
22
|
+
# @param api_secret_key [String] The user's API secret key
|
23
|
+
def initialize(app, api_key_id = nil, api_secret_key = nil)
|
24
|
+
if api_key_id && api_secret_key
|
25
|
+
validate_credentials(api_key_id, api_secret_key)
|
26
|
+
@api_key_id = api_key_id
|
27
|
+
@api_secret_key = api_secret_key
|
28
|
+
else
|
29
|
+
api_key_id, api_secret_key = Credentials.new.get_credentials
|
30
|
+
validate_credentials(api_key_id, api_secret_key)
|
31
|
+
@api_key_id = api_key_id
|
32
|
+
@api_secret_key = api_secret_key
|
33
|
+
end
|
34
|
+
|
35
|
+
super(app)
|
36
|
+
end
|
37
|
+
|
38
|
+
# @param env [Faraday::Env]
|
39
|
+
def on_request(env)
|
40
|
+
return if env.request_headers[KEY]
|
41
|
+
|
42
|
+
url = env.url
|
43
|
+
host = get_host_from_url(url)
|
44
|
+
path = get_path_and_params_from_url(url)
|
45
|
+
method = env.method.to_s.upcase
|
46
|
+
auth = HMACAuth.new.generate_veracode_hmac_header(host, path, method, api_key_id, api_secret_key)
|
47
|
+
env.request_headers[KEY] = auth
|
48
|
+
end
|
49
|
+
|
50
|
+
def validate_credentials(key, secret)
|
51
|
+
validate_api_key_id(key)
|
52
|
+
validate_api_key_secret(secret)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
Faraday::Request.register_middleware(veracode_api_signing: VeracodeApiSigning::Plugins::FaradayMiddleware)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "veracode_api_signing/exception"
|
4
|
+
|
5
|
+
module VeracodeApiSigning
|
6
|
+
module Regions
|
7
|
+
REGIONS = { "e" => "eu", "f" => "fedramp", "g" => "global" }.freeze
|
8
|
+
|
9
|
+
def get_region_for_api_credential(api_credential)
|
10
|
+
if api_credential.include?("-")
|
11
|
+
prefix = api_credential.split("-").first
|
12
|
+
raise VeracodeApiSigning::CredentialsError, "Credential starts with an invalid prefix" if prefix.length != 8
|
13
|
+
|
14
|
+
region_character = prefix[6].downcase
|
15
|
+
else
|
16
|
+
region_character = "g"
|
17
|
+
end
|
18
|
+
|
19
|
+
if REGIONS.key?(region_character)
|
20
|
+
REGIONS.fetch(region_character)
|
21
|
+
else
|
22
|
+
(raise VeracodeApiSigning::CredentialsError,
|
23
|
+
"Credential does not map to a known region")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def remove_prefix_from_api_credential(api_credential)
|
28
|
+
api_credential.split("-").last
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "securerandom"
|
4
|
+
require "uri"
|
5
|
+
|
6
|
+
module VeracodeApiSigning
|
7
|
+
module Utils
|
8
|
+
# @return [Integer] current epoch time * 1000 rounded
|
9
|
+
def get_current_timestamp
|
10
|
+
Time.now.utc.to_i * 1000.round
|
11
|
+
end
|
12
|
+
|
13
|
+
# @return [String] nonce string
|
14
|
+
def generate_nonce
|
15
|
+
SecureRandom.hex(16)
|
16
|
+
end
|
17
|
+
|
18
|
+
# @param url [String] the url to parse
|
19
|
+
# @example
|
20
|
+
# get_host_from_url("https://api.example.com/foo/bar") #=> "api.example.com"
|
21
|
+
# @return [String] just returns the host
|
22
|
+
def get_host_from_url(url)
|
23
|
+
parsed_url(url).host
|
24
|
+
end
|
25
|
+
|
26
|
+
# @param url [String] the url to parse
|
27
|
+
# @example
|
28
|
+
# get_path_and_params_from_url("https://api.example.com/foo/bar") #=> "/foo/bar"
|
29
|
+
# @example
|
30
|
+
# get_path_and_params_from_url("https://api.example.com") #=> ""
|
31
|
+
# @example
|
32
|
+
# get_path_and_params_from_url("https://api.example.com/apm/v1/assets?page=2") #=> "/apm/v1/assets?page=2"
|
33
|
+
# @return [String] returns the the path and params formatted, or an empty String
|
34
|
+
def get_path_and_params_from_url(url)
|
35
|
+
uri = parsed_url(url)
|
36
|
+
path = uri.path
|
37
|
+
params = uri.query
|
38
|
+
return "" if (path.nil? || path.empty?) && params.nil?
|
39
|
+
|
40
|
+
built_url = URI::HTTPS.build(path: path, query: params)
|
41
|
+
built_url.request_uri
|
42
|
+
end
|
43
|
+
|
44
|
+
# @param url [String] the url to parse
|
45
|
+
# @example
|
46
|
+
# get_scheme_from_url("https://api.example.com/foo/bar") #=> "https"
|
47
|
+
# @example
|
48
|
+
# get_scheme_from_url("api.example.com") #=> ""
|
49
|
+
def get_scheme_from_url(url)
|
50
|
+
parsed_url(url).scheme.to_s
|
51
|
+
end
|
52
|
+
|
53
|
+
def parsed_url(url)
|
54
|
+
URI(url)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "veracode_api_signing/exception"
|
4
|
+
require "veracode_api_signing/regions"
|
5
|
+
|
6
|
+
module VeracodeApiSigning
|
7
|
+
module Validation
|
8
|
+
include Regions
|
9
|
+
|
10
|
+
# @param api_key_id [String] the api key id to validate
|
11
|
+
# @example
|
12
|
+
# validate_api_key_id("3ddaeeb10ca690df3fee5e3bd1c329fa") #=> nil
|
13
|
+
# @example
|
14
|
+
# validate_api_key_id("3ddaeeb10ca690df3f") #=> VeracodeApiSigning::CredentialsError
|
15
|
+
# @raise [VeracodeApiSigning::CredentialsError] if api key id is not valid
|
16
|
+
def validate_api_key_id(api_key_id)
|
17
|
+
api_key_id_minimum_length = 32
|
18
|
+
api_key_id_maximum_length = 128 + 9
|
19
|
+
api_key_id_hex = remove_prefix_from_api_credential(api_key_id)
|
20
|
+
|
21
|
+
if api_key_id.length < api_key_id_minimum_length
|
22
|
+
raise VeracodeApiSigning::CredentialsError,
|
23
|
+
"API key #{api_key_id} is #{api_key_id.length} characters, which is not long enough. The API key should be at least #{api_key_id_minimum_length} characters"
|
24
|
+
end
|
25
|
+
if api_key_id.length > api_key_id_maximum_length
|
26
|
+
raise VeracodeApiSigning::CredentialsError,
|
27
|
+
"API key #{api_key_id} is #{api_key_id.length} characters, which is too long. The API key should not be more than #{api_key_id_maximum_length} characters"
|
28
|
+
end
|
29
|
+
unless valid_hex?(api_key_id_hex)
|
30
|
+
raise VeracodeApiSigning::CredentialsError,
|
31
|
+
"API key #{api_key_id} does not seem to be hexadecimal"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# @param api_key_secret [String] the api key secret to validate
|
36
|
+
# @example
|
37
|
+
# validate_api_key_secret("0123456789abcdef"*8) #=> nil
|
38
|
+
# @example
|
39
|
+
# validate_api_key_secret("0123456789abcdef") #=> Veracode::ApiSigning::CredentialsError
|
40
|
+
# @raise [VeracodeApiSigning::CredentialsError] if api secret key is not valid
|
41
|
+
def validate_api_key_secret(api_key_secret)
|
42
|
+
secret_key_minimum_length = 128
|
43
|
+
secret_key_maximum_length = 1024 + 9
|
44
|
+
api_key_secret_hex = remove_prefix_from_api_credential(api_key_secret)
|
45
|
+
|
46
|
+
if api_key_secret.length < secret_key_minimum_length
|
47
|
+
raise VeracodeApiSigning::CredentialsError,
|
48
|
+
"API secret key #{api_key_secret} is #{api_key_secret.length} characters, which is not long enough. The API secret key should be at least #{secret_key_minimum_length} characters"
|
49
|
+
end
|
50
|
+
if api_key_secret.length > secret_key_maximum_length
|
51
|
+
raise VeracodeApiSigning::CredentialsError,
|
52
|
+
"API secret key #{api_key_secret} is #{api_key_secret.length} characters, which is too long. The API secret key should not be more than #{secret_key_maximum_length} characters"
|
53
|
+
end
|
54
|
+
unless valid_hex?(api_key_secret_hex)
|
55
|
+
raise VeracodeApiSigning::CredentialsError,
|
56
|
+
"API secret key #{api_key_secret} does not seem to be hexadecimal"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# @param scheme [String] the scheme to validate
|
61
|
+
# @example
|
62
|
+
# validate_scheme("https") #=> true
|
63
|
+
# @example
|
64
|
+
# validate_scheme("httpss") #=> VeracodeApiSigning::Exception
|
65
|
+
# @return [Boolean] true if valid scheme, otherwise raise error
|
66
|
+
# @raise [VeracodeApiSigning::Exception] if scheme is not valid
|
67
|
+
def validate_scheme(scheme)
|
68
|
+
if scheme.casecmp("https").zero?
|
69
|
+
true
|
70
|
+
else
|
71
|
+
raise VeracodeApiSigning::Exception, "Only HTTPS APIs are supported by Veracode."
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# @param hex_string [String] the hex string to validate
|
76
|
+
# @example
|
77
|
+
# valid_hex?("af") #=> true
|
78
|
+
# @example
|
79
|
+
# valid_hex?("zh") #=> false
|
80
|
+
# @return [Boolean] true if valid hex, otherwise false
|
81
|
+
# @raise [VeracodeApiSigning::CredentialsError] if api secret key is not valid
|
82
|
+
def valid_hex?(hex_string)
|
83
|
+
hex_string = hex_string.to_s
|
84
|
+
hex = true
|
85
|
+
hex_string.chars.each do |digit|
|
86
|
+
hex = false unless /[0-9A-Fa-f]/.match?(digit)
|
87
|
+
end
|
88
|
+
hex
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
data/shell.nix
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
{ pkgs ? import <nixpkgs> {}, ...}:
|
2
|
+
|
3
|
+
with pkgs;
|
4
|
+
|
5
|
+
let
|
6
|
+
darwin_packages = lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
|
7
|
+
CoreServices
|
8
|
+
ApplicationServices
|
9
|
+
Security
|
10
|
+
]);
|
11
|
+
ruby = ruby_3_0;
|
12
|
+
|
13
|
+
# Issue with using gemspec files
|
14
|
+
#
|
15
|
+
#gems = bundlerEnv {
|
16
|
+
#name = "veracodeRubyEnv";
|
17
|
+
#inherit ruby;
|
18
|
+
#gemdir = ./.;
|
19
|
+
#gemConfig = defaultGemConfig;
|
20
|
+
#};
|
21
|
+
|
22
|
+
in mkShell rec {
|
23
|
+
name = "veracode_api_signing";
|
24
|
+
|
25
|
+
buildInputs = [
|
26
|
+
libressl
|
27
|
+
#(lowPrio gems.wrappedRuby)
|
28
|
+
autoconf
|
29
|
+
automake
|
30
|
+
bash-completion
|
31
|
+
bison
|
32
|
+
cairo
|
33
|
+
coreutils
|
34
|
+
gdbm
|
35
|
+
#gems
|
36
|
+
git
|
37
|
+
gnumake
|
38
|
+
groff
|
39
|
+
libffi
|
40
|
+
libiconv
|
41
|
+
libtool
|
42
|
+
libunwind
|
43
|
+
libxml2
|
44
|
+
libxslt
|
45
|
+
libyaml
|
46
|
+
msgpack
|
47
|
+
ncurses
|
48
|
+
netcat
|
49
|
+
openssl
|
50
|
+
pkg-config
|
51
|
+
pkgconfig
|
52
|
+
postgresql
|
53
|
+
postgresql_13
|
54
|
+
readline
|
55
|
+
ruby
|
56
|
+
shared-mime-info # Required for the mime gem
|
57
|
+
sqlcipher
|
58
|
+
sqlite
|
59
|
+
swagger-codegen3
|
60
|
+
zlib
|
61
|
+
] ++ (lib.optionals stdenv.isDarwin darwin_packages);
|
62
|
+
|
63
|
+
shellHook = ''
|
64
|
+
export FREEDESKTOP_MIME_TYPES_PATH=${shared-mime-info}/share/mime/packages/freedesktop.org.xml
|
65
|
+
|
66
|
+
mkdir -p .gems
|
67
|
+
export GEM_HOME=$PWD/.gems
|
68
|
+
export GEM_PATH=$GEM_HOME
|
69
|
+
export PATH=$GEM_HOME/bin:$PATH
|
70
|
+
|
71
|
+
# Add additional folders to to XDG_DATA_DIRS if they exists, which will get sourced by bash-completion
|
72
|
+
for p in ''${buildInputs}; do
|
73
|
+
if [ -d "$p/share/bash-completion" ]; then
|
74
|
+
if [ -z ''${XDG_DATA_DIRS} ]; then
|
75
|
+
XDG_DATA_DIRS="$p/share"
|
76
|
+
else
|
77
|
+
XDG_DATA_DIRS="$XDG_DATA_DIRS:$p/share"
|
78
|
+
fi
|
79
|
+
fi
|
80
|
+
done
|
81
|
+
|
82
|
+
source ${bash-completion}/etc/profile.d/bash_completion.sh
|
83
|
+
'';
|
84
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
|
6
|
+
require "veracode_api_signing/version"
|
7
|
+
|
8
|
+
Gem::Specification.new do |spec|
|
9
|
+
spec.name = "veracode_api_signing"
|
10
|
+
spec.version = VeracodeApiSigning::VERSION
|
11
|
+
spec.authors = ["Corban Raun"]
|
12
|
+
spec.email = ["corban@raunco.co"]
|
13
|
+
|
14
|
+
spec.summary = "Veracode hmac signing library used with Veracode API"
|
15
|
+
spec.homepage = "https://CorbanR.github.io/veracode_api_signing"
|
16
|
+
spec.license = "MIT"
|
17
|
+
spec.required_ruby_version = ">= 2.6.0"
|
18
|
+
|
19
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org/"
|
20
|
+
|
21
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
22
|
+
spec.metadata["documentation_uri"] = "https://www.raunco.co/veracode_api_signing/"
|
23
|
+
spec.metadata["source_code_uri"] = "https://github.com/CorbanR/veracode_api_signing"
|
24
|
+
spec.metadata["changelog_uri"] = "https://github.com/CorbanR/veracode_api_signing/blob/main/CHANGELOG.md"
|
25
|
+
|
26
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
27
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features|examples|docs|coverage)/}) }
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_development_dependency "brakeman", "~> 5.1"
|
34
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
35
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
36
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
37
|
+
spec.add_development_dependency "rubocop", "~> 1.2"
|
38
|
+
spec.add_development_dependency "rubocop-performance", "~> 1.1"
|
39
|
+
spec.add_development_dependency "rubocop-rake", "~> 0.6"
|
40
|
+
spec.add_development_dependency "rubocop-rspec", "~> 2.5"
|
41
|
+
spec.add_development_dependency "simplecov", "~> 0.21.2"
|
42
|
+
spec.add_development_dependency "yard", "~> 0.9.26"
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,214 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: veracode_api_signing
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Corban Raun
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 1980-01-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: brakeman
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.1'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '13.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '13.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.2'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.2'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-performance
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.1'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.1'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.6'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.6'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.5'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.5'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.21.2
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.21.2
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: yard
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.9.26
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.9.26
|
153
|
+
description:
|
154
|
+
email:
|
155
|
+
- corban@raunco.co
|
156
|
+
executables: []
|
157
|
+
extensions: []
|
158
|
+
extra_rdoc_files: []
|
159
|
+
files:
|
160
|
+
- ".github/workflows/codeql-analysis.yml"
|
161
|
+
- ".github/workflows/tests.yml"
|
162
|
+
- ".gitignore"
|
163
|
+
- ".rspec"
|
164
|
+
- ".rubocop.yml"
|
165
|
+
- ".rubocop_todo.yml"
|
166
|
+
- CHANGELOG.md
|
167
|
+
- Gemfile
|
168
|
+
- Gemfile.lock
|
169
|
+
- LICENSE.txt
|
170
|
+
- README.md
|
171
|
+
- Rakefile
|
172
|
+
- bin/console
|
173
|
+
- bin/setup
|
174
|
+
- lib/veracode_api_signing.rb
|
175
|
+
- lib/veracode_api_signing/credentials.rb
|
176
|
+
- lib/veracode_api_signing/exception.rb
|
177
|
+
- lib/veracode_api_signing/formatters.rb
|
178
|
+
- lib/veracode_api_signing/hmac_auth.rb
|
179
|
+
- lib/veracode_api_signing/plugins/faraday_middleware.rb
|
180
|
+
- lib/veracode_api_signing/regions.rb
|
181
|
+
- lib/veracode_api_signing/utils.rb
|
182
|
+
- lib/veracode_api_signing/validation.rb
|
183
|
+
- lib/veracode_api_signing/version.rb
|
184
|
+
- shell.nix
|
185
|
+
- veracode_api_signing.gemspec
|
186
|
+
homepage: https://CorbanR.github.io/veracode_api_signing
|
187
|
+
licenses:
|
188
|
+
- MIT
|
189
|
+
metadata:
|
190
|
+
allowed_push_host: https://rubygems.org/
|
191
|
+
homepage_uri: https://CorbanR.github.io/veracode_api_signing
|
192
|
+
documentation_uri: https://www.raunco.co/veracode_api_signing/
|
193
|
+
source_code_uri: https://github.com/CorbanR/veracode_api_signing
|
194
|
+
changelog_uri: https://github.com/CorbanR/veracode_api_signing/blob/main/CHANGELOG.md
|
195
|
+
post_install_message:
|
196
|
+
rdoc_options: []
|
197
|
+
require_paths:
|
198
|
+
- lib
|
199
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
200
|
+
requirements:
|
201
|
+
- - ">="
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
version: 2.6.0
|
204
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
209
|
+
requirements: []
|
210
|
+
rubygems_version: 3.2.26
|
211
|
+
signing_key:
|
212
|
+
specification_version: 4
|
213
|
+
summary: Veracode hmac signing library used with Veracode API
|
214
|
+
test_files: []
|