Skip to content

Commit 40f2d1d

Browse files
Merge pull request #183 from lacework/remove-deprecated-options
chore(COD-2736): remove deprecated options
2 parents b6a7a49 + 7bf79db commit 40f2d1d

File tree

6 files changed

+45
-78
lines changed

6 files changed

+45
-78
lines changed

.lacework/codesec.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
default:
2+
sca:
3+
enable-dynamic: true
4+
enable-fast: true

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ jobs:
4848
uses: lacework/code-security-action@v1
4949
with:
5050
target: ${{ matrix.target }}
51-
tools: sca # Comma-separated list of tool(s) to use for scanning. Current options are sca
5251
display-results:
5352
runs-on: ubuntu-20.04
5453
name: Display results
@@ -59,7 +58,6 @@ jobs:
5958
id: code-analysis
6059
uses: lacework/code-security-action@v1
6160
with:
62-
tools: sca # Should be the same list of tools as above.
6361
token: ${{ secrets.GITHUB_TOKEN }}
6462
```
6563
@@ -89,7 +87,6 @@ jobs:
8987
uses: lacework/code-security-action@v1
9088
with:
9189
target: push
92-
tools: sca # Comma-separated list of tool(s) to use for scanning. Current options are sca
9390
```
9491

9592
## License

action.yaml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ name: 'lacework-code-security'
22
description: "Scan code with Lacework's Code Security offering"
33
author: 'Lacework'
44
inputs:
5-
classpath:
6-
description: 'Specify the Java classpath'
7-
required: false
8-
default: ''
9-
deprecationMessage: 'This option is not used anymore'
105
sources:
116
description: 'Sources directory to analyze'
127
required: false
@@ -25,9 +20,8 @@ inputs:
2520
description: 'A block of Markdown that will be appended to any PR comments posted'
2621
required: false
2722
tools:
28-
description: 'Comma separated list of tools to run'
2923
required: false
30-
default: 'sca,sast'
24+
deprecationMessage: 'This option is not used anymore'
3125
eval-indirect-dependencies:
3226
description: 'Show vulnerabilities found in transitive dependencies'
3327
required: false
@@ -36,10 +30,6 @@ inputs:
3630
description: 'Set to true to enable automated pull-requests for fix suggestions'
3731
required: false
3832
default: false
39-
dynamic:
40-
description: 'Set to true to integrate SCA results with dynamic data, such as package activity'
41-
required: false
42-
default: false
4333
outputs:
4434
old-completed:
4535
description: 'If running a target called old, whether the analysis for this was completed'
@@ -71,7 +61,6 @@ runs:
7161
shell: bash
7262
env:
7363
LACEWORK_ACTION_REF: '${{ github.action_ref }}'
74-
TOOLS: '${{ inputs.tools }}'
7564
run: |
7665
LACEWORK_CONTEXT_ID=`echo $RANDOM | md5sum | head -c 32`
7766
echo "Lacework context ID: $LACEWORK_CONTEXT_ID"
@@ -81,10 +70,8 @@ runs:
8170
curl https://raw.githubusercontent.com/lacework/go-sdk/main/cli/install.sh | bash
8271
KEY="$(date +'%Y-%m-%d')"
8372
KEY="$KEY-$RUNNER_OS-$RUNNER_ARCH"
84-
if [[ $TOOLS == *"sca"* ]]; then
85-
KEY="$KEY-sca-$SCA_VERSION"
86-
echo "sca-version=$SCA_VERSION" >> $GITHUB_OUTPUT
87-
fi
73+
KEY="$KEY-sca-$SCA_VERSION"
74+
echo "sca-version=$SCA_VERSION" >> $GITHUB_OUTPUT
8875
HASH="$(echo $KEY | md5sum | head -c 8)"
8976
echo "cache-key=$HASH" >> $GITHUB_OUTPUT
9077
- id: cache
@@ -129,7 +116,6 @@ runs:
129116
- id: run-analysis
130117
uses: './../lacework-code-security'
131118
with:
132-
classpath: '${{ inputs.classpath }}'
133119
sources: '${{ inputs.sources }}'
134120
target: '${{ inputs.target }}'
135121
debug: '${{ inputs.debug }}'
@@ -138,4 +124,3 @@ runs:
138124
tools: '${{ inputs.tools }}'
139125
eval-indirect-dependencies: '${{ inputs.eval-indirect-dependencies }}'
140126
autofix: '${{ inputs.autofix }}'
141-
dynamic: '${{ inputs.dynamic }}'

