Skip to content

Job board: job_detail page leaks HTML from description #2307

Open
@enku

Description

@enku

Describe the bug
On the Jobs board detail page, HTML from the description "bleeds" into the <meta property="og:description" tag in the <head>. For an example, see https://www.python.org/jobs/7329/ (at the top of the page).

To Reproduce
Steps to reproduce the behavior:

  1. Go to any jobs detail page, one that has HTML in the description
  2. Look at the top of the page
  3. You'll see partial rendered HTML from the job description. It's being leaked out of the
    <meta property="og:description" tag.

Expected behavior
The top of the jobs detail page does not leak part of the job description.

Screenshots
image

Desktop (please complete the following information):

  • OS: (Gentoo) Linux
  • Browser: Firefox
  • Version: 117.0

Additional context
Possible fix:

diff --git a/templates/jobs/job_detail.html b/templates/jobs/job_detail.html
index 82ddd3f..12c204a 100644
--- a/templates/jobs/job_detail.html
+++ b/templates/jobs/job_detail.html
@@ -8,7 +8,7 @@
 {% block content_attributes %}with-right-sidebar{% endblock %}
 
 {% block og_title %}Job: {{ object.job_title }} at {{ object.company_name }}{% endblock %}
-{% block og-descript %}{{ object.description|truncatechars:200 }}{% endblock %}
+{% block og-descript %}{{ object.description|striptags|truncatechars:200 }}{% endblock %}
 
 {% block content %}
 {% load companies %}

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/jobsRelates to the jobs appfrontendRelates to the frontend of the apphelp-wantedThe maintainers would welcome help with this issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions