Skip to content

Validate submission URLs before generating forms - #883

Open
the8thbit wants to merge 1 commit into
XLSForm:masterfrom
the8thbit:fix-submission-url-809
Open

the8thbit wants to merge 1 commit into
XLSForm:masterfrom
the8thbit:fix-submission-url-809

Conversation

@the8thbit

Copy link
Copy Markdown

Closes #809

Collect refuses to download a form with an invalid submission URL. Detect malformed addresses while generating the form so authors can correct them before deployment.

Why is this the best possible solution? Were any other approaches considered?

Validate the HTTP/HTTPS scheme and hostname syntax with the standard library, without network requests or new dependencies. Validation runs in Survey.validate() so spreadsheet and JSON inputs follow the same rule. Preserve local hosts, IP addresses, internationalized domains, ports, and omitted settings. Reject control characters before parsing because the original address is written into the form.

What are the regression risks?

Malformed addresses previously accepted by pyxform now produce a clear error. Regression cases cover invalid schemes, hosts, ports, IPv6 syntax and control characters, plus valid remote/local endpoints and existing omitted-setting behavior. This checks syntax, not server reachability or DNS resolution.

Validation: 43 settings tests passed. The full unittest suite ran 1,182 tests and finished OK (6 skipped, 6 expected failures). One earlier run hit two transient psutil.NoSuchProcess errors in existing memory benchmarks; an unchanged full-suite retry passed. Ruff 0.15.21 formatting/lint and diff checks passed. Independent adversarial review and additional URL boundary checks passed.

Does this change require updates to documentation?

No new setting or syntax is introduced; invalid submission URLs now receive an explicit validation error.

Before submitting this PR, please make sure you have:

  • included test cases for core behavior and edge cases in tests
  • run python -m unittest and verified the suite passes, with existing skips and expected failures noted above
  • run ruff format pyxform tests and ruff check pyxform tests
  • verified that any code or assets from external sources are properly credited in comments; no external code or assets added

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.

Warn or throw an error on an invalid submission_url

1 participant