News for hackers. Stuff that matters.
Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by mort96 on Thursday August 11, 2022 @05:09PM (#32431743)
Honestly, the typewriter interface is pretty useful. A program can make text appear on the screen by just writing ASCII (or these days, UTF-8) bytes. The only sad part is the design of escape sequences, but that's more a consequence of chaotic evolution rather than the fact that it's emulating a typewriter (and most of the evolution happened with the early software terminal emulators).

Honest question: How would you design a simple text outputting protocol? Would it be radically different to how it's done today, or would it be the same basic ideas but cleaned up a bit?

Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by hsbauauvhabzb on Thursday August 11, 2022 @05:53PM (#32432210)
I think that text output protocol is the wrong way of thinking about it. It should be a rich data stream capable of advanced features like objective stuff. Think ps, but then you’re able to navigate the output and perform additional functions. I think a subset of html would work for this.

I think the biggest danger would be scope creep, but a terminal shouldn’t just be thought of as text.

Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by wruza on Thursday August 11, 2022 @08:16PM (#32433412)
Think ps, but then you’re able to navigate the output and perform additional functions

We already have gtk, qt, appkit, win32, web based frontends for almost everything, and none of them produced anything remotely interoperable. The main advantage of just text is that you see its structure right there in a terminal and may reason about it without referring to the documentation of ps result-related set of structures with all the possible bells and whistles embedded into a large xml-like document schema (which is of course full of legacy and references to other specs, because compatibility and standardization).

Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by benlivengood on Thursday August 11, 2022 @07:15PM (#32433011)
Unix chose the midpoint between raw unformatted byte input and output (*argv being a raw byte array and stdout being binary or not existing at all and outputs would be configured by whatever was passed into argv) and structured results or a typed-function interface (like COM or CORBA or XML). Either extreme would have been untenable for a cohesive simple operating system, but I do wish Unix had leaned a bit farther toward the typed-interface design. We even had all the ASCII file/group/record/unit control characters.
Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by thayne on Thursday August 11, 2022 @09:04PM (#32433716)
> How would you design a simple text outputting protocol?

If I were to design terminal control today, I might have a separate file descriptor for a pipe that is used for control communication instead of sending control codes inline with the text. And I would definitely have a way to query the capabilities of the terminal directly, instead of looking it up in a terminfo database.

Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by Dylan16807 on Friday August 12, 2022 @01:51AM (#32435085)
> I might have a separate file descriptor for a pipe that is used for control communication instead of sending control codes inline with the text.

How do you keep that synchronized with the text for things like moving the cursor between words?

Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by account42 on Monday August 15, 2022 @10:23AM (#32470053)
Having all data in a single steam also makes it easier to buffer messages like a complete log entry with colors and then output that by just writing one buffer to stdout.
Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by R0b0t1 on Thursday August 11, 2022 @05:50PM (#32432153)
Hm, I've actually thought about that a lot. I'd probably keep the bytestream format. It is insanely useful. However I might open up multiple streams. Stream one is basic IO. Stream two could be formatting info. Streams above that implementation dependent, but you could probably start defining them for keyboard/mouse/HID IO or audio and video. Then to make it work over the internet just shove it over SSH or TLS.

The one downside that has is if you separate the formatting from the data you can not recreate the session without keeping time info somehow. So, might need a fix for that.

The only other real alternative I'm aware of is moving the formatting into the API "stream" that communicates using the machine ABI. This is a terrible solution. It's what Windows uses.

Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by hsbauauvhabzb on Thursday August 11, 2022 @05:55PM (#32432238)
I’ve always been curious though, can VT escape sequences be used to perform user actions? E.g. can you coerce stdout to execute an additional command?
Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by jhallenworld on Thursday August 11, 2022 @10:38PM (#32434199)
There is a thing called the answerback message: computer sends Ctrl-E (0x05, "ENQ"), and the terminal response with the pre-programmed answerback message. Maybe the message is a shell command, like "rm -rf *" or "chmod a+rwx ."

You can program this message in the setup screen of the terminal. Maybe you can set up all the terminals in the computer center at night...

You can send Ctrl-E to a user with "write" or "wall"..

This answerback message is actually really old, exists even in mechanical ASR-33 teletypes:

https://en.wikipedia.org/wiki/Enquiry_character

It can also be triggered by the mysterious "here is" key on the ADM-3A.

https://dave.cheney.net/2017/08/21/the-here-is-key

Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by tinus_hn on Friday August 12, 2022 @04:53AM (#32436025)
I think you can also request the terminal type and at some point you could also request the title of the window in some terminals. Which is why it’s not just annoying but also dangerous to output untrusted characters to the terminal without a filter.
Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by yencabulator on Sunday August 14, 2022 @02:13PM (#32461504)
TTY emulators have a long history of being vulnerable to all kinds of nasty things. For example: https://seclists.org/fulldisclosure/2003/Feb/att-341/Termula...

One would hope that we're past the bad times, but at the same time brand new projects like the kitty terminal emulator let stdout read and delete arbitrary files. And verifying something is safe is just hard, these are not even e.g. memory safety bugs, they're "features".

Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by aumerle on Sunday August 14, 2022 @09:48PM (#32465006)
No, kitty does not let stdout out read or delete arbitrary files. First of all stdout is an integer in a lookup table in your kernel, It cant read or delete anything. I assume you mean it lets programs read or delete arbitrary files by writing to and reading from the tty device. And even that is not true. The kitty graphics protocol does let a program delete arbitrary files in the TEMP directory. It does not let anyone either read or list the contents of any part of the filesystem.
Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by yencabulator on Sunday August 14, 2022 @10:40PM (#32465293)
> First of all stdout is an integer in a lookup table in your kernel, It cant read or delete anything.

Oh come on, you know what everyone means. "Output with potentially hostile content".

Right now it seems kitty will happily delete e.g. /tmp/.X11-unix/X0. That sounds fun.

https://sw.kovidgoyal.net/kitty/graphics-protocol/#the-trans...

https://github.com/kovidgoyal/kitty/blob/5541e3c2ff441aea319...

Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by aumerle on Monday August 15, 2022 @08:33AM (#32468848)
Everyone?? No just you. And read the rest of my post. Yes, kitty will delete files in /tmp if asked to. That's what I said. And no unlike your claim, it does not read them. If you cannot tolerate the theoretical possibility of something deleting a file in /tmp ever, then set TEMP before you launch kitty to /tmp/my-mommy-told-me-not-to-put-valuable-things-in-tmp-but-i-didnt-listen
Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by yencabulator on Monday August 15, 2022 @10:53AM (#32470445)
Holy excessive combativeness, Batman!

> And no unlike your claim, it does not read them.

    strace -e open,openat kitty
    printf '\e_Gf=24,s=10,v=20,t=f;%s\e\\' "$(echo -n /etc/passwd|base64)"
    openat(AT_FDCWD, "/etc/passwd", O_RDONLY|O_CLOEXEC) = 14
Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by aumerle on Monday August 15, 2022 @11:13PM (#32478804)
Are you being deliberately obtuse? Yes obviously when asked to display a file, kitty will read it. But it wont send the file contents on the TTY, so the *program sending the request* cannot read it. Which is what we are discussing here. You are trying to make it seem like the ability of a program to get kitty to read an arbitrary file is a security issue. I suggest you go do the following: strace your editor, then ask it to open /etc/passwd, and then be shocked when you see it doing so in the strace log. Seriously, why am I wasting time replying to you.
Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by yencabulator on Monday August 15, 2022 @11:42PM (#32478961)
I'm trying to make it seem like kitty doesn't have very strong security boundaries, and it's a bit of unknown what it can and cannot be made to do.

Me asking my editor to open /etc/passwd is me asking my editor to do something. My terminal emulator opening files and parsing them and deleting them just because I viewed untrusted content is something different. If you want to make that argument, you need to come up with an example where my editor accesses attacker-controlled files because I opened a random README.md.

Also, please read https://news.ycombinator.com/newsguidelines.html, and shove your attitude.

Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by aumerle on Tuesday August 16, 2022 @03:32AM (#32480185)
Ah so classic FUD, "its unknown what it can do". Why dont you spend some effort figuring out what it can actually do instead of making driveby comments with an obvious axe to grind.

You very conveniently left out the fact that pretty much anything that views untrusted content has to parse files. If parsing files is where your "security boundaries" lie, I suggest you drop your computer off at the garbage dump. Hell if your editor has a preview function it too will parse untrusted content. Basically, to do anything software has to parse untrusted content. And just by the way, /etc/passwd is not attacker controlled. If the attacker has access to your filesystem already, she really doesnt need to use kitty to do anything. And "opening" README.md will not cause kitty to parse files, unless by "opening" you mean catting without -v. In which case we are back to your mommy told you to know better but you didn't listen.

At this point its obvious you are deliberately trying to spread FUD. I am done interacting with you. Good bye.

Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by yencabulator on Tuesday August 16, 2022 @12:19PM (#32484921)
Because security is hard nobody should even try?

The general trick with parsing is to put it in a sandbox that cannot touch files, can only do limited syscalls, etc. This is what e.g. Chrome does.

But yes, it's obvious the Kitty author has no interest in making it more secure ( https://github.com/kovidgoyal/kitty/issues/2084) and it's obviously you take discussions about improving software security as attacks on your person.

Have a good day, sir.

Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by aumerle on Tuesday August 16, 2022 @02:09PM (#32486544)
Oh man, this is rich :))) Let me just leave this for posterity. kitty has had a socket for remote control for years: https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.allow_remote... (see socket-only). It can allow remote control from specific windows while disallowing it generally: https://sw.kovidgoyal.net/kitty/launch/#cmdoption-launch-all...

Furthermore the next release of kitty has capability based security for remote control with public key crypto to keep the data safe: https://github.com/kovidgoyal/kitty/discussions/5320

I suggest you find a better place to move the goalposts in your attempts to smear and spread FUD.