src/index.ts

Lines changed: 37 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
import { compareResults, createPRs, printResults } from './tool'
1010
import {
1111
autofix,
12-
dynamic,
1312
callCommand,
1413
callLaceworkCli,
1514
debug,
@@ -42,59 +41,47 @@ async function runAnalysis() {
4241
}
4342

4443
info('Analyzing ' + target)
45-
const tools = (getInput('tools') || 'sca')
46-
.toLowerCase()
47-
.split(',')
48-
.map((x) => x.trim())
49-
.sort()
50-
telemetryCollector.addField('tools', tools.join(','))
51-
appendFileSync(getRequiredEnvVariable('GITHUB_ENV'), `LACEWORK_TOOLS=${tools.join(',')}\n`)
44+
telemetryCollector.addField('tools', 'sca')
5245
const indirectDeps = getInput('eval-indirect-dependencies')
5346
const toUpload: string[] = []
54-
if (tools.includes('sca')) {
55-
await downloadKeys()
56-
// command to print both sarif and lwjson formats
57-
var args = [
58-
'sca',
59-
'scan',
60-
'.',
61-
'--save-results',
62-
'-o',
63-
scaDir,
64-
'--formats',
65-
'sarif,lw-json',
66-
'--deployment',
67-
'ci',
68-
'--keyring',
69-
trustedKeys,
70-
'--secret',
71-
]
72-
if (indirectDeps.toLowerCase() === 'false') {
73-
args.push('--eval-direct-only')
74-
}
75-
if (debug()) {
76-
args.push('--debug')
77-
}
78-
if (autofix()) {
79-
args.push('--fix-suggestions')
80-
}
81-
if (dynamic()) {
82-
args.push('--dynamic')
83-
}
84-
if (tools.includes('sast')) {
85-
args.push('--fast')
86-
}
87-
await callLaceworkCli(...args)
88-
// make a copy of the sarif file
89-
args = [scaSarifReport, scaReport]
90-
await callCommand('cp', ...args)
9147

92-
await printResults('sca', scaReport)
93-
if (autofix()) {
94-
await createPRs(scaLWJSONReport)
95-
}
96-
toUpload.push(scaReport)
48+
await downloadKeys()
49+
// command to print both sarif and lwjson formats
50+
var args = [
51+
'sca',
52+
'scan',
53+
'.',
54+
'--save-results',
55+
'-o',
56+
scaDir,
57+
'--formats',
58+
'sarif,lw-json',
59+
'--deployment',
60+
'ci',
61+
'--keyring',
62+
trustedKeys,
63+
'--secret',
64+
]
65+
if (indirectDeps.toLowerCase() === 'false') {
66+
args.push('--eval-direct-only')
67+
}
68+
if (debug()) {
69+
args.push('--debug')
70+
}
71+
if (autofix()) {
72+
args.push('--fix-suggestions')
9773
}
74+
await callLaceworkCli(...args)
75+
// make a copy of the sarif file
76+
args = [scaSarifReport, scaReport]
77+
await callCommand('cp', ...args)
78+
79+
await printResults('sca', scaReport)
80+
if (autofix()) {
81+
await createPRs(scaLWJSONReport)
82+
}
83+
toUpload.push(scaReport)
84+
9885
const uploadStart = Date.now()
9986
await uploadArtifact('results-' + target, ...toUpload)
10087
telemetryCollector.addField('duration.upload-artifacts', (Date.now() - uploadStart).toString())

src/post.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ async function main() {
3232
telemetryCollector.addField('repository', getRequiredEnvVariable('GITHUB_REPOSITORY'))
3333
telemetryCollector.addField('duration.total', getMsSinceStart())
3434
telemetryCollector.addField('error', 'Unknown catastrophic error')
35-
if (getOptionalEnvVariable('LACEWORK_TOOLS', '') !== '') {
36-
telemetryCollector.addField('tools', getRequiredEnvVariable('LACEWORK_TOOLS'))
37-
}
35+
telemetryCollector.addField('tools', 'sca')
3836
await telemetryCollector.report()
3937
} else {
4038
info('Telemetry has been reported previously')

src/util.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ export function autofix() {
2929
return getBooleanInput('autofix') && getInput('target') != 'old'
3030
}
3131

32-
export function dynamic() {
33-
return getBooleanInput('dynamic')
34-
}
35-
3632
export function getRunUrl(): string {
3733
let result = getRequiredEnvVariable('GITHUB_SERVER_URL')
3834
result += '/'

0 commit comments

Comments
 (0)