- Remove the watermark feature end to end (watermarked.py, apply_watermark/ mark_delivery/watermark_filter, WATERMARK env, assets/) and its tests; self-host delivery is now unconditionally clean. - Delete the unused cli/ package and .github/workflows/publish-cli.yml. - Delete docs/ (compliance) and design.md; drop the dangling references in the legal page and the design-token/ui comments. - Consolidate requirements: requirements.txt (runtime) + requirements-test.txt (unit + E2E); remove requirements-e2e.txt and requirements-ml-e2e.txt and point both CI jobs at the single test file. Add libgl1 to the unit job (scenedetect -> opencv-python links libGL). Verified in the CI container: unit 701 passed; API E2E 209; pipeline E2E 127; Playwright 19 passed / 1 skipped.
53 lines
2.1 KiB
Python
53 lines
2.1 KiB
Python
"""/videos must hand out deliverables, not the whole working directory.
|
|
|
|
The mount was a plain StaticFiles over OUTPUT_DIR, so anyone holding a job id
|
|
(it travels in every clip URL) could also fetch `.owner` (a user uuid),
|
|
`.resume.json` (the customer's own webhook_secret), `.transcript_checkpoint.json`
|
|
and `<title>_metadata.json`, which carries the full transcript of their video.
|
|
All four were verified served, unauthenticated, against production on
|
|
7-sep-2026. media_auth shipped the allowlist in 96f0139 but nothing imported it.
|
|
|
|
This is the path half only: the clips and the untouched source video in the
|
|
same directory are still public to whoever has the job id.
|
|
"""
|
|
import pytest
|
|
|
|
media_auth = pytest.importorskip("clipwright.api.media_auth")
|
|
restoring_static = pytest.importorskip("clipwright.api.restoring_static")
|
|
|
|
|
|
class TestTheGuardIsWiredIn:
|
|
def test_the_videos_mount_carries_the_allowlist(self):
|
|
app = pytest.importorskip("clipwright.api.app")
|
|
mount = next(r for r in app.app.routes
|
|
if getattr(r, "name", None) == "videos")
|
|
# app._media_guard wraps the allowlist (media_auth.is_servable).
|
|
assert mount.app.guard is app._media_guard, \
|
|
"/videos is serving the working directory with no allowlist"
|
|
assert not app._media_guard("job/.resume.json")
|
|
assert not app._media_guard("job/x_metadata.json")
|
|
assert app._media_guard("job/x_clip_1.mp4")
|
|
|
|
|
|
class TestWhatMayLeave:
|
|
@pytest.mark.parametrize("rel", [
|
|
"job/clip_1.mp4", "job/subtitled_1_clip_1.mp4", "job/a.webm",
|
|
"job/autosubs_1.ass", "job/subs.srt", "job/thumb.jpg", "job/clips.zip",
|
|
])
|
|
def test_deliverables_pass(self, rel):
|
|
assert media_auth.is_servable(rel)
|
|
|
|
@pytest.mark.parametrize("rel", [
|
|
"job/.owner",
|
|
"job/.resume.json",
|
|
"job/.transcript_checkpoint.json",
|
|
"job/My_Video_metadata.json",
|
|
"job/clip_1.mp4.layout.json",
|
|
"job/.instance",
|
|
"../app.py",
|
|
"job/../../app.py",
|
|
"/etc/passwd",
|
|
"",
|
|
])
|
|
def test_everything_else_is_refused(self, rel):
|
|
assert not media_auth.is_servable(rel)
|