Skip to content

fix(analysis): reject submissions without an application handle - #705

Open
Manny7717 wants to merge 1 commit into
Exodus-Privacy:v1from
Manny7717:fix/analysis-handle-validation
Open

fix(analysis): reject submissions without an application handle#705
Manny7717 wants to merge 1 commit into
Exodus-Privacy:v1from
Manny7717:fix/analysis-handle-validation

Conversation

@Manny7717

Copy link
Copy Markdown

What

Submitting an analysis with an empty handle was accepted by the backend: the handle field is blank=True (needed for APK uploads), and Django's run_validators skips model validators for empty values of blank fields. The only guard was a client-side HTML check that can be bypassed (see #296 / #297).

Change

AnalysisRequestForm.clean() now rejects an empty handle with a field error. The APK upload path (UploadRequestForm) is unchanged.

Tests

  • New AnalysisRequestFormTests: empty handle → form invalid with error on handle; valid handle (store lookup mocked) → valid.
  • Verified the bug live first: AnalysisRequestForm({'handle': '', 'source': 'google'}).is_valid() returned True before the fix.
  • Full suite → 69/69 OK; flake8 clean.

The handle field is blank=True (required for APK uploads), which makes
Django skip its model validators for empty values. As a result an
analysis could be submitted without a handle, and only a bypassable
HTML check kept it from happening (see Exodus-Privacy#296/Exodus-Privacy#297). Add explicit
form-level validation: the analysis form now requires a handle, while
the APK upload form is unaffected. Closes Exodus-Privacy#297
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