Skip to content

Repository files navigation

NutriPolicy icon

An AI-powered Chrome extension that analyzes privacy policies in real-time — giving you a risk score (A–F) and color-coded Privacy Nutrition Labels before you hand over your data. Now powered by Google Gemini.

Built as part of Clemson University CPSC4180 (Human-Centered Computing).


Features (v0.1 — Checkpoint 1)

Feature Status
Auto-detects privacy policy pages icon
Risk Score (A–F) with sub-factor breakdown icon
Privacy Nutrition Labels (8 practices, color-coded) icon
Manual trigger via popup icon
Secure API key storage (Chrome storage, not hardcoded) icon
Hover tooltips with per-label detail icon
Automated summaries (5 categories) Checkpoint 2
Interactive Q&A Checkpoint 2
Clause highlighting Checkpoint 2

Project Structure

privacy-shield-extension/
├── manifest.json       # Chrome Extension Manifest V3
├── background.js       # Service worker — Gemini API calls, key storage
├── content.js          # Injected into pages — detects policies, injects sidebar
├── popup.html          # Extension popup — API key entry + manual trigger
├── popup.js            # Popup logic
├── sidebar.html        # Sidebar UI (loaded as iframe)
├── sidebar.css         # Sidebar styles
├── sidebar.js          # Sidebar logic — renders results
├── icons/              # Extension icons (see setup below)
└── README.md

Setup & Installation

1. Prerequisites

  • Google Chrome (or any Chromium-based browser)
  • A Google Gemini API key — uses gemini-2.0-flash (free, no credit card required)

2. Get the code

git clone https://github.com/YOUR_USERNAME/privacy-shield-extension.git
cd privacy-shield-extension

3. Add icons

The extension needs three icon sizes. You can use any placeholder PNGs to start:

# Quick option: generate placeholder icons with ImageMagick (if installed)
convert -size 16x16  xc:#3dd68c icons/icon16.png
convert -size 48x48  xc:#3dd68c icons/icon48.png
convert -size 128x128 xc:#3dd68c icons/icon128.png

Or just drop any three PNG files named icon16.png, icon48.png, icon128.png into the icons/ folder.

4. Load in Chrome

  1. Open Chrome and go to chrome://extensions
  2. Enable Developer mode (toggle in top-right)
  3. Click "Load unpacked"
  4. Select the privacy-shield-extension/ folder
  5. The PrivacyShield icon (icon) will appear in your Chrome toolbar

5. Add your Gemini API key

  1. Click the NutriPolicy icon (icon) in the toolbar
  2. Paste your AIza... Gemini API key
  3. Click Save

Usage

Auto-detect (recommended for testing)

Navigate to any privacy policy page. The sidebar will appear automatically within ~1 second.

Good test URLs:

Manual trigger

Click the NutriPolicy icon (icon) → "Analyze This Page" to force analysis on any page.

Reading results

Risk Score (A–F)

Grade Meaning
A Strong user protections, minimal collection
B Mostly good, minor concerns
C Mixed — some concerning practices
D Several high-risk practices
F Aggressive collection, sells data, mandatory arbitration

Sub-factors: Each factor (Data Collection, 3rd-Party Sharing, Retention, User Control, Tracking, Arbitration) is rated Low / Medium / High.

Privacy Nutrition Labels: 8 standardized practices rated as:

  • icon Safe — user-friendly practice
  • Neutral — standard/unclear
  • Concern — warrants attention
  • High Risk — significant privacy concern

Hover over any label tile to see a plain-English explanation.


Architecture

[Page Content Script]
       │  detects privacy policy page
       │  extracts policy text
       ▼
[Sidebar iframe (sidebar.html)]
       │  sends ANALYZE_POLICY message
       ▼
[Background Service Worker (background.js)]
       │  retrieves stored API key
       │  calls OpenAI gpt-4o-mini
       │  parses JSON response
       ▼
[Sidebar renders results]

The API key is stored in chrome.storage.local — it never touches a server and is not logged anywhere. Policy text is sent to OpenAI's API (same as using ChatGPT).


Evaluation Plan (Checkpoint 2)

Per the research protocol, the following will be evaluated:

  • AI accuracy: Ground-truth annotations on 20–30 policies; ROUGE + BERTScore + expert Likert ratings
  • Risk scoring F1: Target ≥ 0.80 against human-labeled ground truth
  • Hallucination rate: Target < 5%
  • Usability: SUS with n=6 think-aloud sessions
  • Trust calibration: User confidence vs. actual accuracy plot

Known Limitations (v0.1)

  • Policy text is truncated to ~12,000 characters for API cost control
  • Some heavily JavaScript-rendered policy pages may not extract cleanly
  • Detection heuristics are keyword-based — may trigger on unrelated pages with "privacy" in the URL
  • No caching — each page visit triggers a new API call

Contributing

This is a research prototype. Issues and PRs welcome. Planned for open-source release post-publication.


Disclaimer

PrivacyShield provides AI-generated analysis for informational purposes only. It is not legal advice. Always consult the original policy and a qualified attorney for legal decisions.


License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages