fix: address track1-worker-compromise verify findings

- restore a verified row by fact: three variants give ready, otherwise
  failed with a known code instead of ready without content
- check trigger functions are not SECURITY DEFINER and pin search_path
- record the working stand comparison, the permanent drill lock file and
  the remaining SeaweedFS details

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-02 05:50:36 +03:00
co-authored by Claude Opus 5.5
parent 55959e3805
commit 5a9721876e
15 changed files with 299 additions and 56 deletions
+18 -23
View File
@@ -14,18 +14,11 @@ from incident_rows import (
VARIANTS,
add_attachment,
add_world,
connect_as,
variant_key,
)
from conftest import (
ROLE_PASSWORDS,
TEST_DB,
admin,
run_alembic,
settings,
truncate_all,
)
from src.infra.tls import build_client_context
from conftest import TEST_DB, admin, run_alembic, truncate_all
pytestmark = pytest.mark.anyio
@@ -42,22 +35,9 @@ async def connection() -> AsyncIterator[asyncpg.Connection]:
await truncate_all()
async def _as(role: str) -> asyncpg.Connection:
source = settings.database
return await asyncpg.connect(
host=source.host,
port=source.port,
user=role,
password=ROLE_PASSWORDS[role],
database=TEST_DB,
timeout=source.connect_timeout_seconds,
ssl=build_client_context(settings.client_tls.ca_file),
)
async def _execute(role: str, statement: str, *args: object) -> str:
"""Выражение роли в своей транзакции: `ok` или SQLSTATE."""
opened = await _as(role)
opened = await connect_as(role)
try:
try:
await opened.execute(statement, *args)
@@ -294,6 +274,21 @@ async def test_revision_on_filled_database(
"attachment_variants_key_namespace",
"attachments_accepted_not_pending",
]
# функции исполняет роль процесса: права вызывающего и свой search_path
# (verify W4)
functions = await connection.fetch(
"SELECT proname, prosecdef, proconfig FROM pg_proc WHERE proname IN "
"('attachment_accepted_not_pending', "
"'attachment_variant_key_namespace') ORDER BY 1",
)
assert [tuple(item) for item in functions] == [
("attachment_accepted_not_pending", False, ["search_path=pg_catalog"]),
(
"attachment_variant_key_namespace",
False,
["search_path=pg_catalog"],
),
]
async def test_interrupted_revision_repeats(