Skip to content

Commit 7e2ac49

Browse files
authored
Add repository hardening files (#14)
* Added repository hardening files * Remove Travis CI configuration
1 parent 6be61d9 commit 7e2ac49

11 files changed

Lines changed: 424 additions & 39 deletions

File tree

.github/CODEOWNERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Reviews are required by
2+
#
3+
# - @pennylane-hq/transactions-hub as main usage of this gem is for transactions-hub,
4+
# maintained by this squad
5+
6+
* @pennylane-hq/transactions-hub

.github/RECOMMENDED_CODEOWNERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# It is recommended to receive reviews from
2+
#
3+
# - @pennylane-hq/security as this gem handles financial data parsing and should be modified carefully
4+
5+
* @pennylane-hq/security

.github/workflows/ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Ruby
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
ruby: [3.3, head]
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up Ruby
17+
uses: ruby/setup-ruby@v1
18+
with:
19+
ruby-version: ${{ matrix.ruby }}
20+
bundler-cache: true
21+
- name: Run tests
22+
run: bundle exec rspec
23+
24+
summary:
25+
name: CI Summary
26+
runs-on: ubuntu-latest
27+
needs:
28+
- test
29+
if: always()
30+
31+
steps:
32+
- name: Successful builds?
33+
run: |
34+
if ${{ needs.test.result != 'success' }}; then exit 1; fi

.github/workflows/config.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: do_not_commit
5+
name: Break on DO NOT COMMIT comment
6+
language: pygrep
7+
entry: (?i)(NOT.{,3}COMMIT)
8+
exclude: (?x)(.pre-commit-config.yaml)$
9+
- id: rubocop
10+
name: Rubocop
11+
language: system
12+
entry: bundle exec rubocop
13+
require_serial: true # for proper cache behavior
14+
files: (?x)(
15+
\.(rb|rake)$|Gemfile$|Rakefile|.irbrc$)
16+
args:
17+
- --autocorrect
18+
- --color
19+
- --server
20+
- --config=.rubocop.yml
21+
- id: encrypted_ssh_keys
22+
name: Encrypted SSH keys
23+
language: system
24+
entry: .pre-commit/check_ssh_keys_passphrase.sh
25+
pass_filenames: false
26+
- repo: https://github.com/pre-commit/pre-commit-hooks
27+
rev: v4.0.1
28+
hooks:
29+
- id: trailing-whitespace
30+
31+
- repo: https://github.com/tdeo/pre-commit-hooks
32+
rev: v4.0.1
33+
hooks:
34+
- id: end-of-file-fixer
35+
36+
- repo: https://github.com/pennylane-hq/pre-commit-hooks
37+
rev: d8b38e22631ed3597b2c8277f64cbd60afc1515a
38+
hooks:
39+
- id: actionlint
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
exitcode=0
4+
SSH_KEYS_DIR="$HOME"/.ssh/
5+
6+
while IFS= read -r keyfile
7+
do
8+
(grep -l "OPENSSH PRIVATE" "$keyfile" 2>/dev/null | grep -v personal 1>/dev/null 2>&1) || continue
9+
if ssh-keygen -y -P "" -f "$keyfile" 1>/dev/null 2>&1 ; then
10+
echo SSH key with no passphrase: "$keyfile"
11+
exitcode=1
12+
fi
13+
done < <(find "$SSH_KEYS_DIR" -maxdepth 1 -type f 2> /dev/null)
14+
15+
if [ $exitcode == 1 ]; then
16+
cat << EOF
17+
18+
At least one of your SSH keys doesn't have a passphrase. For security reasons,
19+
a passphrase is needed on all non-personal SSH keys. Please refer to the 'Signed commits'
20+
section of the 'Repositories hardening' page on Notion for more information:
21+
https://www.notion.so/scribetech/Repositories-hardening-1cfc3cfcebe842bc88c3ac4fae4a0506
22+
EOF
23+
fi
24+
25+
exit $exitcode

0 commit comments

Comments
 (0)