Skip to content

Commit 5f31916

Browse files
authored
Merge pull request #213 from kit-data-manager/development
PR for v1.5.4
2 parents f0b3de5 + 2240783 commit 5f31916

File tree

11 files changed

+97
-48
lines changed

11 files changed

+97
-48
lines changed

CHANGELOG.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,37 @@ Fixed
1414

1515
Security
1616

17+
## [1.5.4] - 2024-04-03
18+
Added
19+
* Allow builds outside Git repository, e.g., when building from release packages
20+
21+
Changed
22+
* Pagination now returns HTTP 416 (RangeNotSatisfiable) if page number exceeds total pages
23+
24+
Fixed
25+
* Added fix in default application.properties to make Elastic proxy work again
26+
* Fixed issue disallowing OPTIONS requests outside browser
27+
28+
Security
29+
* Bump gradle to 8.5
30+
* Bump jacoco to 0.8.11
31+
* Bump org.owasp.dependencycheck to 9.0.10
32+
* Bump io.freefair.maven-publish-java to 8.6
33+
* Bump org.springframework.boot to 3.2.4
34+
* Bump spring-security-web to 6.2.1
35+
* Bump spring-security-config to 6.2.1
36+
* Bump spring-messaging to 6.1.4
37+
* Bump spring-cloud-gateway-mvc to 4.1.2
38+
* Bump spring-boot-admin-starter-client to 3.2.3
39+
* Bump spring-cloud-starter-netflix-eureka-client to 4.1.1
40+
* Bump spring-cloud-starter-config to 4.1.1
41+
* Bump spring-data-elasticsearch to 5.2.4
42+
* Bump io.freefair.lombok to 8.6
43+
* Bump org.asciidoctor.jvm.convert to 4.0.2
44+
* Bump postgresql to 42.7.3
45+
* Bump service-base to 1.2.1
46+
* Bump repo-core to 1.2.2
47+
1748
## [1.5.3] - 2023-12-17
1849
Fixed
1950
* Added data folder creation to Docker build as workaround
@@ -212,7 +243,8 @@ Added
212243

213244
- First public version
214245

215-
[Unreleased]: https://github.com/kit-data-manager/base-repo/compare/v1.5.3...HEAD
246+
[Unreleased]: https://github.com/kit-data-manager/base-repo/compare/v1.5.4...HEAD
247+
[1.5.4]: https://github.com/kit-data-manager/base-repo/compare/v1.5.3...v1.5.4
216248
[1.5.3]: https://github.com/kit-data-manager/base-repo/compare/v1.5.2...v1.5.3
217249
[1.5.2]: https://github.com/kit-data-manager/base-repo/compare/v1.5.1...v1.5.2
218250
[1.5.1]: https://github.com/kit-data-manager/base-repo/compare/v1.5.0...v1.5.1

