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

Re: [PATCH] gitweb: Change to use explicitly function call cgi->escapHTML()

From
Junio C Hamano <junkio@cox.net>
Date
Mar 6, 2007, 10:45 UTC
Message-ID
<7vzm6qps51.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<989B956029373F45A0B8AF02970818902DAA12@zch01exm26.fsl.freescale.net>
"Li Yang-r58472" <LeoLi@freescale.com> writes:
Show 9 quoted lines
>> -----Original Message-----
>> From: Jeff King [mailto:peff@peff.net]
>> ...
>> I think this should do the same, and is perhaps less magic (or maybe
>> more, depending on your perspective).
>
> Yes, it also fixed the problem.  I'm not very familiar with perl.  Will
> CGI::autoEscape(1) change CGI action for other users of CGI module on
> the system?  If so, maybe it will break other CGIs.

By "other CGIs" if you mean other independent CGI scripts that do not have anything to do with gitweb, then I do think there is no need to worry.

What I'd be worried about more, however, is if all the callers of esc_html and esc_path are really expecting the full quoting done by CGI::autoEscape(1). I think we had some discussion on the path quoting when we introduced quot_cec and quot_upr, but do not recall the details. For example, many places esc_html() is used as the body of <a ...>$here</a> but some places it is used as

    $cgi->a({ ... -title =>esc_html($fullname) }, esc_path($dir))
which would be the same as:
    print '<a title="' . esc_html($fullname) . '">' . esc_path($dir) . '</a>';
which may or may not be right (I do not know offhand).
Speaking of -title, I see "sub git_project_list_body" does this:
    $cgi->a({ ... -title => $pr->{'descr_long'}}, esc_html($pr->{'descr'}));
	
which seems inconsistent with the earlier quoted $fullname
handling (unless $pr->{'descr_long'} is already quoted and $pr->{'descr'}
is not, which I find highly unlikely).
Previous: Li Yang-r58472Next: Jakub Narebski
Message 15 of 21 in “gitweb: Change to use explicitly function call cgi->escapHTML()”
  1. gitweb: Change to use explicitly function call cgi->escapHTML()Li Yang, Mar 6, 2007
  2. Junio C HamanoMar 6, 2007
  3. Jakub NarebskiMar 6, 2007
  4. Jeff KingMar 6, 2007
  5. Junio C HamanoMar 6, 2007
  6. Li Yang-r58472Mar 6, 2007
  7. Jeff KingMar 6, 2007
  8. Junio C HamanoMar 6, 2007
  9. Jeff KingMar 6, 2007
  10. Junio C HamanoMar 6, 2007
  11. Jeff KingMar 6, 2007
  12. Junio C HamanoMar 6, 2007
  13. Jeff KingMar 6, 2007
  14. Li Yang-r58472Mar 6, 2007
  15. Junio C HamanoMar 6, 2007
  16. Jakub NarebskiMar 6, 2007
  17. Junio C HamanoMar 6, 2007
  18. Jakub NarebskiMar 7, 2007
  19. Junio C HamanoMar 7, 2007
  20. gitweb: Don't escape attributes in CGI.pm HTML methodsJakub Narebski, Mar 7, 2007
  21. Junio C HamanoMar 7, 2007

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.