Page MenuHomeSoftware Heritage

utils/exc: Ensure exception text is escaped in HTML error page
ClosedPublic

Authored by anlambert on Oct 26 2022, 4:10 PM.

Details

Summary

Some exception texts like the RemoteException ones were not correctly
rendered in HTML error page as they were not escaped.

Before:

After:

Depends on D8780

Diff Detail

Repository
rDWAPPS Web applications
Branch
utils-exc-fixes
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 32601
Build 51071: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 51070: arc lint + arc unit

Unit TestsFailed

TimeTest
20,681 msJenkins > should display NotFoundExc for incorrect origin_url with correct content hash::Tests / Cypress tests / Test Errors For archived repositories should display NotFoundExc for incorrect origin_url with correct content hash
AssertionError: Timed out retrying after 20000ms: expected '<div.swh-http-error-desc>' to contain 'The Software Heritage archive has a content with the hash you provided but the origin mentioned in your request appears broken: https://github.com/SoftwareHeritage/swh-web. Please check the URL and try again.\n\nNevertheless, you can still browse the content without origin information: /browse/content/sha1_git:30fda27bc2833697ebb7df1fa4be4ce6a6f4c27d/' at urlShouldShowError (webpack:///./cypress/e2e/errors.cy.js:23:5) at Context.eval (webpack:///./cypress/e2e/errors.cy.js:110:6)
439 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.add_forge_now.test_api_views::Tests / Python tests / test_add_forge_request_create_anonymous_user
486 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.add_forge_now.test_api_views::Tests / Python tests / test_add_forge_request_create_duplicate
231 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.add_forge_now.test_api_views::Tests / Python tests / test_add_forge_request_create_empty
328 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.add_forge_now.test_api_views::Tests / Python tests / test_add_forge_request_create_invalid_forge_url
View Full Test Results (1 Failed · 1,040 Passed · 2 Skipped)

Event Timeline

Build has FAILED

Patch application report for D8781 (id=31648)

Could not rebase; Attempt merge onto a2526ef5bb...

Updating a2526ef5..3f5f028f
Fast-forward
 swh/web/tests/utils/test_exc.py | 39 +++++++++++++++++++++++++++++++++++++++
 swh/web/utils/exc.py            | 25 +++++++++++++++----------
 2 files changed, 54 insertions(+), 10 deletions(-)
 create mode 100644 swh/web/tests/utils/test_exc.py
Changes applied before test
commit 3f5f028f76ac15f257d3cddd426b809ff32b26a5
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Oct 26 16:06:39 2022 +0200

    utils/exc: Ensure exception text is escaped in HTML error page
    
    Some exception texts like the RemoteException ones were not correctly
    rendered in HTML error page as they were not escaped.

commit d2c653d3e9c376697788274408e653eb43eedef3
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Oct 26 15:24:17 2022 +0200

    utils/exc: Add typing

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

Harbormaster returned this revision to the author for changes because remote builds failed.Oct 26 2022, 4:19 PM
Harbormaster failed remote builds in B32601: Diff 31648!

Build has FAILED

Patch application report for D8781 (id=31648)

Could not rebase; Attempt merge onto a2526ef5bb...

Updating a2526ef5..3f5f028f
Fast-forward
 swh/web/tests/utils/test_exc.py | 39 +++++++++++++++++++++++++++++++++++++++
 swh/web/utils/exc.py            | 25 +++++++++++++++----------
 2 files changed, 54 insertions(+), 10 deletions(-)
 create mode 100644 swh/web/tests/utils/test_exc.py
Changes applied before test
commit 3f5f028f76ac15f257d3cddd426b809ff32b26a5
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Oct 26 16:06:39 2022 +0200

    utils/exc: Ensure exception text is escaped in HTML error page
    
    Some exception texts like the RemoteException ones were not correctly
    rendered in HTML error page as they were not escaped.

commit d2c653d3e9c376697788274408e653eb43eedef3
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Oct 26 15:24:17 2022 +0200

    utils/exc: Add typing

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

Build has FAILED

Patch application report for D8781 (id=31648)

Could not rebase; Attempt merge onto a2526ef5bb...

Updating a2526ef5..3f5f028f
Fast-forward
 swh/web/tests/utils/test_exc.py | 39 +++++++++++++++++++++++++++++++++++++++
 swh/web/utils/exc.py            | 25 +++++++++++++++----------
 2 files changed, 54 insertions(+), 10 deletions(-)
 create mode 100644 swh/web/tests/utils/test_exc.py
Changes applied before test
commit 3f5f028f76ac15f257d3cddd426b809ff32b26a5
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Oct 26 16:06:39 2022 +0200

    utils/exc: Ensure exception text is escaped in HTML error page
    
    Some exception texts like the RemoteException ones were not correctly
    rendered in HTML error page as they were not escaped.

commit d2c653d3e9c376697788274408e653eb43eedef3
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Oct 26 15:24:17 2022 +0200

    utils/exc: Add typing

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

Build has FAILED

Patch application report for D8781 (id=31648)

Could not rebase; Attempt merge onto a2526ef5bb...

Updating a2526ef5..3f5f028f
Fast-forward
 swh/web/tests/utils/test_exc.py | 39 +++++++++++++++++++++++++++++++++++++++
 swh/web/utils/exc.py            | 25 +++++++++++++++----------
 2 files changed, 54 insertions(+), 10 deletions(-)
 create mode 100644 swh/web/tests/utils/test_exc.py
Changes applied before test
commit 3f5f028f76ac15f257d3cddd426b809ff32b26a5
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Oct 26 16:06:39 2022 +0200

    utils/exc: Ensure exception text is escaped in HTML error page
    
    Some exception texts like the RemoteException ones were not correctly
    rendered in HTML error page as they were not escaped.

commit d2c653d3e9c376697788274408e653eb43eedef3
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Oct 26 15:24:17 2022 +0200

    utils/exc: Add typing

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

Build is green

Patch application report for D8781 (id=31649)

Could not rebase; Attempt merge onto a2526ef5bb...

Updating a2526ef5..df0bb952
Fast-forward
 swh/web/tests/utils/test_exc.py | 39 +++++++++++++++++++++++++++++++++++++++
 swh/web/utils/exc.py            | 26 +++++++++++++++++---------
 2 files changed, 56 insertions(+), 9 deletions(-)
 create mode 100644 swh/web/tests/utils/test_exc.py
Changes applied before test
commit df0bb952e96da506b7c2268678d7a02e04f69de6
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Oct 26 16:06:39 2022 +0200

    utils/exc: Ensure exception text is escaped in HTML error page
    
    Some exception texts like the RemoteException ones were not correctly
    rendered in HTML error page as they were not escaped.

commit d2c653d3e9c376697788274408e653eb43eedef3
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Oct 26 15:24:17 2022 +0200

    utils/exc: Add typing

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

This revision is now accepted and ready to land.Oct 26 2022, 5:14 PM