Skip to content

Commit e2cd2f8

Browse files
committed
chore: integrate snyk scan and semgrep, and fix malware scanner
1 parent 171ab55 commit e2cd2f8

2 files changed

Lines changed: 165 additions & 70 deletions

File tree

.circleci/config.yaml

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

.circleci/config.yml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
version: 2.1
2+
3+
orbs:
4+
general-platform-helpers: okta/general-platform-helpers@1.9
5+
platform-helpers: okta/platform-helpers@1
6+
python: circleci/python@2.0.3
7+
aws-cli: circleci/aws-cli@5.1
8+
9+
jobs:
10+
reversing-labs:
11+
docker:
12+
- image: mcr.microsoft.com/dotnet/sdk:6.0
13+
steps:
14+
- run:
15+
name: Manual HTTPS checkout (avoid SSH)
16+
command: |
17+
git --version
18+
rm -rf .git || true
19+
git init .
20+
git remote add origin https://github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git
21+
git fetch --depth=1 origin $CIRCLE_SHA1
22+
git checkout --force $CIRCLE_SHA1
23+
24+
- run: dotnet --version
25+
26+
- run:
27+
name: Build Binary to scan
28+
command: |
29+
dotnet build ./Okta.Xamarin/Okta.Xamarin.sln --configuration Release
30+
# dotnet build ./Okta.Xamarin/Okta.Xamarin/Okta.Xamarin.csproj --configuration Release
31+
# dotnet build ./Okta.Xamarin/Okta.Xamarin.Android/Okta.Xamarin.Android.csproj --configuration Release
32+
# dotnet build ./Okta.Xamarin/Okta.Xamarin.iOS/Okta.Xamarin.iOS.csproj --configuration Release
33+
# dotnet build ./Okta.Xamarin/Tests/Okta.Xamarin.Test/Okta.Xamarin.Test.csproj --configuration Release
34+
# dotnet build ./Okta.Xamarin/Tests/Okta.Xamarin.UITest.Android/Okta.Xamarin.UITest.Android.csproj --configuration Release
35+
# dotnet build ./Okta.Xamarin/Tests/Okta.Xamarin.UITest.iOS/Okta.Xamarin.UITest.iOS.csproj --configuration Release
36+
# dotnet build ./Okta.Xamarin/Tests/Okta.Xamarin.UITest.Shared/Okta.Xamarin.UITest.Shared.shproj --configuration Release
37+
38+
# Necessary to Install rl wrapper
39+
- run:
40+
name: Install Python
41+
command: |
42+
apt-get update
43+
apt-get install -y curl python3 python3-pip unzip
44+
pip3 install --upgrade pip
45+
46+
# Download the scanner from Okta Security
47+
- run:
48+
name: Download Reverse Labs Scanner
49+
command: |
50+
curl https://dso-resources.oktasecurity.com/scanner \
51+
-H "x-api-key: $DSO_RLSECURE_TOKEN" \
52+
--output rl_wrapper-0.0.2+35ababa-py3-none-any.whl
53+
54+
# Install the wrapper that was downloaded
55+
- run:
56+
name: Install RL Wrapper
57+
command: |
58+
pip3 install ./rl_wrapper-0.0.2+35ababa-py3-none-any.whl
59+
60+
# Setup the AWS profile
61+
- aws-cli/setup:
62+
profile_name: default
63+
role_arn: $AWS_ARN
64+
region: us-east-1
65+
66+
# Get the credentials and save to env
67+
- run:
68+
name: Export AWS credentials to environment
69+
command: >-
70+
eval "$(aws configure export-credentials --profile default --format env)" 2> /dev/null
71+
72+
# Run the wrapper, do not change anything here
73+
- run:
74+
name: Run Reversing Labs Wrapper Scanner
75+
command: |
76+
rl-wrapper \
77+
--artifact ${CIRCLE_WORKING_DIRECTORY/#\~/$HOME} \
78+
--name $CIRCLE_PROJECT_REPONAME\
79+
--version $CIRCLE_SHA1\
80+
--repository $CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME \
81+
--commit $CIRCLE_SHA1 \
82+
--build-env "circleci" \
83+
--suppress_output
84+
85+
build:
86+
docker:
87+
- image: mcr.microsoft.com/dotnet/sdk:6.0
88+
environment:
89+
CIRCLE_CI: true
90+
steps:
91+
- run:
92+
name: Manual HTTPS checkout (avoid SSH)
93+
command: |
94+
set -e
95+
git --version || (apt-get update -y && apt-get install -y --no-install-recommends git ca-certificates curl && rm -rf /var/lib/apt/lists/*)
96+
rm -rf .git || true
97+
git init .
98+
git remote add origin https://github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git
99+
git fetch --depth=1 origin $CIRCLE_SHA1
100+
git checkout --force $CIRCLE_SHA1
101+
git config --global --add safe.directory "$(pwd)"
102+
- run:
103+
name: Restore solutions
104+
command: |
105+
dotnet restore ./Okta.Xamarin/.Xamarin.sln
106+
# dotnet restore ./Okta.Xamarin/Okta.Xamarin/Okta.Xamarin.csproj
107+
# dotnet restore ./Okta.Xamarin/Okta.Xamarin.Android/Okta.Xamarin.Android.csproj
108+
# dotnet restore ./Okta.Xamarin/Okta.Xamarin.iOS/Okta.Xamarin.iOS.csproj
109+
# dotnet restore ./Okta.Xamarin/Tests/Okta.Xamarin.Test/Okta.Xamarin.Test.csproj
110+
# dotnet restore ./Okta.Xamarin/Tests/Okta.Xamarin.UITest.Android/Okta.Xamarin.UITest.Android.csproj
111+
# dotnet restore ./Okta.Xamarin/Tests/Okta.Xamarin.UITest.iOS/Okta.Xamarin.UITest.iOS.csproj
112+
# dotnet restore ./Okta.Xamarin/Tests/Okta.Xamarin.UITest.Shared/Okta.Xamarin.UITest.Shared.shproj
113+
114+
- run:
115+
name: Build solutions
116+
command: |
117+
dotnet build ./Okta.Xamarin/Okta.Xamarin.sln --configuration Release --no-restore
118+
# dotnet build ./Okta.Xamarin/Okta.Xamarin/Okta.Xamarin.csproj --configuration Release --no-restore
119+
# dotnet build ./Okta.Xamarin/Okta.Xamarin.Android/Okta.Xamarin.Android.csproj --configuration Release --no-restore
120+
# dotnet build ./Okta.Xamarin/Okta.Xamarin.iOS/Okta.Xamarin.iOS.csproj --configuration Release --no-restore
121+
# dotnet build ./Okta.Xamarin/Tests/Okta.Xamarin.Test/Okta.Xamarin.Test.csproj --configuration Release --no-restore
122+
# dotnet build ./Okta.Xamarin/Tests/Okta.Xamarin.UITest.Android/Okta.Xamarin.UITest.Android.csproj --configuration Release --no-restore
123+
# dotnet build ./Okta.Xamarin/Tests/Okta.Xamarin.UITest.iOS/Okta.Xamarin.UITest.iOS.csproj --configuration Release --no-restore
124+
# dotnet build ./Okta.Xamarin/Tests/Okta.Xamarin.UITest.Shared/Okta.Xamarin.UITest.Shared.shproj --configuration Release --no-restore
125+
126+
- persist_to_workspace:
127+
root: ~/project
128+
paths:
129+
- .
130+
131+
snyk-scan:
132+
docker:
133+
- image: cimg/python:3.10
134+
working_directory: ~/project
135+
steps:
136+
- attach_workspace:
137+
at: ~/project
138+
- general-platform-helpers/step-load-dependencies
139+
- general-platform-helpers/step-run-snyk-monitor:
140+
scan-all-projects: true
141+
skip-unresolved: false
142+
run-on-non-main: true
143+
detection-depth: 4
144+
145+
workflows:
146+
"Malware Scanner":
147+
jobs:
148+
- reversing-labs:
149+
context:
150+
- static-analysis
151+
"Circle CI Build & Snyk Scan":
152+
jobs:
153+
- build
154+
- snyk-scan:
155+
name: execute-snyk
156+
context:
157+
- static-analysis
158+
requires:
159+
- build
160+
"Semgrep":
161+
jobs:
162+
- platform-helpers/job-semgrep-scan:
163+
context:
164+
- static-analysis
165+
name: "Scan with Semgrep"

0 commit comments

Comments
 (0)