Skip to content

Commit 3d4bf2a

Browse files
authored
Merge pull request #164 from aws-samples/git-config
Git. Add semgrep workflow
2 parents 164a20a + 9991419 commit 3d4bf2a

23 files changed

+103
-445
lines changed

.github/workflows/blueprints-unit-tests.yml

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ jobs:
99
blueprints-cdk-tests:
1010
name: Run CDK tests for all blueprints
1111
runs-on: ubuntu-latest
12+
permissions:
13+
actions: read
14+
contents: read
1215
defaults:
1316
run:
1417
shell: bash

.github/workflows/pre-commit.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
branches: ["main"]
6+
7+
jobs:
8+
pre-commit:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-python@v3
13+
- uses: pre-commit/[email protected]

.github/workflows/semgrep.yaml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Name of this GitHub Actions workflow.
2+
name: Semgrep
3+
4+
on:
5+
# Scan changed files in PRs (diff-aware scanning):
6+
pull_request:
7+
branches: ["main"]
8+
# Scan on-demand through GitHub Actions interface:
9+
workflow_dispatch: {}
10+
# Scan mainline branches and report all findings:
11+
push:
12+
branches: ["main"]
13+
14+
jobs:
15+
semgrep_scan:
16+
# User definable name of this GitHub Actions job.
17+
name: semgrep/ci
18+
# If you are self-hosting, change the following `runs-on` value:
19+
runs-on: ubuntu-latest
20+
container:
21+
# A Docker image with Semgrep installed. Do not change this.
22+
image: returntocorp/semgrep
23+
# Skip any PR created by dependabot to avoid permission issues:
24+
if: (github.actor != 'dependabot[bot]')
25+
permissions:
26+
# required for all workflows
27+
security-events: write
28+
# only required for workflows in private repositories
29+
actions: read
30+
contents: read
31+
32+
steps:
33+
# Fetch project source with GitHub Actions Checkout.
34+
- name: Checkout repository
35+
uses: actions/checkout@v3
36+
37+
- name: Perform Semgrep Analysis
38+
# @NOTE: This is the actual semgrep command to scan your code.
39+
# Modify the --config option to 'r/all' to scan using all rules,
40+
# or use multiple flags to specify particular rules, such as
41+
# --config r/all --config custom/rules
42+
run: semgrep scan -q --sarif --config auto > semgrep-results.sarif
43+
44+
# upload the results for the CodeQL GitHub app to annotate the code
45+
- name: Save SARIF results as artifact
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: semgrep-scan-results
49+
path: semgrep-results.sarif
50+
51+
# Upload SARIF file generated in previous step
52+
- name: Upload SARIF result to the GitHub Security Dashboard
53+
uses: github/codeql-action/upload-sarif@v2
54+
with:
55+
sarif_file: semgrep-results.sarif
56+
if: always()

.github/workflows/website-deploy.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ jobs:
1111
deploy:
1212
name: Deploy to GitHub Pages
1313
runs-on: ubuntu-latest
14+
permissions:
15+
pages: write
16+
# only required for workflows in private repositories
17+
actions: read
18+
contents: read
1419
defaults:
1520
run:
1621
shell: bash

.github/workflows/website-test-deploy.yml

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ jobs:
99
test-deploy:
1010
name: Test deployment
1111
runs-on: ubuntu-latest
12+
permissions:
13+
actions: read
14+
contents: read
1215
defaults:
1316
run:
1417
shell: bash

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
!jest.config.js
88
*.d.ts
99
node_modules
10+
!lib/**/package-lock.json
11+
lib/**/foo.bar
1012

1113
# CDK asset staging directory
1214
.cdk.staging
@@ -35,4 +37,4 @@ ha-nodes-deploy*.json
3537
*.OLD
3638
.env
3739
.idea
38-
.vscode
40+
.vscode

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
"bcuser",
44
"usermod"
55
]
6-
}
6+
}

lib/base/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ We currently don't recommend running **archive** nodes in HA setup, because it t
208208
:::
209209

210210
### Monitoring
211-
Every 5 minutes a script on the deployed node publishes to CloudWatch service the metrics for current block for L1/L2 clients as well as blocks behind metric for L1 and minutes behind for L2. When the node is fully synced the blocks behind metric should get to 4 and minutes behind should get down to 0.
211+
Every 5 minutes a script on the deployed node publishes to CloudWatch service the metrics for current block for L1/L2 clients as well as blocks behind metric for L1 and minutes behind for L2. When the node is fully synced the blocks behind metric should get to 4 and minutes behind should get down to 0.
212212

213213
- To see the metrics for **single node only**:
214214
- Navigate to CloudWatch service (make sure you are in the region you have specified for AWS_REGION)
@@ -291,4 +291,4 @@ sudo su bcuser
291291
```
292292
4. Where to find the key Base client directories?
293293

294-
- The data directory is `/data`
294+
- The data directory is `/data`

lib/base/app.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ cdk.Aspects.of(app).add(
5757
reports: true,
5858
logIgnores: false,
5959
})
60-
);
60+
);

lib/besu-private/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
This blueprint deploys a ready-to-test private blockchain network powered by [Hyperledger Besu](https://github.com/hyperledger/besu/) with [IBFT consensus](https://arxiv.org/abs/2002.03613). It is accessible by applications via [AWS PrivateLink](https://aws.amazon.com/privatelink/) and [Network Load Balancer](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/introduction.html) (NLB).
88

9-
High-level features include:
9+
High-level features include:
1010
- Automated blockchain node recovery based on deep health check.
1111
- Automated key management after initial setup.
1212
- Deployment of software changes without downtime.

lib/ethereum/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ The result should be like this (the actual balance might change):
303303
### Clearing up and undeploying everything
304304

305305
1. Destroy RPC Nodes, Sync Nodes and Common components
306-
306+
307307
```bash
308308
# Setting the AWS account id and region in case local .env file is lost
309309
export AWS_ACCOUNT_ID=<your_target_AWS_account_id>

lib/solana/lib/assets/instance/cfn-hup/setup.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fi
2727
sed -i "s;__AWS_STACK_ID__;\"$STACK_ID\";g" /etc/cfn/cfn-hup.conf
2828
sed -i "s;__AWS_REGION__;\"$AWS_REGION\";g" /etc/cfn/cfn-hup.conf
2929

30-
mkdir -p /etc/cfn/hooks.d/system
30+
mkdir -p /etc/cfn/hooks.d/system
3131
mv /opt/instance/cfn-hup/cfn-auto-reloader.conf /etc/cfn/hooks.d/cfn-auto-reloader.conf
3232
sed -i "s;__AWS_STACK_NAME__;\"$STACK_NAME\";g" /etc/cfn/hooks.d/cfn-auto-reloader.conf
3333
sed -i "s;__AWS_REGION__;\"$AWS_REGION\";g" /etc/cfn/hooks.d/cfn-auto-reloader.conf
@@ -37,4 +37,4 @@ fi
3737

3838
systemctl daemon-reload
3939
systemctl enable --now cfn-hup
40-
systemctl start cfn-hup.service
40+
systemctl start cfn-hup.service

lib/solana/lib/assets/instance/storage/setup.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ fi
9595
if [ -n "$VOLUME_SIZE" ]; then
9696
VOLUME_ID=/dev/$(lsblk -lnb | awk -v VOLUME_SIZE_BYTES="$VOLUME_SIZE" '{if ($4== VOLUME_SIZE_BYTES) {print $1}}')
9797
echo "Data volume size defined, use respective volume id: $VOLUME_ID"
98-
else
98+
else
9999
VOLUME_ID=$(get_next_empty_nvme_disk)
100100
echo "Data volume size undefined, trying volume id: $VOLUME_ID"
101101
fi
102-
102+
103103
make_fs $FILE_SYSTEM "$VOLUME_ID"
104104

105105
sleep 10
@@ -127,4 +127,4 @@ fi
127127
chown -R bcuser:bcuser "$DIR_NAME"
128128
else
129129
echo "$DIR_NAME volume is mounted, nothing changed"
130-
fi
130+
fi

lib/solana/lib/assets/instance/storage/update-cloudwatch-dashboard.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,4 @@ for MOUNT_PATH in ${MOUNT_PATHS[*]}; do
8181
done
8282

8383
# Upload cloudwatch dashboard using aws cli
84-
aws cloudwatch put-dashboard --dashboard-name "$DASHBOARD_NAME" --dashboard-body file:///tmp/dashboard.json
84+
aws cloudwatch put-dashboard --dashboard-name "$DASHBOARD_NAME" --dashboard-body file:///tmp/dashboard.json

lib/solana/lib/assets/node/build-binaries.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ if [ ! -d "/home/bcuser/bin" ]; then
4343
mkdir -p /home/bcuser/bin
4444
fi
4545
mv $PWD/bin/* /home/bcuser/bin
46-
echo export PATH=/home/bcuser/bin:$PATH >> /home/bcuser/.profile
46+
echo export PATH=/home/bcuser/bin:$PATH >> /home/bcuser/.profile

lib/solana/lib/assets/node/node.service

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ LogRateLimitIntervalSec=0
1212
Environment="PATH=/bin:/usr/bin:/home/bcuser/bin"
1313
ExecStart=/home/bcuser/bin/node-service.sh
1414
[Install]
15-
WantedBy=multi-user.target
15+
WantedBy=multi-user.target

lib/solana/lib/assets/node/setup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,4 @@ echo "Starting node as a service"
212212

213213
mv /opt/node/node.service /etc/systemd/system/node.service
214214
systemctl daemon-reload
215-
systemctl enable --now node
215+
systemctl enable --now node

lib/solana/lib/assets/sync-checker/setup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ mv /opt/sync-checker/sync-checker.timer /etc/systemd/system/sync-checker.timer
2222

2323
echo "Starting sync checker timer"
2424
systemctl start sync-checker.timer
25-
systemctl enable sync-checker.timer
25+
systemctl enable sync-checker.timer

lib/solana/lib/assets/sync-checker/sync-checker.service

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
Description="Sync checker for blockchain node"
33

44
[Service]
5-
ExecStart=/opt/syncchecker.sh
5+
ExecStart=/opt/syncchecker.sh

lib/solana/lib/assets/sync-checker/sync-checker.timer

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ OnCalendar=*:*:0/5
66
Unit=sync-checker.service
77

88
[Install]
9-
WantedBy=multi-user.target
9+
WantedBy=multi-user.target

lib/solana/lib/constructs/node-cw-dashboard.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,4 +321,4 @@ export const SingleNodeCWDashboardJSON = {
321321
}
322322
}
323323
]
324-
}
324+
}

0 commit comments

Comments
 (0)