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

Re: [PATCH] gitweb: protect blob and diff output lines from controls.

From
Jakub Narebski <jnareb@gmail.com>
Date
Nov 9, 2006, 00:04 UTC
Message-ID
<200611090104.32247.jnareb@gmail.com>
In-Reply-To
<7vpsbxqzre.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
Show 6 quoted lines
> This reuses the quot_cec to protect blob and text diff output
> from leaking control characters.
> 
> Signed-off-by: Junio C Hamano <junkio@cox.net>
> ---
>  * requesting extra sets of eyeballs.

This changes the "blob" and "text diff" output somewhat, as earlier it used Control key Sequence (CS) representation for some non-whitespace control characters (not "\t' not '\n'), namely replacing form feed (FF) ('\f', '\014') with ^L and escape (ESC) ('\e', '\033') with ^[.

And (what is not said in the commit message) it additionally esc_html some title elements (the subroutine should be I think named esc_attr).

The problems are:
1. First, esc_path should _not_ use subroutine which does it's own 
contol characters escaping. That was also a mistake I made in my patch.
Perhaps we should have some quot_html or to_html subroutine which does 
_only_ to_utf8 (decode from Encode module), escapeHTML and optionally 
s/ /&nbsp;/g conversion.
2. In my opinion CS is better than CEC for quoting/escaping control 
characters in the "bulk" output, namely "blob" output and "text 
diff" (patchset body) output. CEC is better for pathnames (which must 
fit in one line), and perhaps other one-liners; perhaps not. I'm not 
sure what quoting to choose for esc_attr, but there we could use even 
--no-control-chars quoting (replacing any control character by '?'); 
but perhaps in some cases like git_print_page_path subroutine CEC is 
better.
BTW. what had happened with to_qtext post?
-- 
Jakub Narebski
Previous: Junio C HamanoNext: Junio C Hamano
Message 2 of 12 in “gitweb: protect blob and diff output lines from controls.”
  1. gitweb: protect blob and diff output lines from controls.Junio C Hamano, Nov 8, 2006
  2. Jakub NarebskiNov 9, 2006
  3. Junio C HamanoNov 9, 2006
  4. Jakub NarebskiNov 9, 2006
  5. Junio C HamanoNov 9, 2006
  6. Jakub NarebskiNov 9, 2006
  7. Jakub NarebskiNov 9, 2006
  8. Junio C HamanoNov 9, 2006
  9. Jakub NarebskiNov 9, 2006
  10. Junio C HamanoNov 9, 2006
  11. Jakub NarebskiNov 9, 2006
  12. Luben TuikovNov 10, 2006

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.