Giter VIP home page Giter VIP logo

websafe's Introduction

WebSafe

An easy to understand implementation of the principle of Vaultwarden in a Python FastAPI + React JS application

A live version can be found here: https://gruppe4.testsites.info

If you want to learn about the client-side encryption, here are some resources on that:

Usage

To deploy this application yourself, take a look at the deploy folder. There are some docker-compose.yaml sample config files there. This should give you an idea about hosting the application.

Features

The functionality is pretty simple. You can

  • register new users
  • log in with existing users
  • add password entries to your safe
  • delete your account
  • change your account
  • delete your account using a email as confirmation (needs SMTP server)

If you set up a SMTP server, each new user will be greeted upon registration. They can delete their accounts with an email verification if they forget their password.

Developing

There is an example dev setup in the deploy folder of this repository. It starts a backend using websafe.localhost/api/v1 via Traefik as route. To start the frontend, just use npm install and npm start in the frontend folder. The backend can be started manually, too, if that is wanted. Use uvicorn for that in the backend folder:

uvicorn  app.api:app

websafe's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

websafe's Issues

Add verbose failing to encryption module

Passing wrong types to the public functions of encryption.js will not result in interruptions. Noisy failing will have to be added to make sure we are using the assumed types in further operations.

Use SRI for js file verification in browsers

Subresource Integrity should be used to prove authenticity of the provided JavaScript files in the frontend. With this, malicious scripts to steal user data can be recognised by their wrong signature. Only our correct files would be usable.

Create JWT authentication flow for API

A python implementation is needed to authenticate users of the API with JWTs. Should be put in 'auth' of 'app'.

Authentication should support:

  • Login
  • Logout
  • Changing of password or email

API endpoints could be:

  • /login
  • /logout
  • /user

Add loading of existing user data

As a user, I want to be able to view my existing passwords in the frontend. For that, we need to integrate the PoC with the backend API with API calls. /api/v1/safe should be used to get user data. The received data needs to be decrypted (encryptionModule.importSafe() outputs an Array of JSON objects) and then displayed in a readable manner to the user after they logged in.

Add ability to change CORS URI for deployment

Is your feature request related to a problem? Please describe.
I can't use HTTP methods to interact with the API because CORS blocks all origins except localhost.

Describe the solution you'd like
We need a solution to change the CORS acceptance on deployment and for dev environments.

Describe alternatives you've considered
There are not alternatives as we need to deploy to a domain.

Add ability to save locally edited user data to the backend

As a user, I want to be able to save my password because I always have a hard time remembering them. These have to be taken locally from the frontend. For that, we need to integrate the PoC with the backend API with API calls. /api/v1/safe should be used to save user data. The locally edited data needs to be encrypted (encryptionModule.exportSafe() takes an Array of JSON objects) and then sent to the backend.

Add registration functionality to frontend

As a user, I want to be able to register a new account in the frontend. For that, we need to integrate the PoC with the backend API with API calls. /api/v1/user/new should be used to create the user.

Add login functionality to frontend

As a user, I want to be able to log in to my account in the frontend. For that, we need to integrate the PoC with the backend API with API calls. /api/v1/token should be used to authenticate the user.

Frontend layout not working on non-desktop devices

As a user, I want to be able to access my passwords on any of my devices (e.g. my smartwatch, microwave or any other device that can run Doom 3D). As of right now, any device with a screen smaller than FHD, the layout looks like crap and is hardly usable for the average user.

We need to fix this and make the layout adaptable to smaller screensizes.

Make user accounts deletable with email verification

If a user has forgotten their password, they should be able to reset it by deleting their account and creating. Since deleting an account requires JWT auth via the API, we need to add email verification to delete accounts without password access.

Create encryption module for frontend

Web frontend needs an encryption module in JS based on Bitwarden authentication and encryption flow. WebCrypto API and Mozilla DOM examples should be used for this.

/safe/delete deletes safe and user

Redundant functionality of /safe/delete and /user/delete should be unified. Rather than deleting the safe, we could just overwrite it automatically on POST /safe and only delete it on user deletion. This should be enough, but I am open to other suggestions.

Implement DB in Python

The python backend should be able to interact with the DB (mongoDB)

Features needed:

  • Add user
  • Delete user
  • Change user data
  • Check Hashes for Login of user (works with authentication flow)
  • Store relevant safe file name for user

Delete user via mail does not work

Using DELETE to delete users with a string in the URL is not working from a browser, as the Browser defaults to a GET request. Changes in the backend necessary to handle this.

Implement File backend

  • verbose naming rules for saving files (Use hashed username)
  • create a space for saving files (folder, create if not existing)
  • Implement size restrictions for files (security) (?)
  • Files should be replaceable
  • Triggered on API call (POST/GET/DELETE) "/safe" (with headers) should interact with the local files
  • verbose error messages for malformed requests

Documentation requirements

Mention these points in the documentation of the project:

  • Usage of NoSQL
  • Impossible OAuth2.0 integration

New safe entries do not get posted (initReady not true)

While using the current v0.0.2-beta release, the user can't save any entries as they do not get POSTed to the API. The necessary initReady var does not get set to true upon loading the dashboard.

Browser log output concerning the bug:

Variablen: testdata@testdata testpassword login.js:79:14
response token login.js:96:16
Importing Data... (initReady: false) dashboard.js:164:12
Imported Data (initReady: false) dashboard.js:166:12

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.