mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-12-01 01:14:47 +00:00
OpenErrand: user-agent rule, captcha solver policy, reference runner note
Anthony's answers on #227 ("go with your recommendations"): - Rule 11: a runner may run headless with a normal desktop browser user agent (dropping HeadlessChrome) and nothing more: no fingerprint spoofing beyond the UA string, no stealth plugins, no solving or evading a bot challenge. A challenge the browser completes itself is a wait step; any other is a captcha gate. - Captcha solvers: new site.sector and captcha step `solver` (forbidden by default | allowed). Never allowed on government, tax, financial, healthcare or identity-provider sites, nor on any errand with a declare or identity-proofing step or a secret input; elsewhere only when the file says so, with every use logged. The validator rejects `allowed` in the forbidden set or without a stated sector; six new tests. The FTB example states sector "tax". - Reference runner: @logicsrc/openerrand / `logicsrc errand run`, marked in progress; ftb stays the runner the example was taken from. - Name stays OpenErrand; family stays Agents and process. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
41d0c59a74
commit
c9104a7a36
8 changed files with 79 additions and 17 deletions
|
|
@ -11,6 +11,7 @@
|
|||
"principal": "self",
|
||||
"site": {
|
||||
"name": "California Franchise Tax Board (MyFTB)",
|
||||
"sector": "tax",
|
||||
"origins": ["https://webapp.ftb.ca.gov"],
|
||||
"start": ["https://webapp.ftb.ca.gov/MyFTBAccess/Registration/NewAccount"]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export const STEPS: Array<[string, string]> = [
|
|||
["identity-proofing", "A selfie, a video call or an ID scan at a provider such as ID.me. Never driven by the runner: the person does it in a visible window."],
|
||||
["code", "A one-time code by text, email, call or app, relayed by the person through a terminal, a file or the runner's own page."],
|
||||
["mail", "A letter with a PIN. The run ends as waiting and a hand-off card says what to do when it comes."],
|
||||
["captcha", "Shown to the principal, or the run stops. Never sent to a solving service or a model."]
|
||||
["captcha", "Shown to the principal, or the run stops. A solver only where the errand says so, never on a government, tax, financial, healthcare or identity-provider site, never with a declaration, identity proofing or a secret input."]
|
||||
];
|
||||
|
||||
/** The sensitivity classes, in the order the spec lists them. */
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ const EXCERPT = `"rules": [
|
|||
const RULES: Array<[string, string]> = [
|
||||
["Shows the errand first", "Title, publisher, every gate with its reason, every input with its sensitivity and source. A file whose hash changed is shown again before it runs."],
|
||||
["Never guesses", "Fields are matched by id first and label second. A required field no rule fills stops the run."],
|
||||
["Never performs a gate", "Declarations need the person's consent for this run. Identity proofing, captchas and letters are theirs. Codes come only through a declared relay."],
|
||||
["Never performs a gate", "Declarations need the person's consent for this run. Identity proofing and letters are theirs, and so are captchas on any sensitive site. Codes come only through a declared relay."],
|
||||
["One shared secret per run", "A figure from a return is submitted once. A rejection ends the run and lists the other candidates; a person picks the next one."],
|
||||
["Keeps documents and values in place", "Extraction is local. Values go to the site's fields and the vault; logs hold fields, never values; cards hold steps, never secrets."]
|
||||
];
|
||||
|
|
@ -55,9 +55,10 @@ export default function OpenErrandPage(): ReactNode {
|
|||
values that are secret, the steps that belong to a person, and the point where it stops.
|
||||
</p>
|
||||
<p style={{ color: "#5b6b7a" }}>
|
||||
Status: 0.1. The reference runner is <code style={mono}>ftb</code> in cli-tools, which
|
||||
registers and activates MyFTB accounts at the California Franchise Tax Board; the worked
|
||||
example in the specification transcribes its rule table. An excerpt:
|
||||
Status: 0.1. A generic runner, <code style={mono}>logicsrc errand run</code> from{" "}
|
||||
<code style={mono}>@logicsrc/openerrand</code>, is in progress. The worked example
|
||||
transcribes the rule table of <code style={mono}>ftb</code> in cli-tools, which registers
|
||||
and activates MyFTB accounts at the California Franchise Tax Board. An excerpt:
|
||||
</p>
|
||||
<pre style={pre}>{EXCERPT}</pre>
|
||||
</div>
|
||||
|
|
@ -163,7 +164,7 @@ export default function OpenErrandPage(): ReactNode {
|
|||
<h2>Not</h2>
|
||||
</div>
|
||||
<p style={{ color: "#41505d" }}>
|
||||
Not a way around a check: there is no key for proxies, fingerprints or captcha solvers.
|
||||
Not a way around a check: a runner may present a normal browser user agent and nothing more, with no fingerprint spoofing, no stealth plugins and no challenge solving.
|
||||
Not for someone else's account. Not an API: when a site has one, use{" "}
|
||||
<Link href="/openconnection">OpenConnection</Link>,{" "}
|
||||
<Link href="/openaccess">OpenAccess</Link> or <Link href="/opensaas">OpenSaaS</Link>. Not a
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ The top-level keys:
|
|||
| `updated` | When anything in the file last changed, ISO 8601. |
|
||||
| `reference` | A URL for the runner or the code the errand was taken from. |
|
||||
| `principal` | `self`: the person running it is the principal. `represented`: they act for the principal with authority to, as a corporation's officer does for the corporation. |
|
||||
| `site` | `name`, `origins` (the https origins the runner may navigate), `start` (the URLs a run opens, in order of preference), `terms` (the site's terms of use). |
|
||||
| `site` | `name`, `sector` (`government`, `tax`, `financial`, `healthcare`, `identity-provider`, `commercial` or `other`: who runs the site, which decides whether a captcha solver may ever be allowed), `origins` (the https origins the runner may navigate), `start` (the URLs a run opens, in order of preference), `terms` (the site's terms of use). |
|
||||
| `limits` | `pages` (the most pages one run may submit, default 15), `page_timeout` (default `PT30S`), `same_page` (how many times the same URL may come back before the run stops as a loop, default 2). |
|
||||
| `inputs` | The values the errand needs, by name. |
|
||||
| `rules` | The field rules, applied on every page step. |
|
||||
|
|
@ -153,7 +153,7 @@ On each page the runner takes the first step whose `match` fits (`url`, `title`,
|
|||
| `identity-proofing` | Proving who you are to an identity provider: a selfie, a video call, a document scan. A gate. |
|
||||
| `code` | A one-time code sent to the principal. A gate. |
|
||||
| `mail` | A letter the site posts to the principal. A gate. |
|
||||
| `captcha` | A test meant to tell a person from a program. A gate. |
|
||||
| `captcha` | A test meant to tell a person from a program. A gate, unless the errand allows a solver where [the captcha rules](#captcha) permit one. |
|
||||
|
||||
## Human gates
|
||||
|
||||
|
|
@ -185,7 +185,11 @@ A mail gate ends the run with outcome kind `waiting`. The runner delivers the `h
|
|||
|
||||
### `captcha`
|
||||
|
||||
A runner does not send a captcha to a solving service, a model, or a person paid to solve them. It shows the page to the principal in a visible window, or stops. A `wait` step is not a captcha: a proof of work the page's own script solves asks nothing of a person, and waiting for it is all a runner does.
|
||||
By default a runner shows the page to the principal in a visible window, or stops. It does not send the captcha to a solving service, a model, or a person paid to solve them.
|
||||
|
||||
`solver` on the step is `forbidden`, the default, or `allowed`. A solver is never allowed on a government, tax, financial, healthcare or identity-provider site, as `site.sector` states, and never on an errand with a `declare` or `identity-proofing` step or any `secret` input, whatever its sector. Elsewhere an errand may say `"solver": "allowed"` explicitly, and a runner that then uses a solver logs every use: the time, the page URL and the service, never the image or the answer. A validator rejects `allowed` on an errand in the forbidden set, and on an errand that does not state its `site.sector`.
|
||||
|
||||
A `wait` step is not a captcha: a proof of work the page's own script solves asks nothing of a person, and waiting for it is all a runner does.
|
||||
|
||||
## Outcomes and retry
|
||||
|
||||
|
|
@ -279,7 +283,7 @@ As in [Matching](#matching). A required field no rule fills stops the run, or is
|
|||
|
||||
### 4. It never performs a gate
|
||||
|
||||
A `declare` box is ticked only on the principal's consent for this run. Identity proofing, captchas and letters are the person's. A code comes only through a declared relay.
|
||||
A `declare` box is ticked only on the principal's consent for this run. Identity proofing and letters are the person's, and so is a captcha unless the errand allows a solver where [the captcha rules](#captcha) permit one. A code comes only through a declared relay.
|
||||
|
||||
### 5. It submits one shared secret per run
|
||||
|
||||
|
|
@ -305,9 +309,9 @@ Only built-ins and public inputs go on a card, and the card is delivered only on
|
|||
|
||||
To the vault in `outputs.vault`, or to a 0600 state file when there is none. A login that exists only in a terminal's scrollback is a login lost.
|
||||
|
||||
### 11. It waits out an interstitial and does not defeat it
|
||||
### 11. It may look like a browser, and never defeats a check
|
||||
|
||||
A `wait` step is polled until it clears or times out. A runner does not solve, skip or spoof its way past a check.
|
||||
A runner may run headless and present a normal desktop browser user agent, for example by dropping `HeadlessChrome` from it. That is as far as it goes: no fingerprint spoofing beyond the user-agent string, no stealth plugins, and no solving, skipping or evading a bot challenge. A challenge the browser completes on its own, such as a proof-of-work interstitial, is a `wait` step, polled until it clears or times out. Any other challenge is a `captcha` gate.
|
||||
|
||||
### 12. It has a dry run
|
||||
|
||||
|
|
@ -319,7 +323,7 @@ The same URL `limits.same_page` times, or more than `limits.pages` pages, ends t
|
|||
|
||||
## Worked example
|
||||
|
||||
Registering a MyFTB account for a California S corporation at the Franchise Tax Board. FTB has no API: the account is a browser registration checked against a figure from a filed Form 100S, a code texted to the representative's phone, and a PIN mailed to the address on file. The reference runner is `ftb` in [cli-tools](https://github.com/profullstack/cli-tools/pull/125), and this file transcribes its rule table, gates and outcomes. The file holds no personal data: every value comes from the principal's own returns, vault or terminal at run time.
|
||||
Registering a MyFTB account for a California S corporation at the Franchise Tax Board. FTB has no API: the account is a browser registration checked against a figure from a filed Form 100S, a code texted to the representative's phone, and a PIN mailed to the address on file. `ftb` in [cli-tools](https://github.com/profullstack/cli-tools/pull/125) performs it today, and this file transcribes its rule table, gates and outcomes. The file holds no personal data: every value comes from the principal's own returns, vault or terminal at run time.
|
||||
|
||||
```json
|
||||
{
|
||||
|
|
@ -335,6 +339,7 @@ Registering a MyFTB account for a California S corporation at the Franchise Tax
|
|||
"principal": "self",
|
||||
"site": {
|
||||
"name": "California Franchise Tax Board (MyFTB)",
|
||||
"sector": "tax",
|
||||
"origins": ["https://webapp.ftb.ca.gov"],
|
||||
"start": ["https://webapp.ftb.ca.gov/MyFTBAccess/Registration/NewAccount"]
|
||||
},
|
||||
|
|
@ -628,15 +633,19 @@ The next errand planned is IRS.gov: sign in through ID.me and download account a
|
|||
|
||||
## Schema
|
||||
|
||||
The JSON Schemas are `logicsrc-openerrand.schema.json` and `logicsrc-openerrand-index.schema.json` in [`@logicsrc/schemas`](https://github.com/profullstack/logicsrc/tree/master/packages/schemas/schemas), exported as `@logicsrc/schemas/openerrand` and `@logicsrc/schemas/openerrand-index`. `@logicsrc/validators` adds the checks a schema cannot express: step, gate, outcome and card references resolve, every `{{template}}` names an input, a shared secret is `secret`, and no card names a personal or secret input.
|
||||
The JSON Schemas are `logicsrc-openerrand.schema.json` and `logicsrc-openerrand-index.schema.json` in [`@logicsrc/schemas`](https://github.com/profullstack/logicsrc/tree/master/packages/schemas/schemas), exported as `@logicsrc/schemas/openerrand` and `@logicsrc/schemas/openerrand-index`. `@logicsrc/validators` adds the checks a schema cannot express: step, gate, outcome and card references resolve, every `{{template}}` names an input, a shared secret is `secret`, no card names a personal or secret input, and a captcha solver is allowed only outside the forbidden set.
|
||||
|
||||
```
|
||||
npx @logicsrc/validators openerrand ftb-register-business.json
|
||||
```
|
||||
|
||||
## Reference runner
|
||||
|
||||
In progress: a generic runner, the `@logicsrc/openerrand` package in the LogicSRC repository, run as `logicsrc errand run <file>`, reads an errand file and drives headless Chrome through it under the rules above. Until it ships, `ftb` in cli-tools is the runner the worked example was taken from; it has the same rule table compiled in rather than reading the file.
|
||||
|
||||
## Not
|
||||
|
||||
**Not a way around a check.** There is no key for proxies, browser fingerprints, user agents or captcha solvers, and no gate a runner may perform. A site that wants a person gets one.
|
||||
**Not a way around a check.** A runner may present an ordinary browser user agent and nothing more. There is no key for proxies or browser fingerprints, no gate a runner may perform, and a captcha solver only where [the captcha rules](#captcha) allow one. A site that wants a person gets one.
|
||||
|
||||
**Not for someone else's account.** The principal is the person running it or someone they represent with authority. An errand run against a stranger's records is the fraud the site's checks exist to stop.
|
||||
|
||||
|
|
@ -663,7 +672,7 @@ npx @logicsrc/validators openerrand ftb-register-business.json
|
|||
|
||||
| Version | Date | Change |
|
||||
| --- | --- | --- |
|
||||
| 0.1 | 2026-10-04 | First publication: the errand file, inputs with three sensitivity classes and seven sources, field rules matched by id then label, page and wait steps, five human gates (`declare`, `identity-proofing`, `code`, `mail`, `captcha`), outcomes, the never-retry rule for shared secrets, vault and download outputs, hand-off cards with no personal data, the publisher index at `/.well-known/openerrand.json`, thirteen runner rules, and the MyFTB business registration as the worked example. |
|
||||
| 0.1 | 2026-10-04 | First publication: the errand file, inputs with three sensitivity classes and seven sources, field rules matched by id then label, page and wait steps, five human gates (`declare`, `identity-proofing`, `code`, `mail`, `captcha`), outcomes, the never-retry rule for shared secrets, vault and download outputs, hand-off cards with no personal data, the publisher index at `/.well-known/openerrand.json`, thirteen runner rules (among them: a normal browser user agent and nothing more), the captcha solver policy keyed on `site.sector`, and the MyFTB business registration as the worked example. |
|
||||
|
||||
## License
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
"principal": "self",
|
||||
"site": {
|
||||
"name": "California Franchise Tax Board (MyFTB)",
|
||||
"sector": "tax",
|
||||
"origins": ["https://webapp.ftb.ca.gov"],
|
||||
"start": ["https://webapp.ftb.ca.gov/MyFTBAccess/Registration/NewAccount"]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
"required": ["name", "origins", "start"],
|
||||
"properties": {
|
||||
"name": { "type": "string", "minLength": 1 },
|
||||
"sector": { "enum": ["government", "tax", "financial", "healthcare", "identity-provider", "commercial", "other"] },
|
||||
"origins": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/$defs/origin" } },
|
||||
"start": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/httpsUrl" } },
|
||||
"terms": { "$ref": "#/$defs/httpsUrl" }
|
||||
|
|
@ -397,6 +398,7 @@
|
|||
"id": { "$ref": "#/$defs/slug" },
|
||||
"kind": { "const": "captcha" },
|
||||
"match": { "$ref": "#/$defs/match" },
|
||||
"solver": { "enum": ["forbidden", "allowed"] },
|
||||
"timeout": { "$ref": "#/$defs/duration" },
|
||||
"why": { "type": "string" },
|
||||
"say": { "type": "string" }
|
||||
|
|
|
|||
|
|
@ -65,6 +65,35 @@ describe("OpenErrand", () => {
|
|||
errorAt(f, keyword, path);
|
||||
});
|
||||
|
||||
const commercial = () => ({
|
||||
...JSON.parse(blocks[0]!),
|
||||
site: { name: "Example", sector: "commercial", origins: ["https://example.com"], start: ["https://example.com/contact"] },
|
||||
steps: [{ id: "form", kind: "page" }, { id: "robot-check", kind: "captcha", match: { selector: "iframe[src*=captcha]" }, solver: "allowed" }]
|
||||
});
|
||||
|
||||
it("allows a declared captcha solver on a commercial errand with nothing sensitive", () => {
|
||||
expect(validate("openerrand", commercial())).toMatchObject({ ok: true });
|
||||
});
|
||||
|
||||
it.each([
|
||||
["a solver on a tax site", (f: any) => { f.steps.push({ id: "robot-check", kind: "captcha", match: { selector: "iframe" }, solver: "allowed" }); }, "/steps/5/solver"],
|
||||
["a solver on an errand that does not state its sector", (f: any) => { f.steps.push({ id: "robot-check", kind: "captcha", match: { selector: "iframe" }, solver: "allowed" }); delete f.site.sector; }, "/steps/5/solver"]
|
||||
])("rejects %s", (_, mutate, path) => {
|
||||
const f = fixture();
|
||||
mutate(f);
|
||||
errorAt(f, "captchaSolver", path);
|
||||
});
|
||||
|
||||
it.each([
|
||||
["a secret input", (f: any) => { f.inputs = { password: { type: "string", sensitivity: "secret", sources: [{ from: "prompt" }] } }; }],
|
||||
["a declare step", (f: any) => { f.steps.push({ id: "attest", kind: "declare", statement: "i declare", why: "Yours to say." }); }],
|
||||
["a government site", (f: any) => { f.site.sector = "government"; }]
|
||||
])("rejects a captcha solver on a commercial errand with %s", (_, mutate) => {
|
||||
const f = commercial();
|
||||
mutate(f);
|
||||
errorAt(f, "captchaSolver", "/steps/1/solver");
|
||||
});
|
||||
|
||||
it("allows public inputs and built-ins on a card", () => {
|
||||
const f = fixture();
|
||||
f.handoffs["pin-letter"].steps.push("Corporation {{corp_id}} at {{site.name}}: {{errand.title}}");
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@ type Source = { from: string; input?: string };
|
|||
type Input = { type: string; sensitivity: "public" | "personal" | "secret"; role?: string; sources: Source[] };
|
||||
type Action = { text?: string; gate?: string; choose?: string; answer?: string };
|
||||
type Rule = { do: Action };
|
||||
type Step = { id: string; kind: string; rules?: Rule[]; handoff?: string; resume?: string };
|
||||
type Step = { id: string; kind: string; rules?: Rule[]; handoff?: string; resume?: string; solver?: string };
|
||||
type Errand = {
|
||||
site: { sector?: string };
|
||||
inputs?: Record<string, Input>;
|
||||
rules?: Rule[];
|
||||
steps: Step[];
|
||||
|
|
@ -22,6 +23,9 @@ type Errand = {
|
|||
/** Step kinds a runner must hand to a person. */
|
||||
export const GATE_KINDS = ["declare", "identity-proofing", "code", "mail", "captcha"] as const;
|
||||
|
||||
/** Sectors where a captcha solver is never allowed. */
|
||||
export const NO_SOLVER_SECTORS = ["government", "tax", "financial", "healthcare", "identity-provider"] as const;
|
||||
|
||||
/** Names a hand-off card may use: none of them is a person's data. */
|
||||
export const HANDOFF_BUILTINS = ["expires_on", "errand.title", "site.name"] as const;
|
||||
|
||||
|
|
@ -118,6 +122,21 @@ export function validateOpenErrandReferences(data: unknown): ErrorObject[] {
|
|||
checkTemplate(download.to, `/outputs/downloads/${i}/to`);
|
||||
});
|
||||
|
||||
// A captcha solver is allowed only where nothing sensitive is at stake: a
|
||||
// stated sector outside the forbidden set, no attestation, no identity
|
||||
// proofing and no secret input.
|
||||
const sensitive =
|
||||
errand.steps.some((step) => step.kind === "declare" || step.kind === "identity-proofing") ||
|
||||
Object.values(inputs).some((input) => input.sensitivity === "secret");
|
||||
const sector = errand.site?.sector;
|
||||
errand.steps.forEach((step, i) => {
|
||||
if (step.kind !== "captcha" || step.solver !== "allowed") return;
|
||||
const path = `/steps/${i}/solver`;
|
||||
if (!sector) report("captchaSolver", path, "an errand that allows a captcha solver states its site.sector");
|
||||
else if ((NO_SOLVER_SECTORS as readonly string[]).includes(sector)) report("captchaSolver", path, `a captcha solver is never allowed on a ${sector} site`);
|
||||
if (sensitive) report("captchaSolver", path, "a captcha solver is never allowed on an errand with a declare or identity-proofing step or a secret input");
|
||||
});
|
||||
|
||||
// A hand-off card is shared on purpose: it may name built-ins and public
|
||||
// inputs, and nothing a person would not post on a fridge.
|
||||
for (const [id, card] of Object.entries(handoffs)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue