Skip to content

The Secure Software Development project fortifies the Christmas Gift Shop app by employing static analysis tools, mitigating SQL injection, XSS, and CSRF vulnerabilities, implementing robust authorization, and integrating DevOps practices like exception handling, logging, and auditing to enhance security.

License

Notifications You must be signed in to change notification settings

jovan-vukic/secure-gift-shop-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Secure Gift Shop App

The project aims to enhance the security of the Christmas Gift Shop application. Tasks include utilizing static analysis tools for vulnerability assessment, addressing SQL injection and Cross-site Scripting vulnerabilities, implementing protection against Cross-site Request Forgery attacks, establishing some role-based authorization mechanisms, and integrating DevOps practices such as exception handling, logging, and auditing. Through these measures, the project seeks to fortify the application against potential security threats while promoting best practices in software security and development.
Explore the project »

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Installation
  3. Contributing
  4. License
  5. Contact
  6. Acknowledgments

About The Project

The project focuses on enhancing the security aspects of the Christmas Gift Shop application, which facilitates gift browsing, rating, and purchasing functionalities. The application allows users to view, search, add, and review gifts, as well as manage user profiles.

Application user interface

Login page

Login page

View and search gifts

View and search gifts

Page to add a new gift

Add new gift

Details about a gift as well as comments and rating

Details about a gift as well as comments and rating

Users overview

Users overview

Details about a user

Details about a user

Static Code Analysis

The first part of the projects requires us to utilize SonarQube, a static analysis tool, to generate a comprehensive report identifying vulnerabilities and security hotspots within the project codebase. The report is attached to the project.

SQL Injection and Cross-site Scripting (XSS)

The second part of the project requires us to investigate potential XSS and SQL injection vulnerabilities in the comment form of the Gift Details page. We need to mitigate these vulnerabilities and document attack and defense strategies.

SQLi and XSS attacks demonstration

Entering malicious query in the gift comment section

Entering malicious query

As a result, a new user has been added into the database, with one of the attributes being an XSS script.

Entering malicious query

The XSS script is triggered during user search.

Entering malicious query
SQLi and XSS attacks mitigation

Mitigating attacks involves employing a parameterized query (PreparedStatement) within the CommentRepository class, alongside sanitizing input fields for comments through the introduction of the th:text attribute. Additionally, utilizing textContent instead of innerHTML in relevant sections of the persons.html page is crucial to prevent XSS attacks.

Cross-site Request Forgery (CSRF)

It is required next to demonstrate a CSRF attack by altering personal data of a user through a crafted script. Then we have to implement CSRF protection using tokens and document both the attack and defense mechanisms.

CSRF attack demonstration

Launching the attacker server on port 3000 ('npm start' command in the 'csrf-exploit' folder)

Starting the attacker server

Clicking on the trophy image triggers a CSRF attack, resulting in a successful HTTP request

Clicking on the trophy image

User with id equal to 1 has modified values for the 'First Name' and 'Last Name' attributes as a result of the successful attack

Attack success
CSRF attack mitigation

It is necessary to implement a mechanism for generating a CSRF token at the session level and embedding it into User Details HTML page, thereby rejecting unauthorized HTTP requests from the attacker server as they lack the required token.

Implementation of Authorization

The project requires us to implement permission matrix as defined in the permissions/roles table (in the project specification). Then we have to assign roles to users accordingly and ensure proper database configurations.

Creating new roles and associating them with specific users, as well as introducing new permissions, is done in the 'data.sql' file, where the corresponding relationships are inserted into the appropriate tables.

Subsequently, individual permissions are resolved on the frontend by hiding corresponding UI elements for users without permission, or on the backend through appropriate annotations and logical checks during the execution of relevant endpoints.

DevOps

It is required to implement exception handling and logging mechanisms throughout the application, focusing on the relevance and categorization of log messages. Then it is necessary to Introduce auditing functionalities to track user actions and ensure the non-repudiation of user actions.

Exception handling is resolved by creating catch branches at appropriate locations, where logging and auditing are performed depending on the operation that triggers the respective exception. Logging and auditing are also carried out in other relevant parts of the code.

(back to top)

Installation

To get a local copy up and running follow these simple steps. Setup:

  1. Clone the repository:
    git clone https://github.com/jovan-vukic/secure-gift-shop-app.git
  2. Build and run the program using your preferred IDE.

(back to top)

Contributing

Contributions are what makes the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Contact

Jovan - @jovan-vukic

Project Link: https://github.com/jovan-vukic/secure-gift-shop-app

(back to top)

Acknowledgments

This project was done as part of the course 'Secure Software Development' (13M111RBS) at the University of Belgrade, Faculty of Electrical Engineering.

Used resources:

(back to top)

About

The Secure Software Development project fortifies the Christmas Gift Shop app by employing static analysis tools, mitigating SQL injection, XSS, and CSRF vulnerabilities, implementing robust authorization, and integrating DevOps practices like exception handling, logging, and auditing to enhance security.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published