Giter Site home page Giter Site logo

franklindyer / agora-app Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 1.0 2.79 MB

Simple and (hopefully) secure social media application. Also a project for spring 2024 CS 444 cybersecurity class at UNM.

Python 61.84% Dockerfile 0.49% HTML 27.90% CSS 5.96% JavaScript 3.80%

agora-app's Issues

Automated test suite

There should be a suite of automated tests to run on new versions of the site before pushing to deployment. This could be as simple as a shell script performing each possible essential API call to the site, though ideally we would get more advanced with this in the future.

Blocked by #97. This isn't feasible with captcha protection turned on.

Encoding is causing the length of bug reports with certain characters to be miscalculated

The hypothesis is that the character limit of the bug report is being calculated on the client side via unicode, and on the server side via ascii. This is causing an issue when sending a bug report of maximum length (currently 5,000 characters) if the report has any characters that are encoded more compactly on the frontend vs the backend.

For example, sending 5,000 characters "Moby Dick" (with some unicode characters) is allowed through the frontend but is rejected on the backend. However, sending 5,000 letter "a"s is allowed through both the frontend and the backend.

Users should be able to view their opinions

When visiting a post, a user should be able to see whether they currently like or dislike that post.

I think that this is currently missing support both on the backend and the frontend. That is, this info isn't being passed to the templates at all right now.

Email reset is broken

Email reset is broken because the form doesn't take into account the new password requirement.

I'm working on fixing this now, but this issue is for posterity.

Files of any type can be uploaded as "images"

This is done by specifying an image file extension in the uploaded file title (e.g., uploading my-script.js as my-script.png). The browser still processes this as the given file extension (e.g., .png), so it's not actually executing any code. However, the file is able to be hosted, which feels like a vulnerability.

We need more captchas

There should be more captchas to limit certain interactions like logging in, writing posts/comments, etc.

CSRF protection mechanisms

The site needs some defense mechanisms against CSRF. These include:

  • CSRF tokens linked to users' individual session cookies attached to all sensitive forms.
  • Referer-based blocking of malicious POST requests.
  • Configuration of content security policy.
  • Logging out should close all active sessions rather than just the one currently in use.
  • Require the user's current password before changing their email from the account page.
  • Use Same-Site: Strict for session cookies

There should be a rate limit on password resets

After a certain number of requested password reset emails, a person should have to put in their recovery code to get another email. This is to prevent DoS attacks on a user with a known email.

Sessions last forever

Session token expiration isn't implemented yet. This won't be hard to implement, so this issue will just serve as a reminder that it needs to get done before the end of the development phase.

Docker image runs as root

This is a bad practice! Need to figure out how to allow non-root user inside of the Docker image to still be able to access the contents of volumes.

Accessid confusion in user pfps

There is no reason for the pfp column of the users database table to refer to images by their imgid rather than their accessid. This just makes everything more confusing. The whole AgoraDatabaseManager and the database schema should be refactored so that pfp refers to images by their accessid instead. Some tweaks may also need to be made to templates.

New db connection opened for each command to AgoraDatabaseManager

AgoraDatabaseManager should not open a brand new connection for each command. A new connection for each thread (responding to a web request) would be reasonable. Alternatively, we could use a single connection (or a small finite fixed number of them) and use an async task queue.

Rate limiting for user actions is needed

To prevent users from writing their own bots to abuse the API, some sort of rate limiting needs to be implemented for actions that require users to be logged in. This could be as simple as keeping track of the user's last write action, and preventing any further write action that occurs before a (short) delay has passed.

Embedding images is not user-friendly

Users should not be required to copy the link in the address bar of one of their uploaded images to embed it in a post. There should be a shortcut for copying a relative link to your image (e.g. /userimg/abc123) to the clipboard, so that users can easily attach images to their posts.

XSS vulnerability in user posts

Python's markdown.markdown will not clean <script> elements from users' posts. Maybe we can use something like the bleach package to remediate this.

Post writing needs an overhaul

