Skip to content

Commit d5995c7

Browse files
Initial release of the CodeLogic Java Agent GitHub Action
1 parent 2ca3e15 commit d5995c7

File tree

3 files changed

+136
-1
lines changed

3 files changed

+136
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.idea/

README.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,60 @@
1-
# codelogic-java-agent-github-action
1+
## About
2+
3+
GitHub Action to scan Java artifacts into a CodeLogic server using the CodeLogic Java Agent.
4+
5+
6+
### Example
7+
8+
```yaml
9+
name: codelogic-scan
10+
11+
on:
12+
push:
13+
branches: [ "integration" ]
14+
pull_request:
15+
branches: [ "integration" ]
16+
workflow_dispatch:
17+
18+
jobs:
19+
codelogic-scan:
20+
name: Perform CodeLogic Scan
21+
environment: CodeLogic Scan Env
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Check out the repo
25+
uses: actions/checkout@v4
26+
- name: Run the CodeLogic Scan
27+
uses: CodeLogicIncEngineering/codelogic-java-agent-github-action@integration
28+
with:
29+
version: latest
30+
codelogic_host: ${{ vars.CODELOGIC_HOST }}
31+
agent_uuid: ${{ secrets.AGENT_UUID }}
32+
agent_password: ${{ secrets.AGENT_PASSWORD }}
33+
application_name: MyApplication
34+
scan_space: default
35+
scan_depth: 1
36+
recursive_filter: com.example
37+
method_filter: com.example
38+
```
39+
40+
41+
## Customizing
42+
43+
44+
| Name | Type | Description |
45+
|-------------------------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
46+
| `version` | String | The version of the agent docker image to use. Default is latest. |
47+
| `codelogic_host` | String | The host address of the CodeLogic instance without the "/codelogic/ui/" part. |
48+
| `agent_uuid` | String | The UUID of the Agent in CodeLogic. |
49+
| `agent_password` | String | The password for the agent. |
50+
| `application_name` | String | The Application node to create that will be the parent of all objects found in the scan. |
51+
| `scan_space` | String | The name of the scan space that the data will be saved to. If specified, a ScanSpace with this name will be created if not found. If not specified, information will be saved to the default ScanSpace. |
52+
| `scan_path` | String | A comma-separated list of files and folders to scan. Must start with /github/workspace/. Defaults to /github/workspace |
53+
| `scan_path_depth` | String | During scanning, this value will be used as the depth of subdirectories to traverse before stopping. Defaults to 1. |
54+
| `recursive_filter` | String | A comma-separated list of substrings to key off of to trigger recursive analysis (jar within jar). |
55+
| `method_filter` | String | A comma-separated list of Java package prefixes that should be included in method-invokes-method relationships. |
56+
| `database_identities` | String | A comma-separated list of database identities to use in the creation of relationships. |
57+
| `force_rescan` | boolean | Forces jCape to rescan already scanned artifacts. Defaults to false. |
58+
| `expunge_scan_sessions` | boolean | Instruct the server to delete all other scan sessions created by this agent and its configuration after the current scan session has completed successfully. Defaults to false. |
59+
| `java_opts` | String | Java options to pass to the java command. |
60+

action.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: 'CodeLogic Java Agent'
2+
description: 'Scans Java artifacts into your '
3+
inputs:
4+
version:
5+
description: 'The version of the agent docker image to use. Default is latest.'
6+
default: "latest"
7+
required: false
8+
codelogic_host:
9+
description: 'The host address of the CodeLogic instance without the "/codelogic/ui/" part.'
10+
required: true
11+
agent_uuid:
12+
description: 'The UUID of the Agent in CodeLogic.'
13+
required: true
14+
agent_password:
15+
description: 'The password for the agent.'
16+
required: true
17+
application_name:
18+
description: 'The Application node to create that will be the parent of all objects found in the scan.'
19+
required: true
20+
scan_space:
21+
description: 'The name of the scan space that the data will be saved to.
22+
If specified, a ScanSpace with this name will be created if not found.
23+
If not specified, information will be saved to the default ScanSpace.'
24+
required: false
25+
scan_path:
26+
description: 'A comma-separated list of files and folders to scan. Must start with /github/workspace/'
27+
default: "/github/workspace"
28+
required: false
29+
scan_path_depth:
30+
description: 'During scanning, this value will be used as the depth of subdirectories to traverse before stopping.'
31+
default: '1'
32+
required: false
33+
recursive_filter:
34+
description: 'A comma-separated list of substrings to key off of to trigger recursive analysis (jar within jar).'
35+
required: false
36+
method_filter:
37+
description: 'A comma-separated list of Java package prefixes that should be included in method-invokes-method relationships.'
38+
required: false
39+
database_identities:
40+
description: 'A comma-separated list of database identities to use in the creation of relationships.'
41+
required: false
42+
force_rescan:
43+
description: 'Forces jCape to rescan already scanned artifacts.'
44+
default: 'false'
45+
required: false
46+
expunge_scan_sessions:
47+
description: 'Instruct the server to delete all other scan sessions created by this agent and its configuration after the current scan session has completed successfully.'
48+
default: 'false'
49+
required: false
50+
java_opts:
51+
description: 'Java options to pass to the java command.'
52+
required: false
53+
54+
runs:
55+
using: 'docker'
56+
image: ${{ format('docker://public.ecr.aws/codelogic.com/codelogic_java:{0}', inputs.version) }}
57+
args: [
58+
"analyze",
59+
"-t scan",
60+
"-p ${{ inputs.scan_path }}",
61+
"-a ${{ inputs.application_name }}",
62+
"${{ inputs.scan_space != null && format('-s {0}', inputs.scan_space) || '' }}",
63+
"${{ inputs.recursive_filter != null && format('-r {0}', inputs.recursive_filter) || '' }}",
64+
"${{ inputs.method_filter != null && format('-m {0}', inputs.method_filter) || '' }}",
65+
"${{ inputs.database_identities != null && format('-d {0}', inputs.database_identities) || '' }}",
66+
"${{ inputs.force_rescan == 'true' && '--rescan' || '' }}",
67+
"${{ inputs.expunge_scan_sessions == 'true' && '-e' || '' }}"
68+
]
69+
env:
70+
CODELOGIC_HOST: ${{ inputs.codelogic_host }}
71+
AGENT_UUID: ${{ inputs.agent_uuid }}
72+
AGENT_PASSWORD: ${{ inputs.agent_password }}
73+
SCAN_PATH_DEPTH: ${{ inputs.scan_path_depth }}
74+
JAVA_OPTS: ${{ inputs.java_opts }}
75+

0 commit comments

Comments
 (0)