test(fence): owner filters in any form, statement writes under any name, core commits by list

The owner-filter check missed an aliased() model, an import alias, .in_() and
filter_by; four live inline filters on aliased VideoState go through owned_by now.
Cross-unit writes are seen under any import name, through sa.update and via
__table__. Core modules may commit only where CORE_COMMITS names the reason;
trim_read and audit.gc flush now and their callers commit. The pin target, the
debug-session header and a link's target fetch through owned_row. The docs
claim what the fence holds, and say what is beyond it.
This commit is contained in:
2026-10-20 00:45:21 +02:00
parent e27656ee7e
commit 8206384c91
13 changed files with 215 additions and 90 deletions
+3 -5
View File
@@ -296,13 +296,11 @@ def own_link(db: Session, user: User, link_id: int) -> DownloadLink | None:
if link is None:
return None
target = (
db.get(DownloadJob, link.job_id)
owned_row(db, DownloadJob, link.job_id, user)
if link.job_id is not None
else db.get(FileFolder, link.folder_id)
else owned_row(db, FileFolder, link.folder_id, user)
)
if target is None or target.user_id != user.id:
return None
return link
return link if target is not None else None
def links_to(