Skip to content

Commit e634790

Browse files
committed
fix: Restore Malware Scanner workflow and add separate build-and-snyk workflow
1 parent 79a93f5 commit e634790

1 file changed

Lines changed: 46 additions & 73 deletions

File tree

.circleci/config.yaml

Lines changed: 46 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -5,101 +5,69 @@ orbs:
55
aws-cli: circleci/aws-cli@5.1
66
general-platform-helpers: okta/general-platform-helpers@1.9
77

8-
jobs:
9-
build:
8+
executors:
9+
dotnet-executor:
1010
docker:
1111
- image: mcr.microsoft.com/dotnet/sdk:6.0
12+
13+
jobs:
14+
build:
15+
executor: dotnet-executor
1216
steps:
17+
- checkout
18+
- run:
19+
name: Check dotnet version
20+
command: dotnet --version
1321
- run:
14-
name: Manual HTTPS checkout (avoid SSH)
22+
name: Clone https version (since git ssh may not be available)
1523
command: |
16-
git --version
17-
rm -rf .git || true
18-
git init .
19-
git remote add origin https://github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git
20-
git fetch --depth=1 origin $CIRCLE_SHA1
21-
git checkout --force $CIRCLE_SHA1
22-
23-
- run: dotnet --version
24-
25-
- run:
26-
name: get packages to scan
24+
rm -rf .git
25+
git init
26+
git remote add origin https://github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git
27+
git fetch origin
28+
git checkout -b ${CIRCLE_BRANCH} origin/${CIRCLE_BRANCH}
29+
- run:
30+
name: Restore dependencies
2731
command: |
28-
nuget restore ./Okta.Xamarin/Okta.Xamarin/Okta.Xamarin.csproj &&
29-
nuget restore ./Okta.Xamarin/Okta.Xamarin.iOS/Okta.Xamarin.iOS.csproj &&
30-
nuget restore ./Okta.Xamarin/Okta.Xamarin.Android/Okta.Xamarin.Android.csproj &&
31-
nuget restore ./Okta.Xamarin/Tests/Okta.Xamarin.Test/Okta.Xamarin.Test.csproj
32-
32+
dotnet restore ./Okta.Xamarin/Okta.Xamarin/Okta.Xamarin.csproj
33+
dotnet restore ./Okta.Xamarin/Okta.Xamarin.iOS/Okta.Xamarin.iOS.csproj
34+
dotnet restore ./Okta.Xamarin/Okta.Xamarin.Android/Okta.Xamarin.Android.csproj
35+
dotnet restore ./Okta.Xamarin/Tests/Okta.Xamarin.Test/Okta.Xamarin.Test.csproj
3336
- run:
34-
name: build Binary to scan
37+
name: Build solution
3538
command: dotnet build ./Okta.Xamarin/Okta.Xamarin.sln
36-
3739
- persist_to_workspace:
3840
root: .
3941
paths:
40-
- .
42+
- "*"
4143

4244
reversing-labs:
43-
docker:
44-
- image: mcr.microsoft.com/dotnet/sdk:6.0
45+
executor: dotnet-executor
4546
steps:
47+
- attach_workspace:
48+
at: .
4649
- run:
47-
name: Manual HTTPS checkout (avoid SSH)
48-
command: |
49-
git --version
50-
rm -rf .git || true
51-
git init .
52-
git remote add origin https://github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git
53-
git fetch --depth=1 origin $CIRCLE_SHA1
54-
git checkout --force $CIRCLE_SHA1
55-
56-
- run: dotnet --version
57-
58-
- run:
59-
name: get packages to scan
60-
command: |
61-
nuget restore ./Okta.Xamarin/Okta.Xamarin/Okta.Xamarin.csproj &&
62-
nuget restore ./Okta.Xamarin/Okta.Xamarin.iOS/Okta.Xamarin.iOS.csproj &&
63-
nuget restore ./Okta.Xamarin/Okta.Xamarin.Android/Okta.Xamarin.Android.csproj &&
64-
nuget restore ./Okta.Xamarin/Tests/Okta.Xamarin.Test/Okta.Xamarin.Test.csproj
65-
66-
- run:
67-
name: build Binary to scan
68-
command: dotnet build ./Okta.Xamarin/Okta.Xamarin.sln
69-
70-
# Necessary to Install rl wrapper
71-
- run:
72-
name: Install Python
50+
name: Install Python and dependencies
7351
command: |
7452
apt-get update
7553
apt-get install -y curl python3 python3-pip unzip
7654
pip3 install --upgrade pip
77-
78-
# Download the scanner from Okta Security
7955
- run:
8056
name: Download Reverse Labs Scanner
8157
command: |
8258
curl https://dso-resources.oktasecurity.com/scanner \
8359
-H "x-api-key: $DSO_RLSECURE_TOKEN" \
8460
--output rl_wrapper-0.0.2+35ababa-py3-none-any.whl
85-
86-
# Install the wrapper that was downloaded
8761
- run:
8862
name: Install RL Wrapper
8963
command: |
9064
pip3 install ./rl_wrapper-0.0.2+35ababa-py3-none-any.whl
91-
92-
# Setup the AWS profile
9365
- aws-cli/setup:
9466
profile_name: default
9567
role_arn: $AWS_ARN
9668
region: us-east-1
97-
98-
# Get the credentials and save to env
9969
- run: >-
10070
eval "$(aws configure export-credentials --profile default --format env)" 2> /dev/null
101-
102-
# Run the wrapper, do not change anything here
10371
- run:
10472
name: Run Reversing Labs Wrapper Scanner
10573
command: |
@@ -113,30 +81,35 @@ jobs:
11381
--suppress_output
11482
11583
snyk-scan:
116-
docker:
117-
- image: cimg/python:3.10
84+
executor: dotnet-executor
11885
steps:
11986
- attach_workspace:
12087
at: .
121-
- general-platform-helpers/step-load-dependencies
122-
- general-platform-helpers/step-run-snyk-monitor:
123-
scan-all-projects: true
124-
skip-unresolved: false
125-
run-on-non-main: true
126-
detection-depth: 4
88+
- general-platform-helpers/step-setup-artifactory-bazel:
89+
jfrog_token: ARTIFACTORY_TOKEN
90+
- general-platform-helpers/step-snyk-dotnet-scan:
91+
artifact_dir: Okta.Xamarin/Okta.Xamarin
12792

12893
workflows:
129-
version: 2
130-
build-and-scan:
94+
build-and-snyk:
13195
jobs:
13296
- build
13397
- snyk-scan:
134-
name: execute-snyk
98+
requires:
99+
- build
135100
context:
136101
- static-analysis
102+
filters:
103+
branches:
104+
only:
105+
- master
106+
- /^OKTA-.*/
107+
108+
"Malware Scanner":
109+
jobs:
110+
- build
111+
- reversing-labs:
137112
requires:
138113
- build
139-
- reversing-labs:
140-
name: malware-scan
141114
context:
142115
- static-analysis

0 commit comments

Comments
 (0)