Skip to content

Security hardening: sync app#1509

Open
davmlaw wants to merge 1 commit intomasterfrom
security/issue-3831
Open

Security hardening: sync app#1509
davmlaw wants to merge 1 commit intomasterfrom
security/issue-3831

Conversation

@davmlaw
Copy link
Copy Markdown
Contributor

@davmlaw davmlaw commented Apr 2, 2026

Summary

Addresses issues raised in SACGF/variantgrid_private#3831 (security audit of the sync/ app).

  • library/oauth.py — Validate URL scheme is http(s) and use urljoin instead of string concatenation in ServerAuth.url()
  • sync/models/models_classification_sync.py — Validate remote_pk is a safe identifier; use urljoin instead of os.path.join for URL construction
  • sync/shariant/variant_grid_download.py — Validate exclude_labs/exclude_orgs config values are safe identifiers; validate lab_group_name format and lab_name length before auto-creating Lab/Org records
  • sync/alissa/alissa_upload.py — Safe int() conversion for API response counts; narrow except Exception to (ValueError, AttributeError); store only sanitized count summaries in SyncRun.meta rather than full raw API responses
  • sync/shariant/query_json_filter.py — Validate filter keys against safe identifier pattern to prevent ORM field traversal
  • sync/sync_runner.py — Remove SyncDestination.config dump (which may contain credentials) from error message

Test plan

  • Run existing sync-related tests: python3 manage.py test --keepdb sync
  • Manually verify a Shariant download sync still completes successfully
  • Verify Alissa upload sync handles a normal response correctly
  • Confirm that a SyncDestination with an unsupported config type raises a ValueError with just the destination name (no config dump)

- oauth.py: validate URL scheme and use urljoin instead of string concat
- models_classification_sync.py: validate remote_pk, use urljoin for URL construction
- variant_grid_download.py: validate exclude_labs/orgs values and lab_group_name format before creating Lab/Org records
- alissa_upload.py: safe int conversion for response counts, narrow except clause, store only sanitized response summaries in SyncRun.meta
- query_json_filter.py: validate filter keys against safe identifier pattern
- sync_runner.py: remove config dump (including credentials) from error message
@davmlaw davmlaw force-pushed the security/issue-3831 branch from f0fd22f to 53648bd Compare April 2, 2026 00:25
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