Skip to content

hate-detection/boli-app

Repository files navigation

BOLI

Overview

BOLI is a Next.js app aimed towards the development of a frontend web-application for Machine Learning model inference.

This project is designed and developed as part of the Masters Thesis Submission for MSc Cyber Security from Royal Holloway, University of London.

BOLI provides two interfaces: /predict and /feedback. Users can utilise the /predict interface to access the Machine Learning model. Users can also provide feedback through the /feedback interface.

Installation

Note

You must have node.js installed on your system before proceeding with the below steps.

Steps:

  1. Clone the repo and change directory
git clone https://github.com/hate-detection/boli-app.git
cd boli-app
  1. Install dependencies with
npm install
  1. Run the server in development mode
npm run dev

Security Configuration

A major security configuration involves the Rotating Token Mechanism for the /api/predict and /api/feedback endpoints. Ideally, the /api/feedback endpoint can only be called after getting a successful response from /api/predict.

To implement this logic, the /api/predict endpoint sends a hashed value with a secret token, the text and the predicted values. The /api/feedback endpoint parses the incoming request for the hashed value and generates its own hash. If the incoming hash and the newly generated hash match, /api/feedback accepts the request. Moreover, one hashed value can only be used once.

The hash is computed using the following formula:

$$generateKey(length) = Secret_{token}$$ $$sha256(Secret_{token}\ +\ text\ +\ prediction) = Secret_{key}$$

Here, $generateKey(length)$ is the function which generates a random 32-byte value every 30 minutes. The $Secret_{key}$ is the final hashed value computed with:

  1. $Secret_{token}$ (generated in the previous function)
  2. $text$ (entered by users)
  3. $prediction$ (generated by the ML Model)

Contributions

This app is currently not accepting contributions. However, you are free to fork and modify the app according to your use cases. If you find a problem or have a feature recommendation, create an issue.

About

Frontend web-application for Machine Learning Model.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published