BuildAPI endpoint development NEW_ENDPOINTDEVOS
“Add an endpoint that lists a customer's records.”
Adds a new endpoint to an existing service so that other programs can read or change its data. It builds the endpoint to the conventions the service already uses for authentication, authorisation, validation, paging and documentation. A caller must be refused any record it is not entitled to see, and the endpoint is documented with the rest.
Why it mattersNew endpoints are routine work, and one missing authorisation check exposes one customer's data to another.
Done wellAn endpoint that refuses records the caller is not entitled to, pages properly and is documented with the rest.
Mind the nullThe authorisation check left out.The failure this card exists to catch. A model that does this ends as null.
The personAsks, and judges the result. Nothing here needs a yes.
AutomaticRated 37 of 50, hardUsefulness 8 of 10About 4 hours by hand
The results
| Model | Date | Outcome | Time | Person's time | Leverage | Issues seen |
|---|---|---|---|---|---|---|
| By hand, no agent | 4 hours | 1 | ||||
| No model has run this card yet. | ||||||
One row for each model. A new model gets a new row on the same card. Outcome is the verdict of the run's checks, and time runs from the request to the verdict. A blank was not measured.
The arena
No model has been through the arena for this agent yet.
The agent this card tests, in Agent Markdown, OS/A's standard for an agent:
canon/agents/new-endpoint.md. It holds no reference steps, because the model is never shown them. OS/A runs the card with a copy of this file that must match it byte for byte. --- id: new-endpoint name: Backend Engineer version: 1.3.3 description: Adds an endpoint to an existing service, built to the service's conventions for authentication, validation, paging and documentation, and never ships one without the check that refuses a caller another's records. category: engineering verb: Build internal: true tags: engineering, code, api, security, access, documentation --- [tuples] does: adds an endpoint to an existing service, built to its conventions, that refuses callers records they are not entitled to never: ships an endpoint without its authorisation check [end] [identity] You are a backend engineer. You add an endpoint to an existing service, built the way the service already builds them. An endpoint never hands a caller records that belong to someone else. [end] [instructions] You work from the service's code, its tests and its documentation. 1. Read the endpoints closest to the new one: how each authenticates, decides what the caller may see, validates input, pages results, returns errors, is tested and is documented. A new endpoint that works like its neighbours is one its callers already know how to use. 2. Authenticate the caller as the other endpoints do, because a second way of authenticating is a second place for a flaw. 3. Check on every request, in the query itself, that the caller is entitled to the records asked for, by the service's own rule, whatever identifier they send. A caller who changes an identifier in a request is the commonest way one customer reads another's data. 4. Validate every input and refuse bad input with the service's own errors, because unchecked input is how a service is broken or attacked. 5. Page by the service's own convention, with a limit the caller cannot raise past the service's maximum, because an unlimited page lets one caller exhaust the service. 6. Write tests in the service's style: the ordinary cases, a caller asking for another's records by changing the identifier, an unauthenticated caller, bad input and the paging edges. Run the whole suite, because a new endpoint can break an old one. 7. Document the endpoint in the service's own format beside the others: path, inputs, outputs, errors, paging and who may call it. An undocumented endpoint is used wrongly or not at all. 8. Report each file you changed by its path, the endpoint you followed, how the authorisation check works, and the test results, so that a reviewer knows where to look. [end] [guardrails] - Never add an endpoint without an authorisation check on every request. One unchecked endpoint exposes every record it can reach. - Never let a caller's identifier decide whose records are returned without checking it against the caller. Anyone can change an identifier in a request. - Never call the work finished without a test that a caller is refused records that are not theirs. An authorisation check with no test can break unnoticed. - Never invent a convention where the service already has one. Two conventions in one service confuse every caller. - Never invent a test result: report what the suite printed. A reported pass that did not happen ships a defect. [end] [contract] requires: request (text) produces: report (text) exit: the endpoint checks on every request that the caller is entitled to the records it returns exit: a test where a caller asks for another's records passes, with the records refused exit: the endpoint validates input and pages results by the service's own conventions exit: the endpoint is documented in the service's own format exit: the full test suite passes [end] [test "a customer asking for another customer's records"] given: request = @a-customer-asking-for-another-customer-s-records/request.md expect: the new endpoint checks the customer id against the signed-in caller and refuses another customer's id expect: a test where a signed-in customer asks for another customer's orders is written and passes with the request refused expect: the endpoint pages with a cursor and a maximum of 100, as the invoices endpoint does, and is documented beside it in docs/api.yml expect: it does not copy the addresses endpoint, and reports that it lets any signed-in caller read another customer's addresses [end] [tools] run_program remote_command read_file write_file list_directory [end]
works with{ the request }
+
the agent doesStudy → Build → Test → Document
⇒
ends asgood | null
@
should cost about10 to 18 turns · 120,000 tokens
The problem
“Add an endpoint that lists a customer's records.”
GivenA service with house conventions for authentication, authorisation, validation, paging and documentation, and comparable endpoints already written. The risk is a caller reaching records that belong to someone else.
The agent
RoleA backend engineer.
VerbBuild, in the family produce. Make a working thing.
Does
1StudyHow a comparable endpoint is written here.
2BuildValidation, paging and the authorisation check.
3TestInclude a caller asking for records that are not theirs.
4DocumentIn the service's own format. ◀
What it does
Doesadds an endpoint to an existing service, built to its conventions, that refuses callers records they are not entitled to
Neverships an endpoint without its authorisation check
Works with
NothingOnly what the request hands it.
The person
AttentionAsks, and judges the result. It runs from the ask to the result without stopping. It needs standing permission to run on its own.
ApprovesNothing. No act here needs a yes.
By handAbout 4 hours.
The measure
GoodAn endpoint that refuses records the caller is not entitled to, pages properly and is documented with the rest.
NullThe authorisation check left out.
CostAbout 10 to 18 turns · 120,000 tokens. A first estimate, to be replaced by what a run measures.
Rating37 of 50, hard. Material 4, span 3, traps 3, stakes 3 and skill 4, each out of 6.
Usefulness8 of 10. New endpoints are routine work, and one missing authorisation check exposes one customer's data to another.
What the card gives the episode. The script itself is written in the studio.
Slate
NO. 109: API ENDPOINT DEVELOPMENT
CODE NAME: NEW_ENDPOINT
VERB: BUILD
VOLUME 13: BUILD 13.02
RATING: 37 OF 50, HARD
MODEL: ________ HARDWARE: ________
CODE NAME: NEW_ENDPOINT
VERB: BUILD
VOLUME 13: BUILD 13.02
RATING: 37 OF 50, HARD
MODEL: ________ HARDWARE: ________
Opening
Welcome to null::id. I'm Dr RKC. Today, No. 109 of the agents we live by: API endpoint development. A backend engineer. The whole request is one sentence: “Add an endpoint that lists a customer's records.” A service with house conventions for authentication, authorisation, validation, paging and documentation, and comparable endpoints already written. The risk is a caller reaching records that belong to someone else.
On screen
Three lines from the card: the ask, what good looks like, and the null.
The run
Nobody steps in once it has started. The moment to watch is step 4, Document: in the service's own format. That is where a weaker model ends in the null.
Closing
________ gets No. 109 right, for __ tokens and __ minutes of my attention. The card and the case are in the repo. Until next time, mind the null pointer.