Skip to content

Commit 17bfac3

Browse files
authored
Merge pull request #50 from dependency-check/develop
v6.0.2 Release
2 parents 360d647 + 8d9ac56 commit 17bfac3

File tree

4 files changed

+66
-45
lines changed

4 files changed

+66
-45
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ dist/
2323

2424
# Visual Studio 2015 cache/options directory
2525
.vs/
26+
.pumafile
2627

2728
node_modules
2829
.vscode

build/data-cache/data-cache.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ BUCKET_NAME=$3
66
DISTRIBUTION_ID=$4
77

88
#install dep check
9-
curl -sLo ./dependency-check-$VERSION-release.zip https://dl.bintray.com/jeremy-long/owasp/dependency-check-$VERSION-release.zip
9+
curl -sLo ./dependency-check-$VERSION-release.zip https://github.com/jeremylong/DependencyCheck/releases/download/v$VERSION/dependency-check-$VERSION-release.zip
1010
unzip -q ./dependency-check-$VERSION-release.zip
1111

1212
#version check

src/Tasks/dependency-check-build-task/dependency-check-build-task.ps1

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,36 @@ try {
3232
$format = Get-VstsInput -Name 'format' -Require
3333
$failOnCVSS = Get-VstsInput -Name 'failOnCVSS' -Default ''
3434
$suppressionPath = Get-VstsInput -Name 'suppressionPath' -Default ''
35+
$reportsDirectory = Get-VstsInput -Name 'reportsDirectory' -Default ''
3536
$enableExperimental = Get-VstsInput -Name 'enableExperimental' -Require -AsBool
3637
$enableRetired = Get-VstsInput -Name 'enableRetired' -Require -AsBool
3738
$enableVerbose = Get-VstsInput -Name 'enableVerbose' -Require -AsBool
38-
$dataMirrorJson = Get-VstsInput -Name 'dataMirrorJson' -Default ''
39-
$dataMirrorOdc = Get-VstsInput -Name 'dataMirrorOdc' -Default ''
39+
$localInstallPath = Get-VstsInput -Name 'localInstallPath' -Default ''
40+
$dependencyCheckVersion = Get-VstsInput -Name 'dependencyCheckVersion' -Default '6.0.2'
41+
$dataMirror = Get-VstsInput -Name 'dataMirror' -Default ''
42+
4043
$additionalArguments = Get-VstsInput -Name 'additionalArguments' -Default ''
4144

4245
#Trim the strings
4346
$projectName = $projectName.Trim();
4447
$scanPath = $scanPath.Trim();
4548
$excludePath = $excludePath.Trim();
4649
$suppressionPath = $suppressionPath.Trim();
50+
$reportsDirectory = $reportsDirectory.Trim();
4751
$additionalArguments = $additionalArguments.Trim();
52+
$localInstallPath = $localInstallPath.Trim();
4853

49-
#Create reports directory
50-
$testDirectory = $Env:COMMON_TESTRESULTSDIRECTORY
51-
$reportsDirectory = "$testDirectory\dependency-check"
54+
#Set reports directory (if necessary)
55+
if ($Env:BUILD_REPOSITORY_LOCALPATH -eq $reportsDirectory){
56+
$testDirectory = $Env:COMMON_TESTRESULTSDIRECTORY
57+
$reportsDirectory = "$testDirectory\dependency-check"
58+
}
59+
Write-Host "Setting report directory to $reportsDirectory"
5260

53-
# Check if report directory does not exist
61+
# Create report directory (if necessary)
5462
if(!(Test-Path -Path $reportsDirectory))
5563
{
56-
Write-Host "Creating dependency check test results directory at $reportsDirectory"
64+
Write-Host "Creating report directory at $reportsDirectory"
5765
New-Item $reportsDirectory -Type Directory
5866
}
5967

@@ -105,46 +113,42 @@ try {
105113
$arguments = $arguments + " " + $additionalArguments
106114
}
107115

108-
#Get dependency check path
109-
$binDirectory = "dependency-check"
110-
$binDirectory = $binDirectory | Resolve-Path
111-
112116
#Set PS invoke web args
113117
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
114118
$ProgressPreference = 'SilentlyContinue'
115119

116-
# Pull installer file
117-
if(Test-Path $binDirectory -PathType Container) {
118-
Write-Host -Verbose "Downloading Dependency Check installer..."
119-
Invoke-WebRequest "https://dl.bintray.com/jeremy-long/owasp/dependency-check-5.3.2-release.zip" -OutFile "dependency-check-5.3.2-release.zip"
120-
Expand-Archive -Path dependency-check-5.3.2-release.zip -DestinationPath . -Force
120+
# Set installation location
121+
if ($Env:BUILD_REPOSITORY_LOCALPATH -eq $localInstallPath){
122+
#Get dependency check path
123+
$localInstallPath = "dependency-check"
124+
$localInstallPath = $localInstallPath | Resolve-Path
125+
126+
if(Test-Path $localInstallPath -PathType Container) {
127+
Write-Host -Verbose "Downloading Dependency Check v$dependencyCheckVersion installer..."
128+
Invoke-WebRequest "https://github.com/jeremylong/DependencyCheck/releases/download/v$dependencyCheckVersion/dependency-check-$dependencyCheckVersion-release.zip" -OutFile "dependency-check-release.zip"
129+
Expand-Archive -Path dependency-check-release.zip -DestinationPath . -Force
130+
}
121131
}
122132

123133
#Get dependency check data dir path
124-
$dataDirectory = "dependency-check/data"
134+
$dataDirectory = "$localInstallPath/data"
125135
$dataDirectoryPath = $dataDirectory | Resolve-Path
126136

127-
# Pull JSON cached file
128-
if([string]::IsNullOrEmpty($dataMirrorJson) -eq $false ) {
137+
# Pull cached data archive
138+
if([string]::IsNullOrEmpty($dataMirror) -eq $false ) {
129139
if(Test-Path $dataDirectoryPath -PathType Container) {
130-
Write-Host -Verbose "Downloading Dependency Check vulnerability JSON data mirror..."
131-
Invoke-WebRequest $dataMirrorJson -OutFile "$dataDirectory/jsrepository.json"
132-
}
133-
}
134-
135-
# Pull ODC cached file
136-
if([string]::IsNullOrEmpty($dataMirrorOdc) -eq $false ) {
137-
if(Test-Path $dataDirectoryPath -PathType Container) {
138-
Write-Host -Verbose "Downloading Dependency Check vulnerability DB data mirror..."
139-
Invoke-WebRequest $dataMirrorOdc -OutFile "$dataDirectory/odc.mv.db"
140+
Write-Host -Verbose "Downloading Dependency Check data cache archive..."
141+
Invoke-WebRequest $dataMirror -OutFile "$dataDirectory/data.zip"
142+
Expand-Archive -Path "$dataDirectory/data.zip" -DestinationPath "$dataDirectory" -Force
140143
}
141144
}
142145

143146
#Get dependency check script path
144147
$depCheck = "dependency-check.bat"
145-
$depCheckScripts = "dependency-check/bin"
148+
$depCheckScripts = "$localInstallPath/bin"
146149
$depCheckPath = $depCheckScripts | Resolve-Path | Join-Path -ChildPath "$depCheck"
147-
150+
Write-Host -Verbose "Dependency Check installer set to $depCheckPath"
151+
148152
#Default status to pass, change evaling the exit code below
149153
$failed = $false
150154

src/Tasks/dependency-check-build-task/task.json

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@
7575
"required": false,
7676
"helpMarkDown": "The file path to the suppression XML file used to suppress false positives. This can be specified more than once to utilize multiple suppression files. The argument can be a local file path, a URL to a suppression file, or even a reference to a file on the class path."
7777
},
78+
{
79+
"name": "reportsDirectory",
80+
"type": "filePath",
81+
"label": "Report Directory",
82+
"defaultValue": "",
83+
"required": false,
84+
"helpMarkDown": "Report output directory. On-prem build agents can specify a local directory to override the default location. The default location is the $COMMON_TESTRESULTSDIRECTORY\\dependency-check directory."
85+
},
7886
{
7987
"name": "enableExperimental",
8088
"type": "boolean",
@@ -100,28 +108,36 @@
100108
"helpMarkDown": "Enable verbose logging."
101109
},
102110
{
103-
"name": "dataMirrorOdc",
104-
"type": "string",
105-
"label": "ODC Database File Mirror (odc.mv.db) URL",
106-
"helpMarkDown": "The https path to the cached Dependency Check database file (odc.mv.db).",
111+
"name": "additionalArguments",
112+
"type": "multiLine",
113+
"label": "Additional Arguments",
114+
"defaultValue": "",
115+
"required": false,
116+
"helpMarkDown": "Pass additional command line arguments to the Dependency Check command line interface."
117+
},
118+
{
119+
"name": "localInstallPath",
120+
"type": "filePath",
121+
"label": "Local Install Path",
122+
"helpMarkDown": "The local path to the `dependency-check` installation directory (on-prem build agents only). Setting this field will run Dependency Check locally instead of downloading the installer onto the build agent.",
107123
"defaultValue": "",
108124
"required": false
109125
},
110126
{
111-
"name": "dataMirrorJson",
127+
"name": "dependencyCheckVersion",
112128
"type": "string",
113-
"label": "JSON Repository File Mirror (jsrepository.json) URL",
114-
"helpMarkDown": "The https path to the cached Dependency Check JSON repository file (jsrepository.json).",
115-
"defaultValue": "",
129+
"label": "Installer Version",
130+
"helpMarkDown": "The Dependency Check version to download (cloud-hosted build agents only). Setting this field will download Dependency Check locally onto the build agent during execution.",
131+
"defaultValue": "6.0.2",
116132
"required": false
117133
},
118134
{
119-
"name": "additionalArguments",
120-
"type": "multiLine",
121-
"label": "Additional Arguments",
135+
"name": "dataMirror",
136+
"type": "string",
137+
"label": "Data Mirror Archive URL",
138+
"helpMarkDown": "The https path to the compressed Dependency Check data directory (containing the odc.mv.db and jsrepository.json files).",
122139
"defaultValue": "",
123-
"required": false,
124-
"helpMarkDown": "Pass additional command line arguments to the Dependency Check command line interface."
140+
"required": false
125141
}
126142
],
127143
"instanceNameFormat": "Dependency Check",

0 commit comments

Comments
 (0)