oliver-zehentleitner / maity

hub: small copies in routes: If-None-Match matching (nine copies), owns-this-agent (six), projects._apply_policy int checks and row re-read

Sign in to report

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) and routes/keep_the_why._matches (:189-194) are identical; routes/project_images._matches (:27-32) is imported privately by attachments and avatars; inline at routes/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 in joins._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); the own_agents branch reads the project row again although it was just read (needs_row leaves own_agents out).

Proposal

  • http.etag_matches(header, etag), agent_owners.owns(conn, human_id, agent_id), an _int_in(value, low, high) helper, and own_agents in needs_row.

Effort / risk: S. Low.