git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] gitweb: filter escapes from longer commit titles that break firefox

From
Jakub Narebski <jnareb@gmail.com>
Date
Apr 24, 2009, 17:53 UTC
Message-ID
<200904241953.37187.jnareb@gmail.com>
In-Reply-To
<49EC78AB.6020009@windriver.com>
On Mon, 20 April 2009, Paul Gortmaker wrote:
Show 15 quoted lines
> Jakub Narebski wrote:
>> Paul Gortmaker <paul.gortmaker@windriver.com> writes:
>>
>>   
>>> If there is a commit that ends in ^X and is longer in length than
>>> what will fit in title_short, then it doesn't get fed through
>>> esc_html() and so the ^X will appear as-is in the page source.
>>>
>>> When Firefox comes across this, it will fail to display the page,
>>> and only display a couple lines of error messages that read like:
>>>
>>>    XML Parsing Error: not well-formed
>>>    Location: http://git ....
>>>
>>> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Show 19 quoted lines
>> But I do not think that the solution presented here is good solution
>> for this problem.  chop_and_escape_str is meant as _output_ filter,
>> because it generates (can generate) fragment of HTML.  It is not a
>> good solution to use it for shortening in intermediate representation
>> of %co{'title'}.
>>
>> And I think that issue might be a bug elsewhere in gitweb if we have
>> text output which is not passed through esc_html... or bug in CGI.pm
>> if the error is in not escaping of -title _attribute_ (attribute
>> escaping has slightly different rules than escaping HTML, and should
>> be done automatically by CGI.pm).
>>
>>
>> So thanks for noticing the issue, but NAK on the solution.
> 
> Fair enough -- I wasn't familiar with the code in there, and there 
> wasn't really any indication that it was for output only.  I can easily 
> believe that there is a better place for it -- I just didn't see where 
> any global esc_html filtering was taking place...

The name chop_and_escape_str for this subroutine is not a very good name; it rather should follow format_* as a naming convention for this subroutine.

What more important is: can you find out in more detail _where_ an error (unescaped control character) occurs: is it tag contents or 'title' attribute for some tag, what tag is it (name and class), in what view or views this bug is present, and in which part this occur? Without those details it would b much harder to diagnose this bug...

-- 
Jakub Narebski
Poland
Previous: Paul GortmakerNext: Paul Gortmaker
Message 4 of 7 in “gitweb: filter escapes from longer commit titles that break firefox”
  1. gitweb: filter escapes from longer commit titles that break firefoxPaul Gortmaker, Apr 17, 2009
  2. Jakub NarebskiApr 20, 2009
  3. Paul GortmakerApr 20, 2009
  4. Jakub NarebskiApr 24, 2009
  5. Paul GortmakerApr 24, 2009
  6. Jakub NarebskiApr 24, 2009
  7. Jakub NarebskiApr 25, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.