Giter Site home page Giter Site logo

dschadow / javasecurity Goto Github PK

View Code? Open in Web Editor NEW
231.0 13.0 114.0 2.45 MB

Java web and command line applications demonstrating various security topics

Home Page: https://blog.dominikschadow.de

License: Apache License 2.0

Java 90.22% HTML 9.33% CSS 0.44% JavaScript 0.01%
java-security java java-web spring-security google-tink csrf xss csp spring-boot cryptography

javasecurity's Introduction

Java Security

This repository contains several Java web applications and command line applications covering different security topics. Have a look at my slides and publications covering most applications in this repository.

Requirements

  • Java 21
  • Maven 3
  • Mozilla Firefox (recommended, some demos might not be fully working in other browsers)
  • Docker (required for running the sample applications as Docker containers)

Web Applications in Detail

Some web applications contain exercises, some are only there to inspect and learn. Instructions are provided in detail on the start page of each web application.

Some web applications are based on Spring Boot and can be started via the main method in the Application class or via mvn spring-boot:run in the project directory. Spring Boot projects can be launched via docker run -p 8080:8080 dschadow/[PROJECT] after the image has been created using mvn spring-boot:build-image. The other web applications either contain an embedded Tomcat7 Maven plugin which can be started via mvn tomcat7:run-war, or an embedded Jetty Maven plugin which can be started via mvn jetty:run-war.

access-control-spring-security

Access control demo project utilizing Spring Security in a Spring Boot application. Shows how to safely load user data from a database without using potentially faked frontend values. After launching, open the web application in your browser at http://localhost:8080.

csp-spring-security

Spring Boot based web application using a Content Security Policy (CSP) header. After launching, open the web application in your browser at http://localhost:8080.

csrf-spring-security

Cross-Site Request Forgery (CSRF) demo project based on Spring Boot preventing CSRF in a web application by utilizing Spring Security. After launching, open the web application in your browser at http://localhost:8080.

csrf

Cross-Site Request Forgery (CSRF) demo project preventing CSRF in a JavaServer Pages (JSP) web application by utilizing the Enterprise Security API (ESAPI). After launching, open the web application in your browser at http://localhost:8080/csrf.

direct-object-references

Direct object references (and indirect object references) demo project using Spring Boot and utilizing the Enterprise Security API (ESAPI). After launching, open the web application in your browser at http://localhost:8080.

intercept-me

Spring Boot based web application to experiment with OWASP ZAP as intercepting proxy. Target is to receive SUCCESS from the backend. After launching, open the web application in your browser at http://localhost:8080.

security-header

Security response header demo project which applies X-Content-Type-Options, Cache-Control, X-Frame-Options, HTTP Strict Transport Security (HSTS), X-XSS-Protection and Content Security Policy (CSP) (Level 1 and 2) headers to HTTP responses. After launching, open the web application in your browser at http://localhost:8080/security-header or https://localhost:8443/security-header.

security-logging

Spring Boot based web application utilizing the OWASP Security Logging Project. Demonstrates how to log security relevant incidents in a log file. After launching, open the web application in your browser at http://localhost:8080.

session-handling-spring-security

Session handling demo project based on Spring Boot utilizing Spring Security and jasypt-spring-boot to secure Spring configuration (property) files. Shows how to restrict access to resources (URLs), how to apply method level security and how to securely store and verify passwords. Uses Spring Security for all security related functionality. Requires a system property (or environment variable or command line argument) named jasypt.encryptor.password with the value session-handling-spring-security present on startup. After launching, open the web application in your browser at http://localhost:8080.

session-handling

Session handling demo project using plain Java. Uses plain Java to create and update the session id after logging in. Requires a web server with Servlet 3.1 support. After launching, open the web application in your browser at http://localhost:8080/session-handling.

sql-injection

Spring Boot based web application to experiment with normal (vulnerable) statements, statements with escaped input, and prepared statements. After launching, open the web application in your browser at http://localhost:8080.

xss

Cross-Site Scripting (XSS) demo project preventing XSS in a JavaServer Pages (JSP) web application by utilizing input validation, output escaping with OWASP Java Encoder and the Content Security Policy (CSP). After launching, open the web application in your browser at http://localhost:8080/xss.

Command Line Applications in Detail

The following projects demonstrate crypto usage in Java with different libraries. Each project contains one or more JUnit test classes to test various functionalities of the demo project.

crypto-hash

Crypto demo using Java to hash passwords with different hashing algorithms.

crypto-java

Crypto demo using plain Java to encrypt and decrypt data with asymmetric (RSA) and symmetric (AES) algorithms as well as to sign and verify data (DSA).

crypto-shiro

Crypto demo using Apache Shiro to encrypt and decrypt data with symmetric (AES) algorithms as well as hash data (passwords).

crypto-tink

Crypto demo using Google Tink to encrypt and decrypt data with asymmetric and hybrid encryption, MAC and digital signatures. Depending on the demo, keys are either generated on the fly or stored/loaded from the keysets' directory. The AWS KMS samples (classes with AwsKms in their names) require a configured AWS KMS with an enabled master key.

Meta

Build codecov License

javasecurity's People

Contributors

dependabot[bot] avatar dschadow avatar github-actions[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.