> So the basic TL;DR: please don't use really ancient terminal programs that are vulnerable to this stuff.
Disappointing that he would make this statement and then not bother to recommend specific ones to avoid and/or use.
I think the most devious would be to simply move the cursor up one line. This would result in the 'git log' line being overwritten, and hiding the commit from casual scrutiny.
ANSI control characters include cursor positioning, so in theory you could implement marquee messages. The problem would be introducing delay. I don't recall if you can do that using ANSI. You can emulate it by doing repeated cursor repositioning, but that would be rendered so quickly that the commit message would have to be enormous to include any appreciable delay.
>I actually quite like the idea of control codes in commit messages for internal teams where you can implement rules.
>It could be useful for highlighting risky commits in red or other visual markers.
Yeah... that is really not a good idea. You are not supposed to take this blog post seriously.
Why not just agree on some terminology like CRITICAL/MINOR/SECURITY, which a visual interface can then highlight?
SECURITY: Fix XSS in spline reticulation
If it detects "SECURITY" it adds a red background, etc. Anyone viewing the raw text version of the commit messages will still get the message without having to see a bunch of gibberish.
"XSS has nothing to do with {my website framework}, it just applies javascript that work anywhere in a compatible browser."
Actually it has something to do with git. Git should strip or escape the user input before displaying. XSS and SQL Injections are the same kind of issue -> do not trust the user input and escape the input before interaction with it happens.
So to be clear, the article isn't suggesting that e.g. github will interpret the ANSI escape sequences, but they will be when you `git log` from a command line, right?
Anyone know if an issue has been opened (or any relevant discussion on the dev list) on stripping escape sequences? It does seem like it could be harmful.
This is a really entertaining writing style: technical enlightenment through demonstration via humorous examples. For the lazy (and additional humorous demonstration), I wish he'd provided an example gif showing it in action (i.e., Github, terminal, Sourcetree, etc...).
(The terminal would be the only place it would display correctly it seems, but it would be nice to see the chaos it may or may not cause in Github and other tools.)
Finding someone who can write very technically while also being funny and charismatic is pretty rare (We computer types aren't always the biggest hits at parties). I also really appreciate his "last time on" opening paragraphs... it gives some context to the blog post and where's coming from in his headspace. Neat.
Haha, what a coincidence. Just the other day we discussed string special cases[0][1], to which I contributed ansi escapes. Unicode "fonts" 𝓵𝓲𝓴𝓮 𝖙𝖍𝖎𝖘 seem to work in commit messages as well.
I think this is quite harmful, especially the character movement ansi escapes could be used for nefarious purposes.
I recently had to write some code[0] that handles strings of UTF-8 with ANSI color escapes sprinkled throughout.
A fun exercise is to write a function that overwrites string A with string B, starting at index N. It's hard enough with unicode, but ANSI escapes make it more fun.
This works for me in OS X's built-in Terminal app, but not iTerm. Both report xterm-256color as $TERM, so I'm not sure what about iTerm is configured differently to prevent it from working there.
Doesn't work on Xfce either. On a virtual terminal thingy (ctrl-alt-f1) it shows a grey background with white text. I suspect blink is only implemented on the Mac's terminal, not in Linux-land.
Who remembers when most of the blogs syndicating discussions about RSS all started blinking at once, when somebody posted an item whose title was "What happens when you put a <blink> tag into the title?"
If you can insert the ESC character, u001B, it's easy. (Though note that it appears as the two characters ^[ in the blog post, so your code should start ESC[5m with only one bracket.)
Unfortunately Sublime wasn't happy with me trying to type it through the Mac Unicode Hex input, but I was able to copy-paste it in, and I was also able to enter it directly in other programs, like GitHub desktop.
svckr|10 years ago
[0] https://github.com/thiderman/doge
manojlds|10 years ago
0x0|10 years ago
thephyber|10 years ago
creshal|10 years ago
But you can make your text black with a black background. Or re-order lines, which I suspect to be "fun" for git logs.
jamie_ca|10 years ago
WalterGR|10 years ago
jamesdsadler|10 years ago
https://iterm2.com/images.html
Edit: even animated gifs
dmix|10 years ago
rurounijones|10 years ago
It could be useful for highlighting risky commits in red or other visual markers.
Would play merry hell with almost every other way of viewing commits though :D
rudolf0|10 years ago
>It could be useful for highlighting risky commits in red or other visual markers.
Yeah... that is really not a good idea. You are not supposed to take this blog post seriously.
Why not just agree on some terminology like CRITICAL/MINOR/SECURITY, which a visual interface can then highlight?
If it detects "SECURITY" it adds a red background, etc. Anyone viewing the raw text version of the commit messages will still get the message without having to see a bunch of gibberish.tempodox|10 years ago
trampi|10 years ago
Actually it has something to do with git. Git should strip or escape the user input before displaying. XSS and SQL Injections are the same kind of issue -> do not trust the user input and escape the input before interaction with it happens.
thom_nic|10 years ago
thom_nic|10 years ago
catern|10 years ago
GuiA|10 years ago
caf|10 years ago
Cthulhu_|10 years ago
nichochar|10 years ago
dlss|10 years ago
cousin_it|10 years ago
eldude|10 years ago
JoshM33k|10 years ago
Finding someone who can write very technically while also being funny and charismatic is pretty rare (We computer types aren't always the biggest hits at parties). I also really appreciate his "last time on" opening paragraphs... it gives some context to the blog post and where's coming from in his headspace. Neat.
sbierwagen|10 years ago
brillenfux|10 years ago
Works for OS X apparently.
im3w1l|10 years ago
I think this is quite harmful, especially the character movement ansi escapes could be used for nefarious purposes.
[0] https://news.ycombinator.com/item?id=10035008
[1] https://github.com/minimaxir/big-list-of-naughty-strings/blo...
neckro23|10 years ago
dantillberg|10 years ago
A fun exercise is to write a function that overwrites string A with string B, starting at index N. It's hard enough with unicode, but ANSI escapes make it more fun.
[0]: https://github.com/tillberg/ansi-log (Go logging library with support for ANSI colors and interleaving multiple writers)
icebraining|10 years ago
Like what?
Perceptes|10 years ago
thechriswalker|10 years ago
Off by default; enable and blink like its 1989.
awendt|10 years ago
rmc|10 years ago
MattBearman|10 years ago
gtremper|10 years ago
SnaKeZ|10 years ago
unknown|10 years ago
[deleted]
unknown|10 years ago
[deleted]
erikb|10 years ago
rquirk|10 years ago
DonHopkins|10 years ago
madaxe_again|10 years ago
Although I do wonder what havoc you could wreak on hosted git services with cunning sequences of control characters. Smacks of injection.
alxndr|10 years ago
http://www.bbcbasic.co.uk/bbcwin/manual/bbcwinh.html
https://en.wikipedia.org/wiki/Teletext
forgotmypassw|10 years ago
belgianguy|10 years ago
ins0|10 years ago
Cthulhu_|10 years ago
imauld|10 years ago
andrewflnr|10 years ago
cranium|10 years ago
TeMPOraL|10 years ago
zamalek|10 years ago
DonHopkins|10 years ago
mey|10 years ago
tibbon|10 years ago
XaspR8d|10 years ago
Unfortunately Sublime wasn't happy with me trying to type it through the Mac Unicode Hex input, but I was able to copy-paste it in, and I was also able to enter it directly in other programs, like GitHub desktop.
unknown|10 years ago
[deleted]
unknown|10 years ago
[deleted]
injamul|10 years ago
[deleted]