Skip to content

Commit 21ba471

Browse files
committed
Integrate rl-scanner
1 parent 0032a7b commit 21ba471

File tree

3 files changed

+166
-1
lines changed

3 files changed

+166
-1
lines changed

.github/actions/rl-scanner/action.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: 'Reversing Labs Scanner'
2+
description: 'Runs the Reversing Labs scanner on a specified artifact.'
3+
inputs:
4+
artifact-path:
5+
description: 'Path to the artifact to be scanned.'
6+
required: true
7+
version:
8+
description: 'Version of the artifact.'
9+
required: true
10+
11+
runs:
12+
using: 'composite'
13+
steps:
14+
- name: Set up Python
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: '3.10'
18+
19+
- name: Install Python dependencies
20+
shell: bash
21+
run: |
22+
pip install boto3 requests
23+
24+
- name: Configure AWS credentials
25+
uses: aws-actions/configure-aws-credentials@v1
26+
with:
27+
role-to-assume: ${{ env.PRODSEC_TOOLS_ARN }}
28+
aws-region: us-east-1
29+
mask-aws-account-id: true
30+
31+
- name: Install RL Wrapper
32+
shell: bash
33+
run: |
34+
pip install rl-wrapper>=1.0.0 --index-url "https://${{ env.PRODSEC_TOOLS_USER }}:${{ env.PRODSEC_TOOLS_TOKEN }}@a0us.jfrog.io/artifactory/api/pypi/python-local/simple"
35+
36+
- name: Run RL Scanner
37+
shell: bash
38+
env:
39+
RLSECURE_LICENSE: ${{ env.RLSECURE_LICENSE }}
40+
RLSECURE_SITE_KEY: ${{ env.RLSECURE_SITE_KEY }}
41+
SIGNAL_HANDLER_TOKEN: ${{ env.SIGNAL_HANDLER_TOKEN }}
42+
PYTHONUNBUFFERED: 1
43+
run: |
44+
if [ ! -f "${{ inputs.artifact-path }}" ]; then
45+
echo "Artifact not found: ${{ inputs.artifact-path }}"
46+
exit 1
47+
fi
48+
49+
rl-wrapper \
50+
--artifact "${{ inputs.artifact-path }}" \
51+
--name "${{ github.event.repository.name }}" \
52+
--version "${{ inputs.version }}" \
53+
--repository "${{ github.repository }}" \
54+
--commit "${{ github.sha }}" \
55+
--build-env "github_actions" \
56+
--suppress_output
57+
58+
# Check the outcome of the scanner
59+
if [ $? -ne 0 ]; then
60+
echo "RL Scanner failed."
61+
echo "scan-status=failed" >> $GITHUB_ENV
62+
exit 1
63+
else
64+
echo "RL Scanner passed."
65+
echo "scan-status=success" >> $GITHUB_ENV
66+
fi
67+
68+
outputs:
69+
scan-status:
70+
description: 'The outcome of the scan process.'
71+
value: ${{ env.scan-status }}

.github/workflows/release.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,27 @@ permissions:
1414
### TODO: Also remove `nuget-release` workflow from this repo's .github/workflows folder once the repo is public.
1515

