Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rest-backend and rest-lib-utils to SpringBoot 2.5.1 #167

Merged
merged 49 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
47b8697
updated cia to spring2; updated backend to spring2 but flyway is missing
serenaponta Apr 23, 2019
1176e0a
update property
serenaponta Apr 23, 2019
2538a3a
Update application-docker.properties
serenaponta Apr 23, 2019
e327c2c
removed spring migrator dependency
serenaponta Apr 23, 2019
6566443
Merge branch 'master' into spring2
serenaponta Jun 5, 2019
882d0f5
added migration to fix checksum
serenaponta Jun 6, 2019
56aafd5
remove migration
serenaponta Jun 6, 2019
81d7588
Merge branch 'master' into spring2
serenaponta Jun 28, 2019
a5c0f58
Merge branch 'master' into spring2
serenaponta Jul 12, 2019
70059f5
Merge branch 'master' into spring2
serenaponta Jul 12, 2019
7ddaa04
updated new code from master to spring2
serenaponta Jul 12, 2019
c28ba31
Removed commented findById methods from *Repository.java
serenaponta Jul 12, 2019
5333a10
Merge branch 'master' into spring2
serenaponta Aug 5, 2019
a6aecc1
update spring-boot version
serenaponta Aug 5, 2019
b977094
Merge branch 'master' into spring2
serenaponta Aug 5, 2019
815d835
update new code to spring2
serenaponta Aug 5, 2019
b0ce59c
Merge branch 'master' into spring2
serenaponta Aug 21, 2019
70fd3d3
updated spring and flyway versions
serenaponta Aug 22, 2019
f94927f
revert Id GeneratorStyle to the Spring 1.5 default (false)
serenaponta Aug 22, 2019
9c074af
Merge branch 'master' into spring2
serenaponta Sep 5, 2019
bcc6f0e
updated flyway to version 6.0.1
serenaponta Sep 5, 2019
5776420
updated versions of spring, flyway, swagger and related code changes
serenaponta Feb 26, 2020
08738ad
Merge master in spring2
serenaponta Feb 26, 2020
32172a9
use h2 version from springboot 2.2 parent
serenaponta Feb 26, 2020
b7422b0
moved to springdocs for api documentation(swagger)
serenaponta Feb 28, 2020
74fb30b
add missing dependency
serenaponta Feb 28, 2020
1ba835d
change column type to make constraint work with H2
serenaponta Feb 28, 2020
1803f6c
fix typo
serenaponta Mar 2, 2020
6a424dc
resolve conflict with master
serenaponta Jul 13, 2020
d8cc251
update to tomcat 9
serenaponta Jul 13, 2020
1987882
Merge branch 'master' into spring2
serenaponta Aug 11, 2020
0e6cabc
fix log dependency for dependency-finder
serenaponta Aug 14, 2020
74ce017
applied google java style
serenaponta Aug 19, 2020
6a64ab2
merged master
serenaponta Aug 24, 2020
7048820
restored test from spring2
serenaponta Aug 24, 2020
48a316b
fix remaining conflicts + style
serenaponta Aug 24, 2020
825b26a
formatting with script instead of plugin
serenaponta Aug 24, 2020
e260722
resolved merge conflicts
serenaponta Oct 5, 2020
30776ea
formatted
serenaponta Oct 5, 2020
ab581bd
resolved merge conflict
serenaponta Jun 2, 2021
58107f2
updated to tomcat 9.x
serenaponta Jun 2, 2021
4239065
updated to spring boot 2.5.0
serenaponta Jun 4, 2021
160e94e
merged master
serenaponta Jun 14, 2021
5c5eb43
downgrade flyway-core
serenaponta Jun 14, 2021
10c6796
started addressing review comments
serenaponta Jun 15, 2021
f45e4da
addressed remaining review comments
serenaponta Jun 15, 2021
7ec266e
additional cleanup
serenaponta Jun 15, 2021
686d801
fix get goal details
serenaponta Jun 16, 2021
5460636
configure hikari pool size
serenaponta Jun 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ public Path rewrite(Path _todir) throws JarAnalysisException {
}

// Add additional files

