Page MenuHomeSoftware Heritage

add_forge_now: Add client-side and server-side forge URL validation
ClosedPublic

Authored by anlambert on Aug 16 2022, 5:09 PM.

Details

Summary

This will prevent submission of add forge now requests with invalid
forge URLs from the Web UI and the Web API.

Diff Detail

Repository
rDWAPPS Web applications
Branch
add-forge-now-url-validation
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 30816
Build 48178: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 48177: arc lint + arc unit

Event Timeline

Build has FAILED

Patch application report for D8247 (id=29764)

Rebasing onto 27e448ca12...

Current branch diff-target is up to date.
Changes applied before test
commit 7cd88d370c860cfe9ee77b1248843d32dd9eac21
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Aug 16 16:14:10 2022 +0200

    add_forge_now: Add client-side and server-side forge URL validation
    
    This will prevent submission of add forge now requests with invalid
    forge URLs from the Web UI and the Web API.

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1966/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1966/console

Harbormaster returned this revision to the author for changes because remote builds failed.Aug 16 2022, 5:26 PM
Harbormaster failed remote builds in B30816: Diff 29764!

Build has FAILED

Patch application report for D8247 (id=29764)

Rebasing onto 27e448ca12...

Current branch diff-target is up to date.
Changes applied before test
commit 7cd88d370c860cfe9ee77b1248843d32dd9eac21
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Aug 16 16:14:10 2022 +0200

    add_forge_now: Add client-side and server-side forge URL validation
    
    This will prevent submission of add forge now requests with invalid
    forge URLs from the Web UI and the Web API.

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1969/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1969/console

Build has FAILED

Patch application report for D8247 (id=29780)

Rebasing onto 27e448ca12...

Current branch diff-target is up to date.
Changes applied before test
commit 49edb72083a0136f04be1d9de2235daaa7352600
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Aug 16 16:14:10 2022 +0200

    add_forge_now: Add client-side and server-side forge URL validation
    
    This will prevent submission of add forge now requests with invalid
    forge URLs from the Web UI and the Web API.

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1972/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1972/console

Harbormaster returned this revision to the author for changes because remote builds failed.Aug 17 2022, 12:00 PM
Harbormaster failed remote builds in B30832: Diff 29780!

Build is green

Patch application report for D8247 (id=29780)

Rebasing onto 27e448ca12...

Current branch diff-target is up to date.
Changes applied before test
commit 49edb72083a0136f04be1d9de2235daaa7352600
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Aug 16 16:14:10 2022 +0200

    add_forge_now: Add client-side and server-side forge URL validation
    
    This will prevent submission of add forge now requests with invalid
    forge URLs from the Web UI and the Web API.

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1973/ for more details.

jayeshv added inline comments.
swh/web/templates/add_forge_now/creation_form.html
48

Can we avoid this validation using URL field in a Django form? That seems to support custom validation as well.

swh/web/templates/add_forge_now/creation_form.html
48

At the moment we cannot as we do not use django ModelForm the right way (we handled the HTML form ourself instead of "simply" including the django form in the template and we send form data to server through js).
It is planned to use pure django forms later in swh-web refactoring whenever it is possible.

Proceeding like this also enables to save an HTTP request to validate form data.

This revision is now accepted and ready to land.Aug 17 2022, 1:41 PM

Build is green

Patch application report for D8247 (id=29792)

Rebasing onto b6ddca59dd...

Current branch diff-target is up to date.
Changes applied before test
commit 39abda7135c0203177ee35b2d01e0c5befb7bf1f
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Aug 16 16:14:10 2022 +0200

    add_forge_now: Add client-side and server-side forge URL validation
    
    This will prevent submission of add forge now requests with invalid
    forge URLs from the Web UI and the Web API.

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1976/ for more details.