Skip to content

Commit 952a5c1

Browse files
committed
upgraded action to use skds multi scan run
1 parent c59fea4 commit 952a5c1

File tree

5 files changed

+70
-46
lines changed

5 files changed

+70
-46
lines changed

.github/workflows/test.yaml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,11 @@ on:
1212
asset_id:
1313
description: 'Asset ID to scan (defaults to secret DEFAULT_ASSET_ID if not provided)'
1414
required: false
15-
scan_type:
16-
description: 'Type of scan'
15+
scan_types:
16+
description: 'Type(s) of scan to run (comma-separated for multiple scans, e.g., "quick_scan,safety_scan")'
1717
required: true
18-
default: 'quick_scan'
19-
type: choice
20-
options:
21-
- quick_scan
22-
- safety_scan
23-
- owasp
24-
- mitre
25-
- nist
26-
- whistleblower
27-
- fingerprint
18+
default: 'quick_scan,owasp'
19+
type: string
2820

2921
jobs:
3022
test-action:
@@ -37,7 +29,7 @@ jobs:
3729
uses: ./
3830
with:
3931
asset_id: ${{ github.event.inputs.asset_id || secrets.DEFAULT_ASSET_ID }}
40-
scan_type: ${{ github.event.inputs.scan_type || 'quick_scan' }}
32+
scan_types: ${{ github.event.inputs.scan_types || 'quick_scan,owasp' }}
4133
env:
4234
ARTEMIS_CLIENT_ID: ${{ secrets.ARTEMIS_CLIENT_ID }}
4335
ARTEMIS_CLIENT_SECRET: ${{ secrets.ARTEMIS_CLIENT_SECRET }}

README.md

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,11 @@ on:
1818
asset_id:
1919
description: 'Asset ID to scan (defaults to secret DEFAULT_ASSET_ID if not provided)'
2020
required: false
21-
scan_type:
22-
description: 'Type of scan'
21+
scan_types:
22+
description: 'Type(s) of scan to run (comma-separated for multiple scans)'
2323
required: true
2424
default: 'quick_scan'
25-
type: choice
26-
options:
27-
- quick_scan
28-
- safety_scan
29-
- owasp
30-
- mitre
31-
- nist
32-
- whistleblower
33-
- fingerprint
25+
type: string
3426

3527
jobs:
3628
security-scan:
@@ -43,7 +35,7 @@ jobs:
4335
uses: repello-ai/artemis-gh-action@v1
4436
with:
4537
asset_id: ${{ github.event.inputs.asset_id || secrets.DEFAULT_ASSET_ID }}
46-
scan_type: ${{ github.event.inputs.scan_type || 'quick_scan' }}
38+
scan_types: ${{ github.event.inputs.scan_types || 'quick_scan' }}
4739
env:
4840
ARTEMIS_CLIENT_ID: ${{ secrets.ARTEMIS_CLIENT_ID }}
4941
ARTEMIS_CLIENT_SECRET: ${{ secrets.ARTEMIS_CLIENT_SECRET }}
@@ -54,19 +46,51 @@ jobs:
5446
| Input | Description | Required | Default |
5547
|-------|-------------|----------|---------|
5648
| `asset_id` | The ID of the asset to scan | No* | Uses `DEFAULT_ASSET_ID` secret |
57-
| `scan_type` | Type of scan to run | Yes | `quick_scan` |
49+
| `scan_types` | Type(s) of scan to run (comma-separated for multiple scans) | Yes | `quick_scan` |
5850

5951
\* While the `asset_id` parameter is optional in the workflow, you must either provide it as an input or set up the `DEFAULT_ASSET_ID` secret.
6052

53+
### Examples
54+
55+
Run a single scan:
56+
```yaml
57+
- name: Run Quick Scan
58+
uses: repello-ai/artemis-gh-action@v1
59+
with:
60+
asset_id: "6abec05b-0245-4d38-9a2a-df8045cba142"
61+
scan_types: "quick_scan"
62+
```
63+
64+
Run multiple scans:
65+
```yaml
66+
- name: Run Multiple Scans
67+
uses: repello-ai/artemis-gh-action@v1
68+
with:
69+
asset_id: "6abec05b-0245-4d38-9a2a-df8045cba142"
70+
scan_types: "quick_scan,safety_scan,mitre"
71+
```
72+
6173
### Supported Scan Types
6274

