Annie Voigt
fix(uploads): scan before parse; drop ungated URL/HF originals (ADR-0011)
ae6bd97
Raw
History Blame Contribute Delete
2.03 kB
"""Safety gate for manual dataset uploads (ADR-0011).
Public, non-agent-facing API. An upload is quarantined-until-validated and never
executable, routed through the same manifest/validation machinery a registered
dataset passes, plus an admin approval:
draft_manifest(path) → pre-fill a manifest skeleton from the file (friction aid)
stage_upload(...) → quarantine + type/size/manifest/attestation gate
scan_upload(rec) → content scan (magic-byte; AV only where declared)
validate_upload(rec) → content scan (if not yet run) + manifest/against-data
register_upload(rec) → admin-only promotion into the live registry
Only admins (UPLOAD_ADMIN_IDS) can register; researchers may stage + validate.
"""
from src.uploads.drafting import DraftResult, draft_manifest
from src.uploads.posture import (
POSTURE_AV_REQUIRED,
POSTURE_STRUCTURAL_ONLY,
av_required,
declared_posture,
)
from src.uploads.promotion import RegistrationRefused, register_upload
from src.uploads.records import (
STATUS_QUARANTINED,
STATUS_REGISTERED,
STATUS_REJECTED,
STATUS_VALIDATED,
UploadRecord,
is_admin,
)
from src.uploads.scanning import (
SCAN_CLEAN,
SCAN_INFECTED,
SCAN_SKIPPED,
scan_upload,
)
from src.uploads.staging import (
UploadRejected,
attach_manifest,
discard_upload,
placeholder_manifest,
stage_upload,
)
from src.uploads.validation import validate_upload
__all__ = [
"draft_manifest",
"DraftResult",
"stage_upload",
"attach_manifest",
"discard_upload",
"placeholder_manifest",
"scan_upload",
"validate_upload",
"register_upload",
"UploadRecord",
"UploadRejected",
"RegistrationRefused",
"is_admin",
"SCAN_CLEAN",
"SCAN_INFECTED",
"SCAN_SKIPPED",
"POSTURE_STRUCTURAL_ONLY",
"POSTURE_AV_REQUIRED",
"declared_posture",
"av_required",
"STATUS_REJECTED",
"STATUS_QUARANTINED",
"STATUS_VALIDATED",
"STATUS_REGISTERED",
]