• 
      

    Require SafeStrings for all HTML in review request fields.

    Review Request #14299 — Created Jan. 22, 2025 and submitted

    Information

    Review Board
    release-7.1.x

    Reviewers

    We've had a long-standing task to enforce HTML safety in review request
    fields. We've trusted that all HTML strings were safe, but with TODO
    comments saying we need to move to SafeString enforcement.

    This change makes that move. We now expect SafeString results from all
    rendering functions for views. Since this is a breaking change, it's a
    soft requirement. We convert native strings to SafeStrings when found,
    but with a deprecation warning.

    This gave me the opportunity to clean up some of our HTML rendering code
    to be a bit more manageable.

    All built-in fields have been updated to ensure SafeString results.

    Note that affected functions have not received any signature updates.
    Those will be handled separately as part of a larger change.

    All unit tests pass.

    Tested a review request with all the fields. Verified that they all
    rendered their contents correctly on the review request and the change
    descriptions.

    Tested this with and without the updates to the built-in fields.
    Without those updates, I saw the warnings in the console but the fields
    rendered as expected.

    Summary ID
    Require SafeStrings for all HTML in review request fields.
    We've had a long-standing task to enforce HTML safety in review request fields. We've trusted that all HTML strings were safe, but with TODO comments saying we need to move to `SafeString` enforcement. This change makes that move. We now expect `SafeString` results from all rendering functions for views. Since this is a breaking change, it's a soft requirement. We convert native strings to `SafeString`s when found, but with a deprecation warning. This gave me the opportunity to clean up some of our HTML rendering code to be a bit more manageable. All built-in fields have been updated to ensure `SafeString` results. Note that affected functions have not received any signature updates. Those will be handled separately as part of a larger change.
    fd9ff985ae4d8a4fc4dd7b21bef661a8789d7b88
    Description From Last Updated

    Need a version changed for making this keyword-only.

    maubinmaubin

    Need a version changed for making this keyword-only.

    maubinmaubin

    Need a version changed for making this keyword-only.

    maubinmaubin

    Missing a version added.

    maubinmaubin
    chipx86
    maubin
    1. 
        
    2. reviewboard/reviews/fields.py (Diff revision 2)
       
       
      Show all issues

      Need a version changed for making this keyword-only.

    3. reviewboard/reviews/fields.py (Diff revision 2)
       
       
      Show all issues

      Need a version changed for making this keyword-only.

    4. reviewboard/reviews/fields.py (Diff revision 2)
       
       
      Show all issues

      Need a version changed for making this keyword-only.

    5. reviewboard/reviews/fields.py (Diff revision 2)
       
       
      Show all issues

      Missing a version added.

    6. 
        
    chipx86
    maubin
    1. Ship It!
    2. 
        
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-7.1.x (77ee2eb)