-
-
Notifications
You must be signed in to change notification settings - Fork 420
/
build.gradle
176 lines (149 loc) · 5.25 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.4.5")
}
}
//Community Plugins
plugins {
id("com.diffplug.spotless") version "5.6.1"
id("com.google.cloud.tools.jib") version "3.3.1"
id("org.sonarqube") version "3.3"
id("jacoco")
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
bootJar {
baseName = 'VulnerableApp'
version = '1.0.0'
}
configurations {
all {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
}
repositories {
mavenCentral()
gradlePluginPortal()
mavenLocal()
}
sonarqube {
properties {
property "sonar.projectKey", "SasanLabs_VulnerableApp"
property "sonar.organization", "sasanlabs"
property "sonar.host.url", "https://sonarcloud.io"
property 'sonar.java.source', '1.8'
property 'sonar.java.target', '1.8'
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
spotless {
java {
// Don't enforce the license, just the format.
clearSteps()
googleJavaFormat().aosp()
}
format 'javascript', {
target 'src/main/resources/**/*.js'
prettier().config(['filepath': 'file.js'])
}
}
jib {
to {
image = 'sasanlabs/owasp-vulnerableapp:unreleased'
}
// Set up multi-platform build only if the task is not :jibDockerBuild
if (!project.gradle.startParameter.taskNames.contains("jibDockerBuild")) {
logger.info("JIB: Enabling Multi-Platform Images")
from {
image = 'openjdk:8-jre-alpine'
platforms {
platform {
architecture = 'amd64'
os = 'linux'
}
platform {
architecture = 'arm64'
os = 'linux'
}
platform {
architecture = '386'
os = 'linux'
}
platform {
architecture = 's390x'
os = 'linux'
}
platform {
architecture = 'ppc64le'
os = 'linux'
}
}
}
}
}
jacoco {
toolVersion = "0.8.5"
reportsDir = file("$buildDir/jacoco")
}
tasks.register('GenerateSampleVulnerability'){
group = 'SasanLabs'
description = 'Generates Sample Vulnerability template'
println 'Copying SampleVulnerability java file to org.sasanlabs.service.vulnerability.sampleVulnerability package'
copy {
from(file('src/main/resources/sampleVulnerability/sampleVulnerability'))
into(file('src/main/java/org/sasanlabs/service/vulnerability/sampleVulnerability'))
}
println 'Copy of java file is completed'
println 'Copying SampleVulnerability html/css/js files to static/templates/SampleVulnerability/LEVEL_1'
copy {
from(file('src/main/resources/sampleVulnerability/staticResources/LEVEL_1'))
into(file('src/main/resources/static/templates/SampleVulnerability/LEVEL_1'))
}
println 'Copy of html/css/js files is completed'
println 'SampleVulnerability is generated !!!'
enabled = false
}
dependencies {
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
// https://mvnrepository.com/artifact/org.mockito/mockito-core
testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.5.13'
// https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: '5.7.0'
// https://mvnrepository.com/artifact/org.assertj/assertj-core
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.17.2'
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '2.3.1.RELEASE'
runtimeOnly group:'com.h2database', name:'h2', version: '1.3.176'
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.8'
//Log4j Dependencies
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-log4j2'
// https://mvnrepository.com/artifact/org.json/json
implementation group: 'org.json', name: 'json', version: '20190722'
//https://mvnrepository.com/artifact/com.nimbusds/nimbus-jose-jwt
implementation group: 'com.nimbusds', name: 'nimbus-jose-jwt', version: '8.3'
// https://mvnrepository.com/artifact/commons-io/commons-io
implementation group: 'commons-io', name: 'commons-io', version: '2.7'
implementation group: 'io.github.sasanlabs', name: 'facade-schema', version: '1.0.1'
implementation group: 'commons-fileupload', name: 'commons-fileupload', version: '1.5'
}
test {
useJUnitPlatform()
finalizedBy jacocoTestReport
}
jacocoTestReport {
dependsOn test
reports {
xml.enabled true
html.enabled true
csv.enabled false
xml.destination file("${buildDir}/reports/jacoco.xml")
}
}