CogniGuard

CogniGuard

CogniGuard is a powerful web extension designed to empower users by identifying and combatting dark patterns on various websites, particularly focusing on E-commerce platforms.

CogniGuard

CogniGuard

CogniGuard is a powerful web extension designed to empower users by identifying and combatting dark patterns on various websites, particularly focusing on E-commerce platforms.

The problem CogniGuard solves

About Dark Patterns :

A dark pattern is "a user interface that has been carefully crafted to trick users into doing things, such as buying overpriced insurance with their purchase or signing up for recurring bills"

Solution

The Web Extension can be used to find dark patterns with their categories which communicates to the Backend API using JWT Tokens. A working sample is shown in the photo.

Steps to Use

  • visit our website URL (https://cogniguard.onionreads.com/)
  • Register with email and verify your email address .
  • Generate your jwt token from dashboard.
  • Enter the token in Web Extenion and click on Analyze
  • You'll get the result after analysis.

Backend API

This solution uses Django REST framework for backend API which is connected to a fine tuned deep learning BERT model hosted on huggingface hub spaces which can be accessed via Gradio API and then results are stored in PostgreSQL database.

Analysis

Detection processes are handled by celery and Reddis server which acts as a message broker to respond users about task completion status.
The URL is sent by web extension which is then crawled using BeautifulSoup4 library and then paragraphs are converted into text sentences using python regular expressions (re) library.
Then sentences are passed to our Deep Learning Model for multiclass classification

Additional Features

1 Report Dark Patterns through dedicated page which can be used for Model Training purposes.
2 Detected DP page - Contains list of all dark patterns found across various sites.

Sponsorship

Currently, we are working under limited Free Resources. As you know working on Deep Learning models require GPU, support our project by sponsoring and Give a Star on Github Repo.

Challenges I ran into

1 Integration ChallengeWeb Extension with the DRF API through secured connection was quite challenging for me, I have gone through multiple youtube videos, articles, took AI help and finally found a way using JWT tokens. Then worked on it setup and finally added a layer of security.
2 Deploy Challenge : It was big challenge because we have a powerful backend, First tried using Vercel and Render but due to it's limited sizes and compute memory of 512 mb, our setup didn't worked.
Then Finally decided to deploy it on AWS EC2 using Gunicorn WSGI server and NGINX for reverse proxy and serving static files for the web app.
3 BERT Deploy Challenge : BERT is a LLM made by Google, its size is around 500mb which requires GPU or powerful CPU to work, Our Free Teir AWS was not capable to run it. So I decided to to deploy on huggingface spaces using Gradio web app which can be accessed via API call.
HF spaces provide free teir CPU v2 with 16gb RAM. Not enough for Deep learning models to work properly but can handle the compute.

4 Dependency Issue : This issue is yet to be solved, getting an incompatibility issue in python 3.12.3 (On VPS server) with pyJWT and djangorestframework-simplejwt library which is results in ERROR in token generation.
But same is working fine with python3.12.0 on my local PC.

5 Dataset Challenge : Currently there is only limited datasets available for dark pattern detection which is not enough for Fine Tuning Deep Learning Models, So worked on building custom dataset after going through websites and social pages like @assholedesign @deceptivedesigns and multiple Research Papers to build a thorough understanding of the solution.

Discussion