Range & Reason
Security
What this repository actually does with data and responses. Every statement below is taken from the code. Where the code does not set a control, this page says so.
Where data is stored
Tool drafts are saved in this browser with localStorage. The code sets no expiry on those entries. They stay until the browser clears them. Anyone who can use the same browser profile can read them. There is no sessionStorage and no IndexedDB use in this code.
Most saved-work keys start with comp-tools:. The code also writes these keys, which are outside that prefix: trs-company-profile-v1 (company benefit values), trs-ai-access-code-v1 (an AI access code typed on some pages), cf_comp_review_chain_v1 (which steps of the comp review chain have rendered), cf_memo_count, cf_narrative_count, and cf_statement_count (counts of free AI uses). One access code key is inside the prefix: comp-tools:ai-access-code.
The workspace page builds a JSON backup in the browser and downloads it. The file's app field is the-compfather, its kind field is workspace-backup, and the download name is compfather-workspace- plus the first 10 characters of the ISO time (the date) plus .json. This code does not upload that file. A backup includes keys that start with comp-tools:, and the key trs-company-profile-v1, except keys that match access-code, free-answers, or free-memo (any case). The cf_ counters and trs-ai-access-code-v1 are not workspace keys, so they are left out. A restore writes only keys that pass the same filter.
On the server, free-answer tokens and AI rate counters live in memory for that process. issueTasteToken hashes the first x-forwarded-for value (or the word unknown) with SHA-256, allows up to 3 tokens a day in that map, and puts a 10 minute expiry on the token. Those maps are not written to disk. They reset when the process restarts.
Cookies and how long they last
This code sets a cookie in two places, both after Stripe reports a paid checkout. Both are HttpOnly, SameSite=Lax, and path=/. The Secure flag is set only when NODE_ENV is production. Each value is base64url JSON, a dot, and an HMAC-SHA256 hex signature from PRO_SESSION_SECRET. The value is signed, not encrypted. Page scripts cannot read the cookie. Anyone who can read the cookie value can read the JSON inside it.
range_reason_pro, set by/api/billing/success. The payload is the email Stripe returns, the Stripe customer id, the plan (monthly or annual), and issue and expiry times. The browser max-age and the signed expiry are both 30 days (30 * 24 * 3600seconds). The cookie identifies the customer. Whether Pro is active is a live Stripe subscription check on that customer id.range_reason_tools, set by/api/billing/tool-success. The payload is the tool keys, the same email and customer id, and issue and expiry times. The browser max-age is 400 days (400 * 24 * 3600seconds). The signed payload expiry is 10 times 365 days (10 * 365 * 24 * 3600seconds). After the browser drops the cookie, this code has no other copy of that unlock.
Older names are still read and are not deleted: cf_pro is checked when range_reason_pro is missing or does not verify, and cf_tools is read alongside range_reason_tools. A valid range_reason_pro wins over cf_pro. This code does not write a new max-age onto the older names. Their remaining time is whatever the browser already stored.
No other cookies.set call exists in this repository. There is no analytics cookie and no advertising cookie in this code.
What is sent to the AI provider
The provider in this code is Anthropic, through @anthropic-ai/sdk. The browser talks only to this site's /api/ai routes. The server calls getClient().beta.messages.create with the model in ANTHROPIC_MODEL, or claude-opus-5-5 when that variable is unset. Each call sends the system text written in that route plus one user message.
If ANTHROPIC_API_KEY is unset, the route returns a demo JSON body and does not call the provider. If AI_ENABLED is 0, false, off, or no, authorizeAiCall refuses before the model call. A call that is refused, or that fails the checks below, is not sent.
When a call is sent, the user message is:
/api/ai/explain(the statement preview): the question (trimmed, at most 1,000 characters) andstatementDataafterstripIdentifyingKeys./api/ai/statements: kind, components (key, label, value, prior, delta, pct), total, prior label and totals, pay and benefits subtotals, match percents, PTO days, and notes when present (trimmed, at most 1,000 characters)./api/ai/benchmarking-narrative: role label when present, target pay, market P25, P50, P75, and source when it is non-empty (trimmed to 200 characters), internal range min, mid, and max, the deterministic checks, job-description checks, word count, the job description when non-empty (trimmed, at most 8,000 characters), and notes when present (trimmed, at most 1,000 characters)./api/ai/consigliere: the context object (one object, at most 20 KB of JSON) and the question (trimmed, at most 1,000 characters)./api/ai/manager-scripts: scenario, role label (at most 200 characters), old pay, new pay, increase amount and percent, compa-ratio, midpoint, new compa-ratio, effective date (at most 100 characters), and the context line (at most 1,000 characters). Blank text is sent as null. The context line is the text that was typed./api/ai/memo: grades, findings, risks, recommendations, market grades, market pay, whether market data was supplied, and notes when present (trimmed, at most 1,000 characters)./api/ai/review: grade rows that have a label and numeric min, midpoint, and max; the flags array as given; and compa-ratio rows as given./api/ai/posting-coach: the posting (trimmed, at most 8,000 characters) and the question (trimmed, at most 1,000 characters)./api/ai/hr-copilot: the company profile object and the command string (trimmed, at most 1,000 characters). No page in this app fetches this route.
Role labels, notes, questions, context lines, job descriptions, and postings that pass the checks are sent as typed. How long the provider keeps a request is not set in this repository.
The field-name filter, as it runs
The field-name checks look at object keys. They do not read the characters inside a string. A person's name typed into a question, a note, a role label, or a job description is not a key, so these checks do not see it.
Exact-key rejection. These routes return HTTP 400, and do not call the provider, when any key at any depth is exactly name, email, or ssn after the whole key is lowercased: statements, benchmarking-narrative, consigliere (the context value and the question value), explain, manager-scripts, memo, review, and posting-coach. Lowercasing does not remove underscores or split camelCase. workEmail, phone, and first_name are not exact matches, so this rejection does not catch them. /api/ai/hr-copilot does not run this check.
stripIdentifyingKeys. This function is used in one place: /api/ai/explain copies statementData through it after the exact-key rejection, and only on the path that is about to call the model. It returns a copy with keys removed. It does not reject the request, and it does not change the object it was given. The other AI routes do not call it, so a key such as phone or workEmail is not removed there.
For each key, in this order:
- Lowercase the key and delete underscores, whitespace, and hyphens. If that string is name, fullname, firstname, lastname, employeename, email, ssn, phone, address, dob, or birthdate, the key is removed.
- If that same string is companyname, organizationname, orgname, benefitname, planname, perkname, gradename, rolename, jobname, departmentname, deptname, levelname, bandname, toolname, scenarioname, programname, vendorname, surveyname, locationname, filename, or rangename, the key is kept. This list is checked only after the list above, so
nameandemployeeNameare still removed. - Otherwise the key is split into words on camelCase, underscores, and hyphens. The letters e, then a space, underscore, or hyphen, then mail, become the word email before the split. A trailing number is its own word, so
ssn4becomes ssn and 4. If any word is name, email, phone, mobile, ssn, dob, birth, address, street, zip, postal, surname, forename, givenname, middlename, maidenname, nickname, username, passport, socialsecurity, or socialsecuritynumber, the key is removed. If two neighboring words are social and security, the key is removed. - Otherwise the key is kept. A longer word that only contains a short token, such as namespace, is not removed by the word list. The word id by itself is not a removing word, so
employeeIdis kept.
Nested objects and arrays are walked. A string, a number, or null is returned as it is.
Two routes also scan text. That is separate from the field-name filter. Benchmarking narrative returns 400 if the job description matches an email address or three digits, a hyphen, two digits, a hyphen, and four digits. It does not run that test on the notes string. Posting coach returns 400 if the posting or the question contains an email address, an SSN written with separators, a phone pattern, or nine or more digits in a row.
What is sent to Stripe
Card numbers are entered on Stripe's page. This code has no card field and does not read a card number. The browser posts JSON to this site, the server creates a Checkout Session or a Billing Portal session, and the browser sets window.location to the url Stripe returns. Pro checkout and the billing portal use window.location.href. A one-time tool purchase uses window.location.assign. That is a full page navigation, not a frame and not a script loaded from Stripe. This repository does not load Stripe.js.
- Pro checkout (
POST /api/billing/checkout) sends Stripe a subscription session: the price id for monthly or annual from the environment, success and cancel URLs on this site, automatic tax enabled, promotion codes allowed, and metadatabrandcompfatherandproductpro(the same metadata on the subscription). The create call does not include a customer id or an email. The browser sends only{ plan }. - Tool checkout (
POST /api/billing/checkout-tool) sends a one-time payment session: the tool's price id from the environment,customer_creationalways, the same tax and promotion settings, and metadatabrandcompfather,producttool-purchase, andtoolset to the tool key. The browser sends only{ tool }. - The return routes retrieve that session from Stripe. They set a cookie only when payment status is paid, the mode matches, and the customer id is a non-empty string. The email stored is
customer_details.emailfrom Stripe, or an empty string. The tool return also requires the session metadata tool to match the tool in the URL. - The billing portal (
POST /api/billing/portal) sends Stripe the customer id from the live Pro check and a return URL of this site's/pro. The browser then navigates to the portal URL Stripe returns. No portal call is made when that check is not Pro. POST /api/billing/webhookchecks thestripe-signatureheader and writes a console line with the event type, the event id, and the customer id for checkout completed, subscription updated, subscription deleted, and invoice payment failed. It does not grant or revoke access and it does not write a database.
What Stripe keeps, and for how long, is not set in this repository.
Hosting, HTTPS, and response headers
This code is written to run on Vercel. The canonical production URL in the code is https://rangeandreason.com. In production, requests to comp-tools-rho.vercel.app are redirected to that origin, except paths under /api. Preview hosts are not redirected. Fonts are loaded with next/font in the root layout, which serves them from this site. The layout says there is no runtime font CDN. This code does not load Vercel Analytics, Vercel Speed Insights, or any other analytics script.
HTTPS. The canonical URL uses https. The two cookies above are marked Secure only when NODE_ENV is production. HSTS. This repository does not set a Strict-Transport-Security header. next.config had no HSTS header to keep, and this change does not add one.
next.config headers() sets the following on every route (source /:path*). These are the values:
X-Frame-Options:DENYX-Content-Type-Options:nosniffReferrer-Policy:strict-origin-when-cross-originPermissions-Policy:camera=(), microphone=(), geolocation=(), payment=()Content-Security-Policy-Report-Only:default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self'; font-src 'self'; connect-src 'self'; form-action 'self' https://checkout.stripe.com https://billing.stripe.com; frame-src 'none'; frame-ancestors 'none'; base-uri 'self'; object-src 'none'
X-Frame-Options: DENY is enforced, so other sites cannot frame these responses. frame-ancestors 'none' is only inside the report-only policy, so that directive is not enforced. X-Content-Type-Options: nosniff and Referrer-Policy: strict-origin-when-cross-origin are enforced. Checkout does not read the Referer header. Stripe substitutes the session id into the success URL on this site.
Permissions-Policy denies camera, microphone, geolocation, and payment for every origin, including this site (payment=()). Checkout does not use the Payment Request API here. It leaves this site by a full page navigation. This header does not apply to Stripe's pages after that navigation.
Content-Security-Policy-Report-Only does not block loads. It has no report-uri and no report-to. This repository has no CSP report endpoint. default-src, img-src, font-src, and connect-src are 'self'. The browser calls this site, including /api. The server, not the browser, calls Anthropic and Stripe. script-src and style-src also allow 'unsafe-inline' because the pages include inline scripts, and some pages set style attributes (the sample chart on the home page, the statement bars, and the compa-ratio bars). form-action allows this site, https://checkout.stripe.com, and https://billing.stripe.com. The checkout and portal redirects are top-level navigations to the URL Stripe returns, not form submissions, and the report-only policy does not block them. frame-src and object-src are 'none'. base-uri is 'self'.
What is not in place
There is no signup and no user account in this code. There is no database. Stripe is the record of who paid. Saved work stays in the browser, as described above.
There is no SOC 2 report, no data processing agreement yet, no single sign-on, and no audit log that is stored. There is no auth provider in this code. auditLog in app/lib/ai.ts only prints a JSON line with console.log. That line is not written to a database. Most of those lines are an event name and counts. The benchmarking narrative line also includes the target pay number. The company-profile route, which no page calls, includes the command text and, when it proposes a change, the proposed diff. The Stripe webhook prints a console line with the event type, the event id, and the customer id. There is no audit log beyond these console lines.
This code does not encrypt localStorage, the backup file, or the cookies. It does not claim encryption at rest. It does not set a retention period for localStorage, for the AI provider, for Stripe, or for hosting logs. The only lifetimes this code sets are the cookie and token times above.
Report a vulnerability
Email support.rangeandreason@gmail.com. That is the support address already shown in the footer.
This page describes the code in this repository. It is not legal advice and it does not claim a certification.