build.gradle

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
plugins {
2-
id 'org.springframework.boot' version '3.2.0'
2+
id 'org.springframework.boot' version '3.2.4'
33
id 'io.spring.dependency-management' version '1.1.4'
4-
id 'io.freefair.lombok' version '8.4'
5-
id 'io.freefair.maven-publish-java' version '8.4'
6-
id 'org.owasp.dependencycheck' version '9.0.2'
7-
id 'org.asciidoctor.jvm.convert' version '3.3.2'
4+
id 'io.freefair.lombok' version '8.6'
5+
id 'io.freefair.maven-publish-java' version '8.6'
6+
id 'org.owasp.dependencycheck' version '9.1.0'
7+
id 'org.asciidoctor.jvm.convert' version '4.0.2'
88
id 'net.researchgate.release' version '3.0.2'
99
id 'com.gorylenko.gradle-git-properties' version '2.4.1'
1010
id 'java'
@@ -28,9 +28,9 @@ repositories {
2828
//}
2929

3030
ext {
31-
set('javersVersion', "7.0.0")
32-
set('springBootVersion', "3.2.0")
33-
set('springDocVersion', "2.1.0")
31+
set('javersVersion', "7.3.7")
32+
set('springBootVersion', "3.2.1")
33+
set('springDocVersion', "2.3.0")
3434
set('keycloakVersion', "19.0.0")
3535

3636
// directory for generated code snippets during tests
@@ -41,8 +41,8 @@ println "Running gradle version: $gradle.gradleVersion"
4141
println "Building ${name} version: ${version}"
4242
println "JDK version: ${JavaVersion.current()}"
4343

44-
sourceCompatibility = 1.17
45-
targetCompatibility = 1.17
44+
sourceCompatibility = JavaVersion.VERSION_17
45+
targetCompatibility = JavaVersion.VERSION_17
4646

4747
if (System.getProperty('profile') == 'minimal') {
4848
println 'Using minimal profile for building ' + project.getName()
@@ -58,27 +58,25 @@ dependencies {
5858
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
5959
implementation "org.springframework.boot:spring-boot-starter-data-rest"
6060
implementation "org.springframework.boot:spring-boot-starter-mail"
61+
implementation "org.springframework.boot:spring-boot-starter-security"
6162
implementation "org.springframework.boot:spring-boot-starter-actuator"
62-
implementation 'org.springframework.data:spring-data-elasticsearch:5.2.0'
63+
implementation 'org.springframework.data:spring-data-elasticsearch:5.2.4'
6364

64-
implementation "org.springframework:spring-messaging:6.1.1"
65-
implementation "org.springframework.security:spring-security-web:6.2.0"
66-
implementation "org.springframework.security:spring-security-config:6.2.0"
65+
implementation "org.springframework:spring-messaging:6.1.5"
6766

6867
// cloud support
69-
implementation "org.springframework.cloud:spring-cloud-starter-config:4.1.0"
70-
implementation "org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:4.1.0"
71-
implementation "org.springframework.cloud:spring-cloud-gateway-mvc:4.1.0"
72-
implementation 'de.codecentric:spring-boot-admin-starter-client:3.1.8'
73-
68+
implementation "org.springframework.cloud:spring-cloud-starter-config:4.1.1"
69+
implementation "org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:4.1.1"
70+
implementation "org.springframework.cloud:spring-cloud-gateway-mvc:4.1.2"
71+
implementation 'de.codecentric:spring-boot-admin-starter-client:3.2.3'
7472

7573
// springdoc
7674
implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:${springDocVersion}"
7775
implementation "org.springdoc:springdoc-openapi-starter-common:${springDocVersion}"
7876
implementation "org.springdoc:springdoc-openapi-starter-webmvc-api:${springDocVersion}"
7977

80-
implementation "edu.kit.datamanager:repo-core:1.2.1"
81-
implementation "edu.kit.datamanager:service-base:1.2.0"
78+
implementation "edu.kit.datamanager:repo-core:1.2.2"
79+
implementation "edu.kit.datamanager:service-base:1.2.1"
8280

8381
//implementation "com.github.victools:jsonschema-generator:4.23.0"
8482

@@ -99,7 +97,7 @@ dependencies {
9997
runtimeOnly "org.apache.httpcomponents:httpclient:4.5.14"
10098

10199
// driver for postgres
102-
implementation "org.postgresql:postgresql:42.7.1"
100+
implementation "org.postgresql:postgresql:42.7.3"
103101
//driver for h2
104102
implementation "com.h2database:h2:2.2.224"
105103

@@ -136,6 +134,10 @@ springBoot {
136134
buildInfo()
137135
}
138136

137+
gitProperties {
138+
failOnNoGitDirectory = false
139+
}
140+
139141
bootJar {
140142
println 'Create bootable jar...'
141143
archiveFileName = "${archiveBaseName.get()}.${archiveExtension.get()}"
@@ -146,6 +148,10 @@ bootJar {
146148
launchScript()
147149
}
148150

151+
jacoco {
152+
toolVersion = "0.8.11"
153+
}
154+
149155
// task for printing project name.
150156
task printProjectName {
151157
doLast {

config/application-default.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ server.port: 8090
1515
server.compression.enabled: false
1616
spring.servlet.multipart.max-file-size: 100MB
1717
spring.servlet.multipart.max-request-size: 100MB
18+
# Added as workaround for issue https://github.com/spring-cloud/spring-cloud-gateway/issues/3154
19+
spring.cloud.gateway.proxy.sensitive=content-length
1820

1921
#server.ssl.key-store: keystore.p12
2022
#server.ssl.key-store-password: test123

gradle/profile-complete.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ test {
77
jacocoTestReport {
88
dependsOn test
99
reports {
10-
xml.enabled true
11-
html.enabled false
10+
xml.required = true
11+
html.required = true
1212
}
1313
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/java/edu/kit/datamanager/repo/configuration/WebSecurityConfig.java

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
4040
import org.springframework.security.web.firewall.DefaultHttpFirewall;
4141
import org.springframework.security.web.firewall.HttpFirewall;
42+
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
4243
import org.springframework.web.cors.CorsConfiguration;
4344
import org.springframework.web.cors.CorsConfigurationSource;
4445
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
@@ -80,22 +81,30 @@ public WebSecurityConfig() {
8081

8182
@Bean
8283
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
84+
85+
86+
8387
HttpSecurity httpSecurity = http.authorizeHttpRequests(
84-
authorize -> authorize.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll().
85-
requestMatchers("/oaipmh").permitAll().
86-
requestMatchers("/static/**").permitAll().
87-
requestMatchers(AUTH_WHITELIST_SWAGGER_UI).permitAll().
88+
authorize -> authorize.
89+
requestMatchers(HttpMethod.OPTIONS).permitAll().
8890
requestMatchers(EndpointRequest.to(
8991
InfoEndpoint.class,
9092
HealthEndpoint.class
9193
)).permitAll().
9294
requestMatchers(EndpointRequest.toAnyEndpoint()).hasAnyRole("ANONYMOUS", "ADMIN", "ACTUATOR", "SERVICE_WRITE").
93-
requestMatchers("/**").authenticated()).
95+
requestMatchers(new AntPathRequestMatcher("/oaipmh")).permitAll().
96+
requestMatchers(new AntPathRequestMatcher("/static/**")).permitAll().
97+
requestMatchers(new AntPathRequestMatcher("/api/v1/search")).permitAll().
98+
requestMatchers(AUTH_WHITELIST_SWAGGER_UI).permitAll().
99+
anyRequest().authenticated()
100+
).
101+
cors(cors -> cors.configurationSource(corsConfigurationSource())).
94102
sessionManagement(
95103
session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS));
96-
logger.info("Disable CSRF");
104+
105+
logger.info("CSRF disabled!");
97106
httpSecurity = httpSecurity.csrf(csrf -> csrf.disable());
98-
107+
99108
logger.info("Adding 'NoAuthenticationFilter' to authentication chain.");
100109
if (keycloaktokenFilterBean.isPresent()) {
101110
logger.info("Add keycloak filter!");
@@ -128,18 +137,17 @@ public HttpFirewall allowUrlEncodedSlashHttpFirewall() {
128137
return firewall;
129138
}
130139

131-
@Bean
132-
public CorsConfigurationSource corsConfigurationSource() {
133-
CorsConfiguration configuration = new CorsConfiguration();
134-
configuration.setAllowedOrigins(Arrays.asList(
135-
"*"));
136-
configuration.setAllowedMethods(Arrays.asList("*"));
137-
configuration.addAllowedHeader("*");
138-
configuration.addExposedHeader("Content-Range");
139-
configuration.addExposedHeader("ETag");
140+
public CorsConfigurationSource corsConfigurationSource() {
141+
CorsConfiguration config = new CorsConfiguration();
142+
config.setAllowCredentials(true);
143+
config.addAllowedOriginPattern("*");
144+
config.setAllowedHeaders(Arrays.asList("*"));
145+
config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"));
146+
config.addExposedHeader("Content-Range");
147+
config.addExposedHeader("ETag");
148+
final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
140149

141-
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
142-
source.registerCorsConfiguration("/**", configuration);
150+
source.registerCorsConfiguration("/**", config);
143151
return source;
144152
}
145153
}

src/main/java/edu/kit/datamanager/repo/elastic/ElasticWrapper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public class ElasticWrapper {
4343
@Id
4444
private String id;
4545

46+
@Field(type = FieldType.Text)
4647
private String pid;
4748

4849
@Field(type = FieldType.Object, name = "metadata")

src/test/java/edu/kit/datamanager/repo/test/integration/DataResourceControllerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ public void testFindDataResourcesByExampleWithInvalidPageNumber() throws Excepti
358358
ObjectMapper mapper = createObjectMapper();
359359

360360
this.mockMvc.perform(post("/api/v1/dataresources/search").contentType(MediaType.APPLICATION_JSON).content(mapper.writeValueAsString(example)).param("page", "10").param("size", "10").header(HttpHeaders.AUTHORIZATION,
361-
"Bearer " + userToken)).andDo(print()).andExpect(status().isOk()).andExpect(MockMvcResultMatchers.jsonPath("$").isEmpty());
361+
"Bearer " + userToken)).andDo(print()).andExpect(status().is(416));
362362
}
363363

364364
@Test

src/test/java/edu/kit/datamanager/repo/test/integration/DataResourceControllerTestReadOnly.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ public void testFindDataResourcesByExampleWithInvalidPageNumber() throws Excepti
359359
ObjectMapper mapper = createObjectMapper();
360360

361361
this.mockMvc.perform(post("/api/v1/dataresources/search").contentType(MediaType.APPLICATION_JSON).content(mapper.writeValueAsString(example)).param("page", "10").param("size", "10").header(HttpHeaders.AUTHORIZATION,
362-
"Bearer " + userToken)).andDo(print()).andExpect(status().isOk()).andExpect(MockMvcResultMatchers.jsonPath("$").isEmpty());
362+
"Bearer " + userToken)).andDo(print()).andExpect(status().is(416));
363363
}
364364

365365
@Test

src/test/java/edu/kit/datamanager/repo/test/integration/DataResourceControllerTestWithoutVersioning.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ public void testFindDataResourcesByExampleWithInvalidPageNumber() throws Excepti
355355
ObjectMapper mapper = createObjectMapper();
356356

357357
this.mockMvc.perform(post("/api/v1/dataresources/search").contentType(MediaType.APPLICATION_JSON).content(mapper.writeValueAsString(example)).param("page", "10").param("size", "10").header(HttpHeaders.AUTHORIZATION,
358-
"Bearer " + userToken)).andDo(print()).andExpect(status().isOk()).andExpect(MockMvcResultMatchers.jsonPath("$").isEmpty());
358+
"Bearer " + userToken)).andDo(print()).andExpect(status().is(416));
359359
}
360360

361361
@Test

0 commit comments

Comments
 (0)