diff --git a/README.md b/README.md index 37baadf..6b37606 100644 --- a/README.md +++ b/README.md @@ -9,18 +9,18 @@ A local-only Firefox extension that records your job applications, what you sent ## The three claims - **Local only.** All data stays on your machine. The extension makes no network requests. -- **Nothing reads a page until you click.** It has no content scripts. It reads the current tab only after you click the toolbar button or press Alt+Shift+S by default. The one thing that runs without a click is the local automatic backup check. -- **It never submits anything.** It does not fill forms, apply for jobs or send data anywhere. +- **Nothing reads or touches a page until you click.** It has no content scripts. It reads the current tab only after you click the toolbar button or press Alt+Shift+S by default, and it writes into a form only after you click Fill in the popup. The one thing that runs without a click is the local automatic backup check. +- **It fills only when you click, and never submits.** Fill writes your saved details into empty fields and nothing else. Countersign never clicks a button, presses a key or submits a form, and it sends no data anywhere. ## How the claims are enforced Each claim is checked by the gate (`npm run gate`), which CI also runs. -| Claim | How it is enforced | -| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Local only | [`guard/build.test.ts`](guard/build.test.ts) scans every built `.js` and `.html` file for network APIs (`fetch`, `XMLHttpRequest`, `WebSocket`, `EventSource`, `sendBeacon`, `WebTransport`, `RTCPeerConnection`), checks that no built page loads a remote `src` or `href`, and asserts the manifest has no host permissions. [`eslint.config.js`](eslint.config.js) bans the same APIs in source (`no-restricted-globals`, `no-restricted-properties`, `no-restricted-syntax`). The Content Security Policy in [`wxt.config.ts`](wxt.config.ts) sets `default-src 'self'; ... connect-src 'none'`. | -| Nothing reads a page until you click | [`guard/build.test.ts`](guard/build.test.ts) asserts the built manifest declares no content scripts and no web-accessible resources. The permissions are listed below. The background event page runs only the local automatic backup check (on startup, install, a daily alarm and backup-counter changes) and never reads a tab ([`entrypoints/background.ts`](entrypoints/background.ts)). | -| It never submits anything | There is no code path that sends a request (see the first row), the manifest has no host access, and the CSP sets `form-action 'none'`, so a form on an extension page cannot post anywhere. The test asserts the exact CSP in the built manifest. | +| Claim | How it is enforced | +| ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Local only | [`guard/build.test.ts`](guard/build.test.ts) scans every built `.js` and `.html` file for network APIs (`fetch`, `XMLHttpRequest`, `WebSocket`, `EventSource`, `sendBeacon`, `WebTransport`, `RTCPeerConnection`), checks that no built page loads a remote `src` or `href`, and asserts the manifest has no host permissions. [`eslint.config.js`](eslint.config.js) bans the same APIs in source (`no-restricted-globals`, `no-restricted-properties`, `no-restricted-syntax`). The Content Security Policy in [`wxt.config.ts`](wxt.config.ts) sets `default-src 'self'; ... connect-src 'none'`. | +| Nothing reads or touches a page until you click | [`guard/build.test.ts`](guard/build.test.ts) asserts the built manifest declares no content scripts and no web-accessible resources. The permissions are listed below. The background event page runs only the local automatic backup check (on startup, install, a daily alarm and backup-counter changes) and never reads a tab ([`entrypoints/background.ts`](entrypoints/background.ts)). The fill script is injected only by [`shell/fill/inject.ts`](shell/fill/inject.ts). A lint rule in [`eslint.config.js`](eslint.config.js) lets only [`shell/fill/controller.ts`](shell/fill/controller.ts) import its apply call. A controller test ([`shell/fill/controller.test.ts`](shell/fill/controller.test.ts)) shows that scanning never applies. The Fill button's click handler is the only caller of `fill()` ([`shell/ui/fill-section-source.test.ts`](shell/ui/fill-section-source.test.ts)). | +| It fills only when you click, and never submits | There is no code path that sends a request (see the first row), the manifest has no host access, and the CSP sets `form-action 'none'`, so a form on an extension page cannot post anywhere. The test asserts the exact CSP in the built manifest. For the fill script, a lint block in [`eslint.config.js`](eslint.config.js) covers `shell/fill/page/**` and `entrypoints/fill.ts`. It bans submit, requestSubmit, click, focus, blur, scrollIntoView and dispatchEvent, constructing events, creating elements, setting attributes or HTML, and console, storage, postMessage and cookie access. Only [`shell/fill/page/events.ts`](shell/fill/page/events.ts) may dispatch an event, and only a plain `input` or `change`. [`guard/build.test.ts`](guard/build.test.ts) scans the built `fill.js` for `submit`, `requestSubmit`, `click`, `KeyboardEvent`, `MouseEvent`, `PointerEvent` and `SubmitEvent`. A fixture test ([`shell/fill/page-apply.test.ts`](shell/fill/page-apply.test.ts)) fills a form and sees no submit, no new element and no new attribute. | Files are saved only through [`shell/files/download.ts`](shell/files/download.ts), which builds a local `blob:` URL. A lint rule in [`eslint.config.js`](eslint.config.js) rejects any other use of `downloads`, and [`guard/source-rules.test.ts`](guard/source-rules.test.ts) tests that rule. @@ -34,14 +34,15 @@ Stage 1 is the dashboard. Stage 2 adds saving a job from the page you are on, pl - **Applications list** with search, filters, manual entry, and a next-action date and who acts next. - **Save a job.** After you click the toolbar button (or press Alt+Shift+S by default; you can rebind it in about:addons), the popup reads the current tab once and offers the job for saving. Nothing is read before the click. +- **Fill a form.** In the popup, Fill writes your saved details and answers into the empty fields it recognises with certainty, then lists what it did not fill and why. It never changes a field that already has a value, and it never submits. Custom dropdowns and file uploads are listed for you to do yourself. - **Duplicate and repost facts.** When a job matches an application you already have, the popup says so ("already applied" or "possible match"). It also states the fact when you saved the same posting earlier, without judging it. - **Automatic backup.** Countersign saves `Countersign/countersign-backup.json` to your downloads folder, and the dashboard shows how old the last backup is. The backup file holds all your data, including your details and contacts, as plain text, so keep your downloads folder out of cloud sync if that matters to you. - **What I told them.** Per application, record the answers you gave. A warning appears when one differs from your canonical answer. - **Quiet list** (`#/quiet`) of applications with no response for a set number of days (a setting). You can close several at once. -- **Formhand log.** On an application, record the application site type and how filling went. You enter it by hand. +- **Fill log.** On an application, record the application site type and how filling went. You enter it by hand. - **Contacts** (`#/contacts`) with a log of reaching out, replies and referrals. The popup and the application page ask "anyone here?" and let you record that you checked and nobody was there. - **Deadlines** (`#/deadlines`): open tasks, next-action dates and quiet applications on one list, dated rows first. -- **My details** (`#/details`): 14 profile fields (name, first and last name, email, phone, address, links) and your canonical answers, each with a copy button. Copying uses a click only, and nothing is typed into a page. +- **My details** (`#/details`): 14 profile fields (name, first and last name, email, phone, address, links) and your canonical answers, each with a copy button. Copying uses a click only. - **Application detail** with a status history. Entries can be backdated, and a mistaken status can be undone without deleting history. - **Resume and cover-letter records.** You attach a file to record which one you sent. Countersign stores the file name and a SHA-256 hash, not the file. - **Canonical answers** (for example work authorisation or salary range), each with its history of earlier values. diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 5ad1249..7794510 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -5,6 +5,8 @@ Countersign is a Manifest V3 Firefox extension built with WXT and Preact. It sto ## The core and the shell - `core/` holds the rules: types, status logic, dates, application operations, list filtering, answers, documents, export, validation and migrations. It is plain TypeScript. +- `core/src/fill/` holds the matching and planning for the form filler. It has no DOM. +- `shell/fill/` holds the page script (`shell/fill/page/`), the injector (`shell/fill/inject.ts`) and the controller (`shell/fill/controller.ts`). - `shell/` and `entrypoints/` hold everything that touches the browser: IndexedDB, `storage.local`, file saving, the Preact UI and the toolbar button. The split is enforced three ways: @@ -59,11 +61,17 @@ An in-memory repository (`core/src/memory-repository.ts`) is used in tests. The ## The privacy guard -Three parts keep "no network, nothing reads a page until you click" true. The local automatic backup check is the one thing that runs without a click. +Four parts keep "no network, nothing reads or touches a page until you click, never submits" true. The local automatic backup check is the one thing that runs without a click. 1. **Lint rules** (`eslint.config.js`) ban network APIs in source and ban `downloads` outside `shell/files/download.ts`. 2. **Built-output scan** (`guard/scan.ts`, run by `guard/build.test.ts`) looks for network tokens in every built `.js` and `.html` file. A small allowlist (`guard/allowlist.json`) explains known harmless matches, and a test fails if an entry goes stale. 3. **Manifest and CSP checks** (`guard/build.test.ts`) assert that permissions stay within a short allowlist, no host access, no content scripts, no remote resources in built pages, and the exact Content Security Policy from `wxt.config.ts`. +4. **Fill guard** keeps filling click-only and submit-free: + - A lint block in `eslint.config.js` for `shell/fill/page/**` and `entrypoints/fill.ts` bans calls to submit, requestSubmit, click, focus, blur, scrollIntoView and dispatchEvent, constructing events, creating elements, setting attributes or HTML, and console, storage, postMessage and cookie access. Only `shell/fill/page/events.ts` may dispatch an event, and only a plain `input` or `change`. + - Only `shell/fill/inject.ts` may use `scripting` and `tabs` for the fill script. An import rule (`no-restricted-imports` plus an `import()` selector in `eslint.config.js`) lets only `shell/fill/controller.ts` import its apply call. + - The built-output scan (`guard/scan.ts`, run by `guard/build.test.ts`) looks for `submit`, `requestSubmit`, `click`, `KeyboardEvent`, `MouseEvent`, `PointerEvent` and `SubmitEvent` in the built `fill.js`. + - The behaviour test `shell/fill/page-apply.test.ts` fills a fixture form and sees no submit, no new element and no new attribute. + - The controller test `shell/fill/controller.test.ts` shows that scanning never applies, and `shell/ui/fill-section-source.test.ts` shows that `fill()` is called only from the Fill button's click handler. ## Look and feel diff --git a/shell/ui/ApplicationDetail.tsx b/shell/ui/ApplicationDetail.tsx index 8042b7d..1100556 100644 --- a/shell/ui/ApplicationDetail.tsx +++ b/shell/ui/ApplicationDetail.tsx @@ -335,7 +335,7 @@ export function ApplicationDetail(props: { id: Id }): VNode { - +