fix: address rotation-revocation re-verify findings

Name only the repeat of rotate_secret while sessions of the previous
PostgreSQL password may stay open, compare KV version time with the
container start when the load record is gone, refuse run_docker and
rolling_update next to a running rotation, defer SIGQUIT, and name the
remaining windows and cases in the trust matrix and threat model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 12:40:25 +03:00
co-authored by Claude Opus 5.5
parent 6b637109de
commit d4a882ddd6
32 changed files with 1371 additions and 215 deletions
+17 -8
View File
@@ -11,11 +11,11 @@ rotation-revocation, design, «Уточнения verify»; правило
контейнер, после переезда тега по имени и digest недоступен («No such image»),
поэтому сравнивается то, что есть у контейнера:
- файлы корневой файловой системы целиком — путь, вид, права, владелец,
содержимое (`docker export`): у реплики корень только на чтение, он равен
образу. Контейнер тега только создаётся (`docker create`), не запускается,
и удаляется. Точки монтирования и файлы, которые Docker кладёт сам, — не в
счёт;
- файлы и каталоги корневой файловой системы целиком — путь, вид, права,
владелец, содержимое, file capabilities (`docker export`): у реплики корень
только на чтение, он равен образу. Контейнер тега только создаётся (`docker
create`), не запускается, и удаляется. Точки монтирования, каталоги на пути
к ним и файлы, которые Docker кладёт сам, — не в счёт;
- Config: пользователь, команда, точка входа, каталог, порты, тома,
healthcheck, сигнал остановки и окружение, кроме переменных, заданных в
compose.
@@ -53,6 +53,8 @@ DOCKER_FILES = (
"etc/resolv.conf",
)
DOCKER_DIRS = ("dev", "proc", "sys")
# file capabilities в архиве docker export
CAPABILITIES = "SCHILY.xattr.security.capability"
class Unknown(Exception):
@@ -89,13 +91,19 @@ def skipped(name: str, places: list[str]) -> bool:
)
def on_the_way(name: str, places: list[str]) -> bool:
"""Каталог на пути к точке монтирования: его мог создать runtime."""
return any(place.startswith(name + "/") for place in places)
def tree(stream: tarfile.TarFile, places: list[str]) -> dict[str, tuple]:
"""Файлы и ссылки архива: каталоги не в счёт (точки монтирования создаёт
runtime)."""
"""Файлы, ссылки и каталоги архива."""
found: dict[str, tuple] = {}
for item in stream:
name = item.name[2:] if item.name.startswith("./") else item.name
if item.isdir() or skipped(name, places):
if skipped(name, places):
continue
if item.isdir() and on_the_way(name, places):
continue
digest = ""
body = stream.extractfile(item) if item.isreg() else None
@@ -108,6 +116,7 @@ def tree(stream: tarfile.TarFile, places: list[str]) -> dict[str, tuple]:
item.gid,
item.linkname,
digest,
item.pax_headers.get(CAPABILITIES, ""),
)
return found