canonical / canonical/ubuntu-com-security-api

CVEs website with links with extra text gets a broken redirection

Open
#81 4 comments 0 reactions 0 assignees View on GitHub
Priority: Medium Question ❓
Dominant language
Python
Stars
22
Forks
9
Avg merge
1d 3h
Merged PRs (30d)
2

Description

## Summary

Hi.
When we have a CVE that has a link with extra text in parenthesis in either the **Bugs** or **References** sections, it gets an incorrect link redirection because it adds the extra text to the links.
We are wondering if that is something that might be fixed, please.

In summary, when we have a `http://link.to.something (notes)` we would like to have the link shown in the page as `http://link.to.something (notes)` but the redirection to `http://link.to.something`

Example: https://ubuntu.com/security/CVE-2014-4607

## Process

Access a CVE with links in Bugs and/or References with extra text in parenthesis and try to access that link.

## Current and expected result
From the example above (https://ubuntu.com/security/CVE-2014-4607)

Current web source
```html

  • https://bugs.launchpad.net/ubuntu/+source/krfb/+bug/1352421 (krfb)

  • ```

    Expected web source
    ```html

  • https://bugs.launchpad.net/ubuntu/+source/krfb/+bug/1352421 (krfb)

  • ```

    ## Extra comments

    There was a python pseudocode suggestion that was used to discuss this issue with @mtruj013 in mattermost some days ago that I would like to add here in case it helps:

    ```python
    {% for reference in cve.references %}
    reference_link = reference

    {% if ' (' in reference %}
    reference_link = reference[0:reference.index(' (')].strip()
    {% endif %}

  • {{ reference }}

  • {% endfor %}

    ....

    {% for bug in cve.bugs %}
    bug_link = bug

    {% if ' (' in bug %}
    bug_link = bug[0:bug.index(' (')].strip()
    {% endif %}

  • {{ bug }}

  • {% endfor %}
    ```

    Contributor guide

    No contributing guide indexed for this repository

    Research direction

    Start by locating the CVE detail template or rendering entry point for the Bugs and References sections, then reproduce the issue with CVE-2014-4607. Verify that parenthetical notes remain in the displayed label while the generated href stops before the notes, and check both sections with links that have and lack extra text.

    Written by the indexing model from the issue text.

    Assessment

    Tech stack
    python
    Domain
    api, backend
    Issue type
    Bug
    Difficulty
    2/5
    Estimated time
    1-3 hours
    Activity status
    Stale
    Clarity
    Mostly clear
    Newbie friendliness
    48/100

    Get new issues in your inbox

    A short digest of beginner-friendly GitHub issues.