Skip to content

Commit d1d9ff2

Browse files
authored
feat: Initial implementation of a system to collect compliance evidence. (#8)
1 parent ba0b691 commit d1d9ff2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2242
-1
lines changed

.github/workflows/codeql.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ jobs:
3131
fail-fast: false
3232
matrix:
3333
include:
34-
# We use javascript to analyze JSON and YAML files.
34+
# We use JavaScript to analyze JSON and YAML files.
3535
- language: javascript-typescript
3636
build_mode: none
3737
- language: actions
3838
build_mode: none
39+
- language: ruby
40+
build_mode: none
3941
steps:
4042
- name: Checkout repository
4143
uses: actions/checkout@v4

.github/workflows/hyperproof.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Hyperproof Sync
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
environment:
7+
description: Environment to deploy to.
8+
default: production
9+
required: true
10+
type: environment
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
collect:
17+
runs-on: ubuntu-latest
18+
environment: ${{ github.event.inputs.environment }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 1
23+
- name: Set up Ruby
24+
uses: ruby/setup-ruby@v1
25+
with:
26+
bundler-cache: true
27+
working-directory: ./hyperproof
28+
- name: Collect and sync proof
29+
working-directory: ./hyperproof
30+
env:
31+
APTIBLE_USERNAME: ${{ secrets.APTIBLE_USERNAME }}
32+
APTIBLE_PASSWORD: ${{ secrets.APTIBLE_PASSWORD }}
33+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
34+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
35+
AWS_REGION: us-east-1
36+
HYPERPROOF_CLIENT_ID: ${{ secrets.HYPERPROOF_CLIENT_ID }}
37+
HYPERPROOF_CLIENT_SECRET: ${{ secrets.HYPERPROOF_CLIENT_SECRET }}
38+
run:
39+
bin/hyperproof collect

.github/workflows/ruby.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Ruby checks
2+
3+
on:
4+
push:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
projects:
11+
name: Find ruby projects
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout source code
15+
uses: actions/checkout@v4
16+
- name: Find all ruby projects
17+
id: projects
18+
uses: Rishabh510/Path-lister-action@master
19+
with:
20+
path: .
21+
type: .ruby-version
22+
- name: Output results
23+
run: |
24+
echo "Found ${{ steps.projects.outputs.path_count }} file(s) with this extension:"
25+
for i in ${{ steps.projects.outputs.paths }}; do
26+
echo $i
27+
done
28+
- name: Get the project paths
29+
id: paths
30+
run: |
31+
projects=()
32+
paths=(${{ steps.projects.outputs.paths }})
33+
for i in "${paths[@]}"; do
34+
projects+=($(dirname "$i"))
35+
done
36+
output=$(echo "${projects[@]}" | jq --raw-input -c 'split(" ")')
37+
echo "OUTPUT: $output"
38+
echo "projects=${output}" >> $GITHUB_OUTPUT
39+
- name: Show all matching projects
40+
shell: bash
41+
run: |
42+
echo "${{ steps.paths.outputs.projects }}"
43+
outputs:
44+
projects: ${{ steps.paths.outputs.projects }}
45+
46+
lint:
47+
name: Lint ruby code
48+
needs: projects
49+
runs-on: ubuntu-latest
50+
strategy:
51+
matrix:
52+
dir: ${{ fromJSON(needs.projects.outputs.projects) }}
53+
steps:
54+
- uses: actions/checkout@v4
55+
- run: git fetch origin main --depth=1
56+
- name: Set up Ruby
57+
uses: ruby/setup-ruby@v1
58+
with:
59+
bundler-cache: true
60+
working-directory: ${{ matrix.dir }}
61+
- name: RuboCop Linter
62+
working-directory: ${{ matrix.dir }}
63+
run: bundle exec rubocop
64+
65+
spec:
66+
name: Run ruby tests
67+
needs: projects
68+
runs-on: ubuntu-latest
69+
strategy:
70+
matrix:
71+
dir: ${{ fromJSON(needs.projects.outputs.projects) }}
72+
env:
73+
COVERAGE: 1
74+
75+
steps:
76+
- uses: actions/checkout@v4
77+
- name: Set up Ruby
78+
uses: ruby/setup-ruby@v1
79+
with:
80+
bundler-cache: true
81+
working-directory: ${{ matrix.dir }}
82+
- name: Run tests
83+
working-directory: ${{ matrix.dir }}
84+
run: bundle exec rspec

hyperproof/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.csv
2+
*.env
3+
coverage/
4+
vendor/

hyperproof/.rspec

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--require spec_helper.rb
2+
--color
3+
--format RSpec::Github::Formatter
4+
--format documentation

hyperproof/.rubocop.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
require:
2+
- rubocop-yard
3+
4+
plugins:
5+
- rubocop-md
6+
- rubocop-performance
7+
- rubocop-rake
8+
- rubocop-rspec
9+
- rubocop-thread_safety
10+
11+
AllCops:
12+
NewCops: enable
13+
SuggestExtensions: true
14+
TargetRubyVersion: 3.4
15+
16+
Metrics/MethodLength:
17+
CountAsOne:
18+
- array
19+
- hash
20+
- method_call
21+
22+
# Exclude our main gem include from the file naming convention, to keep it
23+
# consistent with the gem name.
24+
Naming/FileName:
25+
Exclude:
26+
- lib/cfa-security-controls-hyperproof.rb
27+
- README.md
28+
29+
RSpec/ExampleLength:
30+
CountAsOne:
31+
- array
32+
- hash
33+
- method_call
34+
35+
# Favor more reusable helpers.
36+
RSpec/MultipleMemoizedHelpers:
37+
Max: 10

hyperproof/.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.4.3

hyperproof/Gemfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# frozen_string_literal: true
2+
3+
source 'https://rubygems.org'
4+
5+
gemspec
6+
7+
group :development do
8+
gem 'rake', '~> 13.2'
9+
gem 'rubocop', '~> 1.75'
10+
gem 'rubocop-md', '~> 2.0'
11+
gem 'rubocop-performance', '~> 1.25'
12+
gem 'rubocop-rake', '~> 0.7'
13+
gem 'rubocop-rspec', '~> 3.6'
14+
gem 'rubocop-thread_safety', '~> 0.7'
15+
gem 'rubocop-yard', '~> 0.10'
16+
end
17+
18+
group :development, :test do
19+
gem 'rspec', '~> 3.13'
20+
gem 'rspec-github', '~> 3.0'
21+
gem 'simplecov', '~> 0.22'
22+
end

0 commit comments

Comments
 (0)