Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The product is only useful because people paste **real secrets** into it. These
4. No file content in a URL, a hash, or a share link.
5. Masked values must not exist in the DOM while masked.
6. Fix blocks, reports (default redaction) and agent prompts must never contain a value. Tests assert this with real-looking strings.
7. No inline executable `<script>` and no third-party `<script src>` in the built HTML. A single `<script type="application/ld+json">` data block is allowed for structured data; the guard rejects it if it does not parse as JSON, so it cannot be used to smuggle code. `<link rel="canonical">` is the only external `<link>` permitted, because metadata is not a request.

A PR that relaxes any of these will be declined, whatever else it improves.

Expand Down
24 changes: 24 additions & 0 deletions PROGRESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,30 @@ two.

---

### 2026-10-21 — Found, not just built: canonical domain, preview card, metadata

- **Domain:** `envcompare.vercel.app` claimed for the project (first choice; the fallback
`env-compare.vercel.app` is somebody else's). The previous `env-compare-six.vercel.app` alias still
resolves, so nothing that was shared before breaks.
- **Preview card:** `public/og-image.png`, 1200×630, 366 kB. Generated as a designed card, downscaled
once with ImageMagick, and checked at full size for legible, correctly spelled text — a preview that
is unreadable at 200 px wide is worse than none. A matching 180 px touch icon and 192/512 px manifest
icons were drawn from the favicon geometry so the mark is identical everywhere.
- **Metadata:** description (155 chars), canonical, `robots: index, follow, max-image-preview:large`,
the full `og:*` set with image dimensions and alt text, `twitter:summary_large_image`, a single
`WebApplication` JSON-LD block, `robots.txt` and `sitemap.xml` covering exactly the three routes
`vercel.json` rewrites, plus a web manifest and long-lived cache headers for static assets.
- **The guard had to learn one word.** It failed the build on the JSON-LD block ("inline script") and
on the canonical link ("loads an external resource") — both correct rules, both wrong here. The fix
narrows them instead of dropping them: JSON-LD blocks are stripped, must parse as JSON, and any other
inline script still fails; only `rel="canonical"` is excused from the external-link rule. Three
negative tests (real inline script, Google Fonts stylesheet, JSON-LD with a `fetch()` inside) each
fail as they should.
- **13 new tests** in `tests/unit/metadata.test.ts`, including the actual pixel dimensions of the card
and every icon, and a check that the sitemap cannot drift from the rewrite list.

**378 tests**, typecheck, build and guard green.

## Decisions made during implementation

| Date | Decision | Why |
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

**See what your `.env` is missing — without your secrets leaving the browser.**

**[envcompare.vercel.app](https://envcompare.vercel.app)** · no install, no account, one page.

Paste `.env.example` and `.env` — add `.env.local`, `.env.staging`, `.env.production` if you keep them. EnvCompare shows every variable that is missing, empty, still a placeholder, or leftover in each file, and hands you the exact block to paste back.

No upload. No account. No storage. No analytics.
Expand Down
14 changes: 14 additions & 0 deletions docs/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,20 @@ The layout treats 2 files as the common case and N as a first-class one:
- The Fix tab carries a target selector once there is more than one target, and the primary copy
button in the results bar follows the same selection — one idea of "the file I am fixing", not two.

### Social preview card

The link preview is the first screen most people will ever see, so it uses the same rules as the app:

- 1200×630 PNG (1.91:1), under 1 MB, dark surface (`#101215`) so it does not disappear in a white
feed, with 64 px of safe margin on every edge.
- Three ingredients only: the mark and wordmark, one headline at ~110 px ("See what your `.env` is
missing."), one supporting line. Readability at thumbnail size decides what survives.
- The state palette does the explaining: a strip of key rows labelled Match, Missing, Same,
Different and Extra, in the same colours the table uses. It looks like the product because it is
the product's vocabulary.
- Text is generated and then checked by eye at full size; the card is a static file, not a runtime
render, so it cannot break in production.

### Theme selection

Three explicit choices in the header — **Auto** (follow the OS, the default), **Light**, **Dark** — as segmented buttons with `aria-pressed`. Not a two-state toggle, because "follow my OS" is a real preference that a toggle silently discards.
Expand Down
29 changes: 28 additions & 1 deletion docs/PRD.md
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,9 @@ Notes:
2. Check `package.json` dependencies against an allowlist (`react`, `react-dom`, plus dev-only tooling). Any addition requires a `deps-approved` maintainer label.
3. After the build, scan `dist/**/*.js` for external origins (`https://`, `http://`, protocol-relative `//`) not in a tiny allowlist of unavoidable literals (e.g. the `http://www.w3.org/2000/svg` namespace). Fail on anything else.
4. Assert `dist/index.html` contains no `<script src>` other than same-origin hashed bundles.
5. Assert there are no inline `<script>` tags (external modules only).
5. Assert there are no inline executable `<script>` tags (external modules only). A `<script
type="application/ld+json">` block is allowed because browsers never execute it, and the check
parses it as JSON first; see §13.8.

The guard prints a human-readable explanation so contributors understand *why* something is blocked, and links to `docs/PRIVACY.md`.

Expand Down Expand Up @@ -1074,6 +1076,31 @@ defined here and enforced in `scripts/check-privacy.mjs`:
- **Everything else is unchanged.** No localStorage, no IndexedDB, no service worker, no third-party
cookie, no analytics. `connect-src 'none'` remains.

### 13.8 Amendment (2026-10-21): discovery metadata and social previews

The tool is meant to be found and shared, which needs real metadata — but metadata is exactly where
third-party scripts usually sneak in (tag managers, social SDKs, font loaders). The rules therefore
change in one narrow way and stay rigid everywhere else.

- **`index.html` carries the full set:** description, canonical URL, `og:*` (type, site, url, title,
description, image + dimensions + alt, locale), `twitter:*` with `summary_large_image`, theme
colours, an Apple touch icon and a web manifest. All URLs are absolute `https://` on the canonical
host, so a preview never depends on the reader's host.
- **One 1200×630 PNG** (`public/og-image.png`, under 1 MB) is the card for every platform; alt text
describes it for screen readers, because a link preview is content too.
- **Structured data** is a single `WebApplication` JSON-LD block: free, `DeveloperApplication`,
linking the repository and the license. It is data, not code.
- **The `no inline <script>` rule is narrowed, not dropped.** The guard strips
`<script type="application/ld+json">…</script>` blocks, requires each to parse as JSON, and then
fails on any other inline script. A JSON-LD block that is not valid JSON is treated as an attempt
to hide code. Canonical links are likewise excused from the "no external `<link>`" rule — metadata
is not a fetch.
- **Crawler files are part of the build:** `robots.txt`, `sitemap.xml` (only the three routes that
`vercel.json` rewrites) and `site.webmanifest`, with long-lived cache headers for immutable assets.
- **Enforced by tests,** not by intention: `tests/unit/metadata.test.ts` asserts tag values, absolute
URLs, title/description lengths, JSON-LD validity, the real pixel size of every icon, and that the
sitemap cannot drift from the rewrite list.

## 14. Technical architecture

### 14.1 Stack decision
Expand Down
2 changes: 1 addition & 1 deletion docs/PRIVACY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Privacy

EnvCompare exists to be used with real credentials. That only works if you can satisfy yourself — not take our word — that nothing leaves your browser. This page is the long version of [/privacy](https://env-compare.vercel.app/privacy).
EnvCompare exists to be used with real credentials. That only works if you can satisfy yourself — not take our word — that nothing leaves your browser. This page is the long version of [/privacy](https://envcompare.vercel.app/privacy).

## The short version

Expand Down
67 changes: 64 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,81 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="referrer" content="no-referrer" />

<title>EnvCompare — see what your .env is missing</title>
<meta
name="description"
content="Compare .env and .env.example in your browser. See every variable that is missing, empty, or leftover. Nothing is uploaded."
content="Paste .env and .env.example — or six more — and see every variable that is missing, empty, a placeholder, or leftover. Free, open source, nothing uploaded."
/>
<link rel="canonical" href="https://envcompare.vercel.app/" />
<meta name="robots" content="index, follow, max-image-preview:large" />
<meta name="author" content="EnvCompare contributors" />
<meta name="application-name" content="EnvCompare" />
<meta name="color-scheme" content="light dark" />

<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link rel="manifest" href="/site.webmanifest" />
<meta name="theme-color" content="#f6f6f3" media="(prefers-color-scheme: light)" />
<meta name="theme-color" content="#101215" media="(prefers-color-scheme: dark)" />
<meta name="msapplication-TileColor" content="#101215" />

<!-- Open Graph: read by Slack, Discord, LinkedIn, iMessage, Facebook. -->
<meta property="og:type" content="website" />
<meta property="og:site_name" content="EnvCompare" />
<meta property="og:url" content="https://envcompare.vercel.app/" />
<meta property="og:title" content="EnvCompare — see what your .env is missing" />
<meta
property="og:description"
content="Compare .env and .env.example side by side. Nothing is uploaded, nothing is stored."
content="Compare two to eight env files in your browser. See every variable that is missing, empty, or leftover — then copy the block to fix it. Nothing is uploaded."
/>
<meta property="og:type" content="website" />
<meta property="og:image" content="https://envcompare.vercel.app/og-image.png" />
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta
property="og:image:alt"
content="EnvCompare: a dark card reading “See what your .env is missing”, beside a table of env keys marked Match, Missing, Same, Different and Extra."
/>
<meta property="og:locale" content="en_US" />

<!-- X / Twitter. summary_large_image keeps the full card on mobile. -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="EnvCompare — see what your .env is missing" />
<meta
name="twitter:description"
content="Compare two to eight env files in your browser. See every variable that is missing, empty, or leftover — then copy the block to fix it. Nothing is uploaded."
/>
<meta name="twitter:image" content="https://envcompare.vercel.app/og-image.png" />
<meta
name="twitter:image:alt"
content="EnvCompare: a dark card reading “See what your .env is missing”, beside a table of env keys marked Match, Missing, Same, Different and Extra."
/>

<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebApplication",
"name": "EnvCompare",
"url": "https://envcompare.vercel.app/",
"description": "Compare two to eight .env files in the browser and see every variable that is missing, empty, placeholder or leftover. Nothing is uploaded or stored.",
"applicationCategory": "DeveloperApplication",
"operatingSystem": "Any",
"browserRequirements": "Requires JavaScript",
"isAccessibleForFree": true,
"offers": { "@type": "Offer", "price": "0", "priceCurrency": "USD" },
"license": "https://opensource.org/license/mit",
"codeRepository": "https://github.com/SynergyFlowLabs/env-compare",
"image": "https://envcompare.vercel.app/og-image.png",
"featureList": [
"Compare two to eight env files at once",
"Detect missing, empty, placeholder, commented and differing variables",
"Copy a fix block for any target file",
"Redacted Markdown report and agent prompt",
"No upload, no storage, no analytics"
]
}
</script>
</head>
<body>
<div id="root"></div>
Expand Down
Binary file added public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/og-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# EnvCompare is a single static page plus two rendered routes.
User-agent: *
Allow: /

Sitemap: https://envcompare.vercel.app/sitemap.xml
15 changes: 15 additions & 0 deletions public/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "EnvCompare — see what your .env is missing",
"short_name": "EnvCompare",
"description": "Compare two to eight .env files in the browser. Nothing is uploaded or stored.",
"start_url": "/",
"scope": "/",
"display": "standalone",
"background_color": "#101215",
"theme_color": "#101215",
"icons": [
{ "src": "/favicon.svg", "sizes": "any", "type": "image/svg+xml", "purpose": "any" },
{ "src": "/icon-192.png", "sizes": "192x192", "type": "image/png", "purpose": "any" },
{ "src": "/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any" }
]
}
21 changes: 21 additions & 0 deletions public/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://envcompare.vercel.app/</loc>
<lastmod>2026-10-21</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://envcompare.vercel.app/about</loc>
<lastmod>2026-10-21</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>https://envcompare.vercel.app/privacy</loc>
<lastmod>2026-10-21</lastmod>
<changefreq>monthly</changefreq>
<priority>0.6</priority>
</url>
</urlset>
37 changes: 32 additions & 5 deletions scripts/check-privacy.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
* 2. every runtime dependency is on a reviewed allowlist, carries the license
* it was reviewed under, and ships no install scripts
* 3. no third-party origins in the built bundle (except allowlisted link targets)
* 4. no inline <script> and no third-party <script src> in the built HTML
* 4. no inline executable <script> and no third-party <script src> in the
* built HTML. `<script type="application/ld+json">` is allowed: it is
* data handed to crawlers, never executed, and it is parsed here to make
* sure it really is JSON and not smuggled code.
*
* Run: `npm run privacy` (after `npm run build` for checks 3 and 4).
*/
Expand Down Expand Up @@ -245,16 +248,40 @@ if (!existsSync(distDir)) {
}

const html = readFileSync(join(distDir, 'index.html'), 'utf8');
const inlineScripts = [...html.matchAll(/<script(?![^>]*\bsrc=)[^>]*>/g)];

// Structured data is the one inline <script> allowed. It is inert — no browser
// executes it — but it is still a place code could hide, so each block must
// parse as JSON before it is excused.
const ldJsonBlocks = [...html.matchAll(/<script type="application\/ld\+json">([\s\S]*?)<\/script>/g)];
for (const block of ldJsonBlocks) {
try {
JSON.parse(block[1]);
} catch {
failures.push('dist/index.html has a JSON-LD block that is not valid JSON; it could be script.');
}
}
if (ldJsonBlocks.length > 0) {
notes.push(
`dist/index.html carries ${ldJsonBlocks.length} JSON-LD block (structured data, inert, parsed by this check).`,
);
}
const withoutLdJson = html.replace(/<script type="application\/ld\+json">[\s\S]*?<\/script>/g, '');
const inlineScripts = [...withoutLdJson.matchAll(/<script(?![^>]*\bsrc=)[^>]*>/g)];
if (inlineScripts.length > 0) {
failures.push('dist/index.html contains an inline <script>; only same-origin modules are allowed.');
}
const externalScripts = [...html.matchAll(/<script[^>]*\bsrc="(?!\/)[^"]*"/g)];
const externalScripts = [...withoutLdJson.matchAll(/<script[^>]*\bsrc="(?!\/)[^"]*"/g)];
if (externalScripts.length > 0) {
failures.push('dist/index.html loads a script from outside this origin.');
}
const externalLinks = [...html.matchAll(/<link[^>]*\bhref="(https?:[^"]+)"/g)];
for (const link of externalLinks) failures.push(`dist/index.html loads an external resource: ${link[1]}`);
// `<link rel="canonical">` is metadata, not a fetch. Everything else that
// points at another origin is a request the page would actually make.
for (const tag of html.matchAll(/<link\b[^>]*>/g)) {
const rel = tag[0].match(/\brel="([^"]*)"/)?.[1] ?? '';
if (rel === 'canonical') continue;
const href = tag[0].match(/\bhref="(https?:[^"]+)"/)?.[1];
if (href) failures.push(`dist/index.html loads an external resource: ${href}`);
}
const externalPreloads = [...html.matchAll(/<(?:img|iframe|embed)[^>]*\bsrc="(https?:[^"]+)"/g)];
for (const preload of externalPreloads) {
failures.push(`dist/index.html embeds an external resource: ${preload[1]}`);
Expand Down
Loading
Loading