Skip to content

Commit

Permalink
Made java-goof top level module. Moved all the todolist stuff into a …
Browse files Browse the repository at this point in the history
…todolist-goof module.
dogeared committed Dec 15, 2021
1 parent eff37ca commit 6ce14a5
Showing 290 changed files with 2,538 additions and 82 deletions.
87 changes: 5 additions & 82 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -3,99 +3,22 @@
<modelVersion>4.0.0</modelVersion>

<groupId>io.github.snyk</groupId>
<artifactId>todolist-mvc</artifactId>
<artifactId>java-goof</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Todolist MVC parent module</name>
<description>A vulnerable demo application, initially based on Ben Hassine's TodoMVC.</description>
<url>https://github.com/snyk/java-goof</url>

<properties>
<spring.version>3.2.6.RELEASE</spring.version>
<hibernate.version>4.3.7.Final</hibernate.version>
<tapestry.version>5.3.8</tapestry.version>
<struts2.version>2.3.20</struts2.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<name>Java Goof</name>
<description>A collection of vulnerable Java apps</description>
<url>https://github.com/snyk-labs/java-goof</url>

<modules>
<module>todolist-core</module>
<module>todolist-web-common</module>
<module>todolist-web-struts</module>
<module>todolist-goof</module>
</modules>
<packaging>pom</packaging>

<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>

<licenses>
<license>
<name>MIT License</name>
<url>http://opensource.org/licenses/mit-license.php</url>
</license>
</licenses>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<verbose>true</verbose>
<source>1.7</source>
<target>1.7</target>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.3</version>
<configuration>
<warName>todolist</warName>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<warFile>target/todolist.war</warFile>
<path>/</path>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

</project>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
107 changes: 107 additions & 0 deletions todolist-goof/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>java-goof</artifactId>
<groupId>io.github.snyk</groupId>
<version>1.0-SNAPSHOT</version>
</parent>

<groupId>io.github.snyk</groupId>
<artifactId>todolist-mvc</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Todolist MVC parent module</name>
<description>A vulnerable demo application, initially based on Ben Hassine's TodoMVC.</description>
<url>https://github.com/snyk/java-goof</url>

<properties>
<spring.version>3.2.6.RELEASE</spring.version>
<hibernate.version>4.3.7.Final</hibernate.version>
<tapestry.version>5.3.8</tapestry.version>
<struts2.version>2.3.20</struts2.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<modules>
<module>todolist-core</module>
<module>todolist-web-common</module>
<module>todolist-web-struts</module>
</modules>
<packaging>pom</packaging>

<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>

<licenses>
<license>
<name>MIT License</name>
<url>http://opensource.org/licenses/mit-license.php</url>
</license>
</licenses>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<verbose>true</verbose>
<source>1.7</source>
<target>1.7</target>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.3</version>
<configuration>
<warName>todolist</warName>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<warFile>target/todolist.war</warFile>
<path>/</path>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

</project>
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>

<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">

<persistence-unit name="todolist_pu" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.connection.url" value="jdbc:hsqldb:mem:todolist"/>
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value=""/>
</properties>
</persistence-unit>
</persistence>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">

<import resource="infrastructure-context.xml"/>

<!-- ========================== -->
<!-- Business configuration -->
<!-- ========================== -->

<bean id="userRepository" class="io.github.todolist.core.repository.impl.UserRepositoryImpl"/>
<bean id="todoRepository" class="io.github.todolist.core.repository.impl.TodoRepositoryImpl"/>

<bean id="userService" class="io.github.todolist.core.service.impl.UserServiceImpl"/>
<bean id="todoService" class="io.github.todolist.core.service.impl.TodoServiceImpl"/>

</beans>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">

<context:property-placeholder location="classpath:config/*.properties"/>

<context:annotation-config/>

<!-- ======================================== -->
<!-- embedded database configuration -->
<!-- ======================================== -->

<bean id="todolistDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="${db.driver}"/>
<property name="jdbcUrl" value="${db.url}"/>
<property name="user" value="${db.username}"/>
<property name="password" value="${db.password}"/>
</bean>

<jdbc:initialize-database data-source="todolistDataSource">
<jdbc:script location="classpath:config/schema.sql"/>
<jdbc:script location="classpath:config/data.sql"/>
</jdbc:initialize-database>

<bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory">
<property name="persistenceUnitName" value="todolist_pu"/>
<property name="dataSource" ref="todolistDataSource"/>
</bean>

<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
<property name="dataSource" ref="todolistDataSource"/>
</bean>

<tx:annotation-driven/>

<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />

</beans>
16 changes: 16 additions & 0 deletions todolist-goof/todolist-core/target/classes/config/data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--users
INSERT INTO user VALUES (1,'Foo','[email protected]', 'foobar');
INSERT INTO user VALUES (2,'Bar','[email protected]', 'barfoo');

--todos

