hub: small copies in routes: If-None-Match matching (nine copies), owns-this-agent (six), projects._apply_policy int checks and row re-read
tsk-63b6qqk1q9vb Proposed
Audit round 6 (tsk-hgnbapyw7hnh), read at 046a4d3b. Kind: duplication.
What is wrong
- If-None-Match matching:
routes/contract_text._matches(:77-82) androutes/keep_the_why._matches(:189-194) are identical;routes/project_images._matches(:27-32) is imported privately by attachments and avatars; inline atroutes/pages.py:191-192,routes/badges.py:59,public_pages.py:231,:265,:387,landing_files.py:143. - "The caller owns this agent profile":
routes/joins._owns(:500) and the owned query injoins._agent_for_join(:1046-1050),instances.owns_agent(instances.py:840),jourfixe/circle._owns(:82),routes/members._owner_from_outside(about:365-376) and_owns_outside(about:707), which differ only by a bridge check that cannot apply to a human caller. routes/projects._apply_policy: the same "int, not bool, in range" check three times (own_approvals,outside_claims_max,outside_claim_requests_open_max); theown_agentsbranch reads the project row again although it was just read (needs_rowleavesown_agentsout).
Proposal
http.etag_matches(header, etag),agent_owners.owns(conn, human_id, agent_id), an_int_in(value, low, high)helper, andown_agentsinneeds_row.
Effort / risk: S. Low.