File Upload Contract Repair

    by Mariusz Wrzeszczynski

    1

    Repair file-upload drift across validation, object keys, authorization, quarantine, scanning, finalization, retries, downloads, cleanup, tests, and docs.

    Secure checkout via Stripe

    0 installsSecurity scanned

    Works with the AI tools you already use

    CClaude CodeCCursorCCodex CLIGGitHub CopilotGGemini CLIVVS CodeWWindsurfMManus+14 more

    See it in action

    You say

    Repair the file upload lifecycle in our Django app. We currently trust browser MIME types, use filenames as keys, and files are available before the Celery scan task finishes.

    Your agent does

    I have mapped your upload drift. I will now add an 'uploaded_pending_verification' state to the File model, implement opaque key generation in the storage adapter, and update the scan callback to use atomic versioned updates. Safe local patches and dry-run cleanup tests are ready for review.

    What you get

    Standardize upload session identity across heterogeneous API routes.Enforce atomic lifecycle transitions from upload to publication.Prevent unauthorized downloads of quarantined or superseded objects.Identify and report orphaned storage objects through dry-run cleanup.

    About this skill

    The problem

    File upload logic often drifts across routes, storage adapters, and background workers, leading to insecure behaviors like trusting client-side MIME types or using sensitive filenames as storage keys. These inconsistencies create race conditions in scan callbacks, orphaned objects, and unauthorized access to quarantined files.

    What it does

    • Generates opaque, server-controlled object keys to prevent path collisions and metadata leaks.
    • Implements atomic, idempotent finalization for direct and multipart uploads to stop duplicate row creation.
    • Introduces typed lifecycle states including quarantine, ready, and superseded to gate downloads and derivative processing.
    • Verifies final stored object size and integrity against the original session contract.
    • Standardizes versioned callback handling to prevent stale scan results from overwriting newer file states.

    Frameworks & tools

    Works with repository patterns using S3-compatible storage, Node.js, Python/Django, PostgreSQL, and background workers like BullMQ or Celery.

    Why this beats prompting it yourself

    This skill handles the complex state transitions between storage adapters, database models, and async workers that a simple prompt misses. It builds a deterministic local test matrix to verify edge cases like cross-session part reuse and cleanup races without touching production data.

    Use cases

    • Repairing inconsistent file type validation across multiple API endpoints.
    • Fixing race conditions where files become downloadable before malware scanning finishes.
    • Transitioning from filename-based storage to opaque internal identities.
    • Standardizing cleanup jobs to safely identify orphaned multipart uploads.

    Known limitations

    Cannot access live storage, inspect customer files, or perform production migrations. Local verification relies on the repository's existing fake storage or mocks.

    How to install

    Drop the file into your AI Agent. Works with Claude, Cursor, ChatGPT, and 20+ more.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean today

    Listedtoday

    Creator

    Mariusz Wrzeszczynski
    Mariusz Wrzeszczynski

    109 skills on Agensi

    Frequently Asked Questions

    Popular in AI Agents & LLM Ops