63-
- `quick_scan`: Basic scan for common issues
64-
- `safety_scan`: Focused on safety concerns
65-
- `owasp`: Scan based on OWASP guidelines
66-
- `mitre`: Scan based on MITRE ATT&CK framework
67-
- `nist`: Scan based on NIST standards
68-
- `whistleblower`: Dedicated whistleblower vulnerability scan
69-
- `fingerprint`: Digital fingerprinting scan
75+
You can use any of the following scan types, individually or in combination (comma-separated):
76+
77+
| Scan Type | Description |
78+
|-----------|-------------|
79+
| `quick_scan` | Basic scan for common issues (fastest scan) |
80+
| `safety_scan` | Comprehensive scan focused on safety concerns |
81+
| `owasp` | Scan based on OWASP Top 10 guidelines |
82+
| `mitre` | Scan based on MITRE ATT&CK framework |
83+
| `nist` | Scan based on NIST standards and compliance |
84+
| `whistleblower` | Dedicated whistleblower vulnerability scan |
85+
| `fingerprint` | Model fingerprinting scan |
86+
87+
### Example Combinations
88+
89+
Some commonly used combinations include:
90+
- `quick_scan,safety_scan`: For a balance of speed and comprehensive safety checking
91+
- `owasp,mitre`: For a thorough security assessment against industry standards
92+
- `quick_scan,fingerprint`: For identifying assets and performing basic security checks
93+
- `safety_scan,nist,whistleblower`: For organizations requiring compliance and protection
7094

7195
## Environment Variables and Secrets
7296

@@ -87,7 +111,7 @@ To contribute to this action:
87111
1. Clone the repository
88112
2. Install dependencies: `pip install -r requirements.txt`
89113
3. Make your changes to `main.py`
90-
4. Test locally by running: `python main.py <asset_id> <scan_type>`
114+
4. Test locally by running: `python main.py <asset_id> <scan_type[,scan_type,...]>`
91115
5. Test in GitHub Actions by using the workflow_dispatch trigger
92116

93117
## License

action.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ inputs:
99
asset_id:
1010
description: 'The ID of the asset to scan'
1111
required: true
12-
scan_type:
13-
description: 'Type of scan to run (quick_scan, safety_scan, owasp, mitre, nist, whistleblower, fingerprint)'
12+
scan_types:
13+
description: 'Type(s) of scan to run. Use individual values (quick_scan, safety_scan, owasp, mitre, nist, whistleblower, fingerprint) or any comma-separated combination.'
1414
required: true
1515
default: 'quick_scan'
1616

@@ -19,4 +19,4 @@ runs:
1919
image: 'Dockerfile'
2020
args:
2121
- ${{ inputs.asset_id }}
22-
- ${{ inputs.scan_type }}
22+
- ${{ inputs.scan_types }}

main.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ def main():
88
# Get arguments passed from entrypoint.sh
99
if len(sys.argv) < 3:
1010
print("Error: Missing required arguments")
11-
print("Usage: python main.py <asset_id> <scan_type>")
11+
print("Usage: python main.py <asset_id> <scan_type[,scan_type,...]>")
1212
sys.exit(1)
1313

1414
asset_id = sys.argv[1]
15-
scan_type_str = sys.argv[2]
15+
scan_types_str = sys.argv[2]
1616

1717
# Get credentials from environment
1818
client_id = os.environ.get('ARTEMIS_CLIENT_ID')
@@ -33,11 +33,19 @@ def main():
3333
'fingerprint': ScanType.fingerprint,
3434
}
3535

36-
if scan_type_str not in scan_type_map:
37-
print(f"Error: Invalid scan type '{scan_type_str}'. Must be one of: {', '.join(scan_type_map.keys())}")
38-
sys.exit(1)
36+
# Split the scan types by comma
37+
scan_types_list = [st.strip() for st in scan_types_str.split(',')]
38+
scan_types = []
39+
40+
# Validate each scan type
41+
for scan_type_str in scan_types_list:
42+
if scan_type_str not in scan_type_map:
43+
print(f"Error: Invalid scan type '{scan_type_str}'. Must be one of: {', '.join(scan_type_map.keys())}")
44+
sys.exit(1)
45+
scan_types.append(scan_type_map[scan_type_str])
3946

40-
scan_type = scan_type_map[scan_type_str]
47+
# If only one scan type is provided, use it directly instead of a list
48+
scan_type_param = scan_types[0] if len(scan_types) == 1 else scan_types
4149

4250
# Initialize client
4351
client = RepelloArtemisClient(
@@ -47,9 +55,9 @@ def main():
4755
)
4856

4957
# Trigger scan
50-
print(f"::group::Triggering {scan_type_str} for asset {asset_id}")
58+
print(f"::group::Triggering scan(s) {scan_types_str} for asset {asset_id}")
5159
try:
52-
scan_result = client.assets.trigger_scan(asset_id, scan_type)
60+
scan_result = client.assets.trigger_scan(asset_id, scan_type_param)
5361
print("::endgroup::")
5462

5563
except Exception as e:

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
repello-artemis-sdk>=1.0.1
1+
repello-artemis-sdk==1.0.2

0 commit comments

Comments
 (0)