1616
jobs:
17+
rl-scanner:
18+
strategy:
19+
matrix:
20+
package: ['Auth0.AspNetCore.Authentication']
21+
uses: ./.github/workflows/rl-secure.yml
22+
with:
23+
NUGET_DIRECTORY: ${{ github.workspace }}/nuget
24+
PROJECT_PATHS: ['src/Auth0.AspNetCore.Authentication/Auth0.AspNetCore.Authentication.csproj']
25+
secrets:
26+
RLSECURE_LICENSE: ${{ secrets.RLSECURE_LICENSE }}
27+
RLSECURE_SITE_KEY: ${{ secrets.RLSECURE_SITE_KEY }}
28+
SIGNAL_HANDLER_TOKEN: ${{ secrets.SIGNAL_HANDLER_TOKEN }}
29+
PRODSEC_TOOLS_USER: ${{ secrets.PRODSEC_TOOLS_USER }}
30+
PRODSEC_TOOLS_TOKEN: ${{ secrets.PRODSEC_TOOLS_TOKEN }}
31+
PRODSEC_TOOLS_ARN: ${{ secrets.PRODSEC_TOOLS_ARN }}
32+
PACKAGE: ${{ matrix.package }}
33+
34+
1735
release:
18-
uses: ./.github/workflows/nuget-release.yml
36+
needs: rl-scanner
37+
uses: ./.github/workflows/nuget-release.yml
1938
with:
2039
dotnet-version: 6.0.x
2140
project-paths: "['src/Auth0.AspNetCore.Authentication/Auth0.AspNetCore.Authentication.csproj']"

.github/workflows/rl-secure.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: RL-Secure Workflow
2+
run-name: rl-scanner
3+
4+
on:
5+
workflow_call:
6+
secrets:
7+
RLSECURE_LICENSE:
8+
required: true
9+
RLSECURE_SITE_KEY:
10+
required: true
11+
SIGNAL_HANDLER_TOKEN:
12+
required: true
13+
PRODSEC_TOOLS_USER:
14+
required: true
15+
PRODSEC_TOOLS_TOKEN:
16+
required: true
17+
PRODSEC_TOOLS_ARN:
18+
required: true
19+
NUGET_DIRECTORY:
20+
required: true
21+
PROJECT_PATHS:
22+
required: true
23+
PACKAGE:
24+
required: true
25+
26+
jobs:
27+
rl-scanner:
28+
name: Run Reversing Labs scanner
29+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request')
30+
# && github.event.pull_request.merged && startsWith(github.event.pull_request.head.ref, 'release/'))
31+
runs-on: ubuntu-latest
32+
outputs:
33+
scan-status: ${{ steps.rl-scan-conclusion.outcome }}
34+
35+
permissions:
36+
pull-requests: write
37+
id-token: write
38+
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 0
44+
45+
- name: Setup .NET
46+
uses: actions/setup-dotnet@v3
47+
with:
48+
dotnet-version: 6.0.x
49+
50+
- name: Create NuGet packages
51+
shell: pwsh
52+
run: |
53+
foreach($file in (ConvertFrom-Json -InputObject "${{ secrets.PROJECT_PATHS }}")) {
54+
dotnet pack $file --configuration Release --output ${{ secrets.NUGET_DIRECTORY }}
55+
}
56+
57+
- id: get_version
58+
uses: ./.github/actions/get-version
59+
60+
- name: Run RL Scanner
61+
id: rl-scan-conclusion
62+
uses: ./.github/actions/rl-scanner
63+
with:
64+
artifact-path: "${{ secrets.NUGET_DIRECTORY }}/Auth0.${{ secrets.PACKAGE }}.${{ steps.get_version.outputs.version }}.nupkg"
65+
version: "${{ steps.get_version.outputs.version }}"
66+
env:
67+
RLSECURE_LICENSE: ${{ secrets.RLSECURE_LICENSE }}
68+
RLSECURE_SITE_KEY: ${{ secrets.RLSECURE_SITE_KEY }}
69+
SIGNAL_HANDLER_TOKEN: ${{ secrets.SIGNAL_HANDLER_TOKEN }}
70+
PRODSEC_TOOLS_USER: ${{ secrets.PRODSEC_TOOLS_USER }}
71+
PRODSEC_TOOLS_TOKEN: ${{ secrets.PRODSEC_TOOLS_TOKEN }}
72+
PRODSEC_TOOLS_ARN: ${{ secrets.PRODSEC_TOOLS_ARN }}
73+
74+
- name: Output scan result
75+
run: echo "scan-status=${{ steps.rl-scan-conclusion.outcome }}" >> $GITHUB_ENV

0 commit comments

Comments
 (0)