policy.lookup_unchecked
An action looks a person up by email with no permission check of its own before it: it isn't listed under actions:, its line names Access.public, or its line can't be checked before the lookup.
Area 9, Policy; not declinable; the next step is usually the human's.
Why Jadpo refuses it
<Entity>.lookup(email: address) finds a person whoever may read their
record, and whether it finds one tells the caller whether the address
has an account. So it runs only behind its action's own line under root
policy { actions: }, which says who may look people up, checked as the
action starts:
- anyone signed in, or a role held across the whole application;
- or a role held in a record, such as
WorkspaceRole.owner, checked in the record whoseidthe action is given as its one parameter of that type.
An action that isn't listed, a line naming Access.public, and a line
naming only who a record the action hasn't found yet decides, such as
Todo.owner_id, leave nothing to check before the lookup.
What it looks like
main.jadpo:
principal { user: { subject: Member.handle }}authentication { api_token: {}}type Handle = Text { max_length: 40}type AddressStanding = Enum { account_held no_account}entity Member { id: Uuid handle: Handle { unique: true } email: Email { unique: true } policy: { create: [Access.public] read: [id] }}/// Whether an address has an account.action has_account(email: Member.email) -> AddressStanding { match Member.lookup(email: email) { none -> { return AddressStanding.no_account } some -> { return AddressStanding.account_held } }}
error has_account looks a Member up by email with no permission check before it
--> main.jadpo:37:11
|37 | match Member.lookup(email: email) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ no permission check of its own
- reason
Member.lookupfinds a person by their exact address whoever may readMember, so it runs only behind its action's own line under rootpolicy { actions: }, which says who may look people up.has_accountisn't listed.- next
- List
has_accountunderpolicy { actions: }with who may look people up, such as[<Role>.owner](human) - rule
- policy.
lookup_ unchecked - help
- https://jadpo.
dev/docs/errors/policy. lookup_ unchecked
(human) at the end of the next: line tells your coding agent to stop
and ask you which fix you want, because the choice is yours to make: it
decides who may learn whether an address has an account.
How to fix it
If anyone signed in may look people up, list the action for them:
policy { actions: { has_account: [Access.authenticated] }}
Only someone signed in now reaches the lookup.
Related
Markdown for agents: /docs/errors/policy.lookup_unchecked.md.Built from Jadpo's main branch at commit 9080dc3.