INSERT INTO todo VALUES (1,1,'Prepare birthday party', true, 1,'2014-05-25');
INSERT INTO todo VALUES (2,1,'Wash the car', true, 1,'2014-02-02');
INSERT INTO todo VALUES (3,1,'Take out the trash', false, 2,'2014-10-11');
INSERT INTO todo VALUES (4,1,'Buy a gift for mom', true, 2,'2014-07-25');
INSERT INTO todo VALUES (5,1,'Remember the milk', false, 0,'2014-08-12');
INSERT INTO todo VALUES (6,1,'Prepare for interview', true, 0,'2014-08-12');
INSERT INTO todo VALUES (7,1,'Email David about project', true, 2,'2014-10-10');
INSERT INTO todo VALUES (8,1,'Feed the dog', false, 0,'2014-12-12');
INSERT INTO todo VALUES (9,1,'Change password', false, 1,'2014-04-30');
INSERT INTO todo VALUES (10,1,'Send weekly reports', false, 2,'2014-08-22');
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#HSQL in-memory db
db.driver=org.hsqldb.jdbcDriver
db.url=jdbc:hsqldb:mem:todolist
db.username=sa
db.password=
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
hibernate.dialect=org.hibernate.dialect.HSQLDialect
hibernate.show_sql=false
hibernate.format_sql=false
hibernate.use_sql_comments=true
19 changes: 19 additions & 0 deletions todolist-goof/todolist-core/target/classes/config/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CREATE TABLE user (
id int IDENTITY NOT NULL PRIMARY KEY,
name varchar(32) DEFAULT NULL,
email varchar(32) NOT NULL,
password varchar(32) DEFAULT NULL
);

ALTER TABLE user ADD CONSTRAINT unique_email UNIQUE (email);

CREATE TABLE todo (
id int IDENTITY NOT NULL PRIMARY KEY,
userId int NOT NULL,
title varchar(512) DEFAULT NULL,
done boolean DEFAULT FALSE NOT NULL,
priority tinyint NOT NULL,
dueDate date DEFAULT NULL
);

alter table todo add constraint user_fk foreign key (userId) references user(id);
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 7 additions & 0 deletions todolist-goof/todolist-core/target/classes/log4j.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
log4j.rootLogger=error, stderr

#log messages to stderr
log4j.appender.stderr=org.apache.log4j.ConsoleAppender
log4j.appender.stderr.Target=System.err
log4j.appender.stderr.layout=org.apache.log4j.PatternLayout
log4j.appender.stderr.layout.ConversionPattern= %d{dd/MM/yyyy HH:mm:ss} [%-5p] %c:%L - %m%n
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#Generated by Maven
#Tue Dec 14 22:38:34 EST 2021
version=1.0-SNAPSHOT
groupId=io.github.snyk
artifactId=todolist-core
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
io/github/todolist/core/Statics.class
io/github/todolist/core/domain/User.class
io/github/todolist/core/repository/api/TodoRepository.class
io/github/todolist/core/service/api/TodoService.class
io/github/todolist/core/domain/Priority.class
io/github/todolist/core/repository/api/UserRepository.class
io/github/todolist/core/service/impl/UserServiceImpl.class
io/github/todolist/core/service/api/UserService.class
io/github/todolist/core/repository/impl/UserRepositoryImpl.class
io/github/todolist/core/repository/impl/TodoRepositoryImpl.class
io/github/todolist/core/service/impl/TodoServiceImpl.class
io/github/todolist/core/domain/Todo.class
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/Users/micahsilverman/Projects/snyk/goofs/java-goof/todolist-goof/todolist-core/src/main/java/io/github/todolist/core/service/api/UserService.java
/Users/micahsilverman/Projects/snyk/goofs/java-goof/todolist-goof/todolist-core/src/main/java/io/github/todolist/core/repository/impl/TodoRepositoryImpl.java
/Users/micahsilverman/Projects/snyk/goofs/java-goof/todolist-goof/todolist-core/src/main/java/io/github/todolist/core/service/impl/UserServiceImpl.java
/Users/micahsilverman/Projects/snyk/goofs/java-goof/todolist-goof/todolist-core/src/main/java/io/github/todolist/core/repository/impl/UserRepositoryImpl.java
/Users/micahsilverman/Projects/snyk/goofs/java-goof/todolist-goof/todolist-core/src/main/java/io/github/todolist/core/service/impl/TodoServiceImpl.java
/Users/micahsilverman/Projects/snyk/goofs/java-goof/todolist-goof/todolist-core/src/main/java/io/github/todolist/core/domain/Todo.java
/Users/micahsilverman/Projects/snyk/goofs/java-goof/todolist-goof/todolist-core/src/main/java/io/github/todolist/core/repository/api/TodoRepository.java
/Users/micahsilverman/Projects/snyk/goofs/java-goof/todolist-goof/todolist-core/src/main/java/io/github/todolist/core/service/api/TodoService.java
/Users/micahsilverman/Projects/snyk/goofs/java-goof/todolist-goof/todolist-core/src/main/java/io/github/todolist/core/domain/Priority.java
/Users/micahsilverman/Projects/snyk/goofs/java-goof/todolist-goof/todolist-core/src/main/java/io/github/todolist/core/repository/api/UserRepository.java
/Users/micahsilverman/Projects/snyk/goofs/java-goof/todolist-goof/todolist-core/src/main/java/io/github/todolist/core/Statics.java
/Users/micahsilverman/Projects/snyk/goofs/java-goof/todolist-goof/todolist-core/src/main/java/io/github/todolist/core/domain/User.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
io/github/todolist/core/TodoServiceTest.class
io/github/todolist/core/UserServiceTest.class
Loading

0 comments on commit 6ce14a5

Please sign in to comment.