Skip to content

Commit 535fbbb

Browse files
New Changes To RL Workflow
1 parent 40c2fbf commit 535fbbb

File tree

3 files changed

+119
-50
lines changed

3 files changed

+119
-50
lines changed
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/publish.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,21 @@ permissions:
1212
contents: read
1313

1414
jobs:
15+
rl-scanner:
16+
uses: ./.github/workflows/rl-scanner.yml
17+
with:
18+
ruby-version: 3.2
19+
secrets:
20+
RLSECURE_LICENSE: ${{ secrets.RLSECURE_LICENSE }}
21+
RLSECURE_SITE_KEY: ${{ secrets.RLSECURE_SITE_KEY }}
22+
SIGNAL_HANDLER_TOKEN: ${{ secrets.SIGNAL_HANDLER_TOKEN }}
23+
PRODSEC_TOOLS_USER: ${{ secrets.PRODSEC_TOOLS_USER }}
24+
PRODSEC_TOOLS_TOKEN: ${{ secrets.PRODSEC_TOOLS_TOKEN }}
25+
PRODSEC_TOOLS_ARN: ${{ secrets.PRODSEC_TOOLS_ARN }}
26+
1527
publish:
1628
name: Publish to RubyGems
29+
needs: rl-scanner
1730
runs-on: ubuntu-latest
1831
environment: release
1932

.github/workflows/rl-scanner.yml

Lines changed: 35 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
1-
name: RL-Secure
2-
run-name: rl-scanner
1+
name: RL-Secure Workflow
32

43
on:
5-
merge_group:
6-
workflow_dispatch:
7-
push:
8-
branches: ["master"]
9-
pull_request:
10-
types:
11-
- opened
12-
- synchronize
4+
workflow_call:
5+
inputs:
6+
ruby-version:
7+
required: true
8+
type: string
9+
secrets:
10+
RLSECURE_LICENSE:
11+
required: true
12+
RLSECURE_SITE_KEY:
13+
required: true
14+
SIGNAL_HANDLER_TOKEN:
15+
required: true
16+
PRODSEC_TOOLS_USER:
17+
required: true
18+
PRODSEC_TOOLS_TOKEN:
19+
required: true
20+
PRODSEC_TOOLS_ARN:
21+
required: true
1322

1423
jobs:
1524
rl-scanner:
16-
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request')
25+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged && startsWith(github.event.pull_request.head.ref, 'release/'))
1726
runs-on: ubuntu-latest
18-
19-
environment: security
27+
outputs:
28+
scan-status: ${{ steps.rl-scan-conclusion.outcome }}
2029

2130
permissions:
2231
pull-requests: write
@@ -32,7 +41,7 @@ jobs:
3241
- name: Configure Ruby
3342
uses: ./.github/actions/setup
3443
with:
35-
ruby-version: 3.2
44+
ruby-version: ${{ inputs.ruby-version }}
3645

3746
- name: Build RubyGems
3847
shell: bash
@@ -41,45 +50,21 @@ jobs:
4150
4251
- name: Get Artifact Version
4352
id: get_version
44-
run: echo "::set-output name=version::$(cat .version)"
45-
46-
- name: Output build artifact
47-
id: output_build_artifact
48-
run: |
49-
echo "scanfile=$(ls *.gem)" >> $GITHUB_OUTPUT
50-
51-
- name: Set up Python
52-
uses: actions/setup-python@v4
53-
with:
54-
python-version: "3.10"
53+
uses: ./.github/actions/get-version
5554

56-
- name: Install Python dependencies
57-
run: |
58-
pip install --upgrade pip
59-
pip install boto3 requests
60-
61-
- name: Configure AWS credentials
62-
uses: aws-actions/configure-aws-credentials@v1
55+
- name: Run RL Scanner
56+
id: rl-scan-conclusion
57+
uses: ./.github/actions/rl-scanner
6358
with:
64-
role-to-assume: ${{ secrets.PRODSEC_TOOLS_ARN }}
65-
aws-region: us-east-1
66-
mask-aws-account-id: true
67-
68-
- name: Run Reversing Labs Wrapper Scanner
59+
artifact-path: "$(pwd)/*.gem"
60+
version: "${{ steps.get_version.outputs.version }}"
6961
env:
7062
RLSECURE_LICENSE: ${{ secrets.RLSECURE_LICENSE }}
7163
RLSECURE_SITE_KEY: ${{ secrets.RLSECURE_SITE_KEY }}
7264
SIGNAL_HANDLER_TOKEN: ${{ secrets.SIGNAL_HANDLER_TOKEN }}
73-
WRAPPER_INDEX_URL: "https://${{ secrets.PRODSEC_TOOLS_USER }}:${{ secrets.PRODSEC_TOOLS_TOKEN }}@a0us.jfrog.io/artifactory/api/pypi/python-local/simple"
74-
PYTHONUNBUFFERED: 1
75-
run: |
76-
pip install rl-wrapper --index-url "$WRAPPER_INDEX_URL" && \
77-
rl-wrapper \
78-
--artifact "${{ steps.output_build_artifact.outputs.scanfile }}" \
79-
--version "${{ steps.get_version.outputs.version }}" \
80-
--name "${{ github.event.repository.name }}" \
81-
--repository "${{ github.repository }}" \
82-
--commit "${{ github.sha }}" \
83-
--build-env "github_actions" \
84-
--suppress_output
85-
continue-on-error: true
65+
PRODSEC_TOOLS_USER: ${{ secrets.PRODSEC_TOOLS_USER }}
66+
PRODSEC_TOOLS_TOKEN: ${{ secrets.PRODSEC_TOOLS_TOKEN }}
67+
PRODSEC_TOOLS_ARN: ${{ secrets.PRODSEC_TOOLS_ARN }}
68+
69+
- name: Output scan result
70+
run: echo "scan-status=${{ steps.rl-scan-conclusion.outcome }}" >> $GITHUB_ENV

0 commit comments

Comments
 (0)