Some things I would like to change about the post writing page:

  • Create a more intuitive way to include images in a post.
  • Add something directly on the page that will guide users' usage of markdown - either a link to an existing guide, or something we have written.
  • Have a preview available that will let a user preview their post (in rendered markdown) before posting.
  • Add support that allows a user's post to be saved locally so that they will not lose anything in case they are logged out or refresh/leave the page before posting.
  • Tweak and/or remove some markdown processing, such as the stripping newline behavior.

Bug reports are broken

(Ironically)

Attempting to submit a bug report redirects to login, so it's not possible to actually submit a report.

Handling of deleted posts/users for forensic purposes

Right now, when a user deletes their account or deletes a post, the account/post is completely erased. This is inconvenient for triaging suspicious events by looking at the logs: logs refer to users/posts by their IDs, but the logs may refer to a user or post that no longer exists. Even worse, the log might refer to a deleted user by their ID, and a newer user might currently possess that ID, meaning that the log event might be misattributed.

Not sure yet how to fix this. Thoughts?

One idea is that we might not exactly "delete" users/posts, but rather "archive" them, so that they appear deleted to all other users but are still available for forensic purposes.

Decouple application from external services

The app should be decoupled from some of the external APIs upon which it relies, namely Mailgun and reCaptcha.

Ideally, the following things should be changed:

  • The AgoraEmailer should be made into an interface, of which the Mailgun emailer is only one implementation
  • Other emailers should be available, e.g. one that uses Gmail, or one that uses Discord or text messaging
  • It should be possible to run the application without using captchas at all
  • Captcha usage should be abstracted through an interface, so that services other than reCaptcha can be used
  • The database manager should support other SQL DBMSs

Following a `confirmemail` link has a confusing result

When not logged in, following a confirmemail link leads users to the login page. This is confusing behavior, and users should be notified that their email has been successfully confirmed rather than taken to /login.

Image loading is fucky

Images load slowly (with a significant flash of alt text), and sometimes don't load at all (and only show alt text).

Recovery tokens should be in-site, not in emails

Delivering recovery codes to users' inboxes in plaintext is a security weakness. Instead, a one time link should be delivered to users' inboxes, through which they can visit a page on the site that will show them their recovery code only once. After leaving that page, it is up to the user to have stored the recovery code in a safe place.

Status input box doesn't wrap

When a user is on their own profile, the info box to update their status does not wrap. It can be fixed by changing the input element to a textarea element, but that solution requires js. Therefore, I am keeping this as an open issue until I decide to go back and set up js for our various features that require it. In the meantime, this behavior works (it's just bad looking) and is clean.

Browse should have an algorithm

Right now, browsing users or posts just lists all the posts and users on the site. Really, we want to show the X latest posts, and possibly something similar for the users.

Frontend TODO list

  • Friends - friend request button; friend requests list; delete friends
  • Password recovery
  • Bug reporting page / contact us page
  • Account settings confirmation page (some page with a secondary confirmation before attempting to change email/password)
  • Liking and disliking posts buttons
  • Image uploading, linking, and viewing
  • Change profile pictures

Cosmetic / low importance:

  • Password verification check ("confirm your password" field)
  • Post and comment writing boxes that dynamically resize based on content

@franklindyer Please feel free to add a comment to this issue if you notice any additional TODO items that aren't listed here, and I'll add them.

Require captchas at least for account creation

As I work on the account creation login I'm realizing that it would be easy for a user to spam-create + verify accounts and block off a lot of usernames that way, e.g. using email aliasing to have a bunch of unique email addresses. It occurs to me that we should probably incorporate captchas into the site somehow, at the very least for account creation.

Account info modification form POSTs to wrong url

It looks like the form on the user account page by which one edits their account info is POSTing to the wrong path. In my server logs it's showing a POST request to /user/account, but I think it should just POST to /account. This results in a "method not allowed" message being displayed to the client when they press enter to save their usernames/status/whatever.

@altheaden

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.