for (Map.Entry<String, Path> e : this.additionalFiles.entrySet()) {
if (e.getValue().toFile().exists()) {
new_entry = new JarEntry(e.getKey());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ private void writeSourceCodeEntityElement(
jgen.writeObjectFieldStart(_property_name);
jgen.writeStringField("UniqueName", _entity.getUniqueName().toString());
jgen.writeStringField("EntityType", _entity.getType().toString());

jgen.writeStringField("Modifiers", Integer.toString(_entity.getModifiers()));
jgen.writeObjectFieldStart("SourceCodeRange");
jgen.writeStringField("Start", Integer.toString(_entity.getSourceRange().getStart()));
Expand Down
74 changes: 36 additions & 38 deletions rest-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.22.RELEASE</version>
<relativePath/>
<version>2.5.1</version>
<relativePath />
</parent>

<groupId>org.eclipse.steady</groupId>
Expand Down Expand Up @@ -111,19 +111,9 @@
<maven.install.skip>${skip.install.deploy}</maven.install.skip>
<maven.deploy.skip>${skip.install.deploy}</maven.deploy.skip>

<!-- Fix vulnerable dependencies in spring-boot-dependencies -->
<commons-beanutils.version>1.9.4</commons-beanutils.version><!-- from 1.9.3 -->
<hibernate.version>5.4.25.Final</hibernate.version><!-- from 5.0.12.Final, which includes vulnerable dom4j 1.6.1 -->
<jackson.version>2.9.10.20210106</jackson.version><!-- from 2.8.11.20181123 -->
<logback.version>1.2.3</logback.version><!-- from 1.1.11 -->
<log4j2.version>2.13.3</log4j2.version><!-- from 2.7 -->
<snakeyaml.version>1.26</snakeyaml.version><!-- from 1.17 -->
<spring.version>4.3.29.RELEASE</spring.version><!-- from 4.3.25.RELEASE -->
<tomcat.version>8.5.63</tomcat.version><!-- from 8.5.43 -->
</properties>

<dependencies>

<dependency>
<groupId>org.eclipse.steady</groupId>
<artifactId>shared</artifactId>
Expand Down Expand Up @@ -168,31 +158,14 @@
<artifactId>json-path</artifactId>
<version>2.4.0</version>
</dependency>

<!-- Swagger core dependencies -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.22</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-core</artifactId>
<version>1.5.22</version>
</dependency>

<!-- SpringFox dependencies -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>

<!-- Swagger dependencies -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>

<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.2.32</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
Expand All @@ -204,6 +177,12 @@
<artifactId>javax.activation-api</artifactId>
<version>1.2.0</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>28.2-jre</version>
</dependency>

<!-- Test dependencies -->
<dependency>
Expand All @@ -218,6 +197,25 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-mock</artifactId>
<version>2.0.8</version>
<scope>test</scope>
</dependency>
<!-- to allow tests written with JUnit 4 to be run by JUnit 5, see https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.4-Release-Notes#junit-5s-vintage-engine-removed-from-spring-boot-starter-test -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>


<!-- Used to mock REST services -->
<dependency>
Expand All @@ -237,9 +235,9 @@
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>5.0.7</version>
<version>6.5.7</version> <!-- overriding managed version 7.7.3 to avoid 1 migration checksum mismatch -->
</dependency>

<!-- To prevent javadoc error "class file for javax.interceptor.InterceptorBinding not found" -->
<dependency>
<groupId>javax.interceptor</groupId>
Expand Down
19 changes: 10 additions & 9 deletions rest-backend/src/main/java/org/eclipse/steady/backend/model/Dependency.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public class Dependency implements Serializable {
@Column(columnDefinition = "text")
private String path;

@Column(columnDefinition = "text")
@Column(length = 1024)
private String relativePath;

@ManyToMany(
Expand All @@ -134,22 +134,23 @@ public class Dependency implements Serializable {
private Set<TouchPoint> touchPoints;

/**
* Only set when single dependencies are returned by {@link ApplicationController#getDependency(String, String, String, String)}.
* TODO: Maybe check if they can always bet set (depending on performance and memory).
* Only set when single dependencies are returned by {@link
* ApplicationController#getDependency(String, String, String, String)}. TODO: Maybe check if they
* can always bet set (depending on performance and memory).
*/
@Transient private Collection<Trace> traces;

/**
* Contains collections of reachable dependency constructs per {@link ConstructType}.
* It MUST be a subset of what can be obtained from the library via {@link Library#countConstructTypes()}.
* Contains collections of reachable dependency constructs per {@link ConstructType}. It MUST be a
* subset of what can be obtained from the library via {@link Library#countConstructTypes()}.
*/
@Transient private ConstructIdFilter reachableFilter = null;

/**
* Contains collections of traced dependency constructs per {@link ConstructType}.
* It MUST be a subset of what can be obtained from the library via {@link Library#countConstructTypes()}.
* Depending on the quality of the reachability analysis, it SHOULD be a subset of what can be obtained
* via {@link Dependency#countReachableConstructTypes()}.
* Contains collections of traced dependency constructs per {@link ConstructType}. It MUST be a
* subset of what can be obtained from the library via {@link Library#countConstructTypes()}.
* Depending on the quality of the reachability analysis, it SHOULD be a subset of what can be
* obtained via {@link Dependency#countReachableConstructTypes()}.
*/
@Transient private ConstructIdFilter tracedFilter = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ public interface ApplicationRepository
/** Constant <code>FILTER</code> */
public static final ResultSetFilter<Application> FILTER = new ResultSetFilter<Application>();

/**
* <p>findById.</p>
*
* @param id a {@link java.lang.Long} object.
* @return a {@link java.util.List} object.
*/
List<Application> findById(@Param("id") Long id);

/**
* <p>findByGA.</p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,12 +541,11 @@ public TreeSet<VulnerableDependency> findAppVulnerableDependencies(

for (Object[] e : bundledDigests) {
Dependency depWithBundledLibId =
DependencyRepository.FILTER.findOne(
this.depRepository.findById(((BigInteger) e[0]).longValue()));
this.depRepository.findById(((BigInteger) e[0]).longValue()).orElse(null);

Library bundledDigest =
LibraryRepository.FILTER.findOne(
this.libRepository.findById(((BigInteger) e[1]).longValue()));
this.libRepository.findById(((BigInteger) e[1]).longValue()).orElse(null);

List<Bug> vulns_cc = this.bugRepository.findByLibrary(bundledDigest);

for (Bug b : vulns_cc) {
Expand All @@ -570,12 +569,10 @@ public TreeSet<VulnerableDependency> findAppVulnerableDependencies(
for (Object[] e : bundledLibIds) {

Dependency depWithBundledLibId =
DependencyRepository.FILTER.findOne(
this.depRepository.findById(((BigInteger) e[0]).longValue()));
this.depRepository.findById(((BigInteger) e[0]).longValue()).orElse(null);

LibraryId bundledLibId =
LibraryIdRepository.FILTER.findOne(
this.libIdRepository.findById(((BigInteger) e[1]).longValue()));
this.libIdRepository.findById(((BigInteger) e[1]).longValue()).orElse(null);

List<Bug> vulns_av_true = this.bugRepository.findByLibId(bundledLibId, true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ public interface BugRepository extends CrudRepository<Bug, Long>, BugRepositoryC
/** Constant <code>FILTER</code> */
public static final ResultSetFilter<Bug> FILTER = new ResultSetFilter<Bug>();

/**
* <p>findById.</p>
*
* @param id a {@link java.lang.Long} object.
* @return a {@link java.util.List} object.
*/
@Query("SELECT b FROM Bug b JOIN FETCH b.constructChanges WHERE b.id=:id")
List<Bug> findById(@Param("id") Long id);

/**
* <p>findByBugId.</p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,6 @@ public interface DependencyRepository
/** Constant <code>FILTER</code> */
public static final ResultSetFilter<Dependency> FILTER = new ResultSetFilter<Dependency>();

/**
* <p>findById.</p>
*
* @param id a {@link java.lang.Long} object.
* @return a {@link java.util.List} object.
*/
@Query("SELECT dep FROM Dependency dep JOIN FETCH dep.lib l WHERE dep.id = :id")
List<Dependency> findById(@Param("id") Long id);

/**
* <p>findByDigest.</p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public GoalExecution findLatestGoalExecution(Application _app, GoalType _type) {
Long id = null;
if (_type != null) id = this.gexeRepository.findLatestForApp(_app.getId(), _type.toString());
else id = this.gexeRepository.findLatestForApp(_app.getId());
if (id != null) return this.gexeRepository.findOne(id);
if (id != null) return this.gexeRepository.findById(id).orElse(null);
else return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ public interface LibraryIdRepository extends CrudRepository<LibraryId, Long> {
/** Constant <code>FILTER</code> */
public static final ResultSetFilter<LibraryId> FILTER = new ResultSetFilter<LibraryId>();

@Query("SELECT l FROM LibraryId l WHERE l.id=:id")
serenaponta marked this conversation as resolved.
Show resolved Hide resolved
List<LibraryId> findById(@Param("id") Long id);

/**
* <p>findBySecondaryKey.</p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,6 @@ public interface LibraryRepository extends CrudRepository<Library, Long>, Librar
/** Constant <code>FILTER</code> */
public static final ResultSetFilter<Library> FILTER = new ResultSetFilter<Library>();

/**
* <p>findById.</p>
*
* @param id a {@link java.lang.Long} object.
* @return a {@link java.util.List} object.
*/
@Query("SELECT l FROM Library l LEFT OUTER JOIN FETCH l.libraryId WHERE l.id=:id")
List<Library> findById(@Param("id") Long id);

/**
* <p>findByDigest.</p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ public interface SpaceRepository extends CrudRepository<Space, Long>, SpaceRepos
/** Constant <code>FILTER</code> */
public static final ResultSetFilter<Space> FILTER = new ResultSetFilter<Space>();

/**
* <p>findById.</p>
*
* @param id a {@link java.lang.Long} object.
* @return a {@link java.util.List} object.
*/
List<Space> findById(@Param("id") Long id);

/**
* All spaces of the given {@link Tenant}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ public interface TenantRepository extends CrudRepository<Tenant, Long>, TenantRe
/** Constant <code>FILTER</code> */
public static final ResultSetFilter<Tenant> FILTER = new ResultSetFilter<Tenant>();

/**
* <p>findById.</p>
*
* @param id a {@link java.lang.Long} object.
* @return a {@link java.util.List} object.
*/
List<Tenant> findById(@Param("id") Long id);

/**
* <p>findBySecondaryKey.</p>
*
Expand Down
Loading