Skip to content

Security hardening for upload app#1511

Open
davmlaw wants to merge 1 commit intomasterfrom
upload-security-3825
Open

Security hardening for upload app#1511
davmlaw wants to merge 1 commit intomasterfrom
upload-security-3825

Conversation

@davmlaw
Copy link
Copy Markdown
Contributor

@davmlaw davmlaw commented Apr 2, 2026

Summary

  • Replace exec(f"import {i}") with importlib.import_module(i) in import_task_factory.py
  • Pass VCF split paths via environment variables (VG_HEADER_FILE/VG_SPLIT_VCF_DIR) instead of f-string interpolation into the split --filter shell string, eliminating any risk of shell metacharacters in paths being misinterpreted
  • Return a generic error message to the client on upload failure (instead of str(e), which could leak internal paths/tracebacks)
  • Replace bare except: with except Exception: in upload/views/views.py

Addresses findings from the upload app security audit: SACGF/variantgrid_private#3825

Test plan

  • Upload a VCF file and verify it imports correctly (exercises the split --filter env-var path)
  • Verify a failed upload returns a generic error message in the browser, not an exception string
  • Verify get_import_task_factories() still returns the expected factories

🤖 Generated with Claude Code

- Replace exec(f"import {i}") with importlib.import_module(i) in import_task_factory.py
- Pass VCF split paths via environment variables (VG_HEADER_FILE/VG_SPLIT_VCF_DIR) instead
  of f-string interpolation into the shell --filter argument, so metacharacters in paths
  cannot be misinterpreted by the shell
- Return a generic error message to the client on upload failure instead of str(e)
- Replace bare except: with except Exception: in upload/views/views.py
@davmlaw davmlaw force-pushed the upload-security-3825 branch from cf9145b to c0c8cd2 Compare April 2, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant