Live data from Hacker News

Man who thought opening a TXT file is fine thought wrong

paulosyibelo.com

311–316 of 316 posts

Re: Man who thought opening a TXT file is fine thought wrong

#311
post #288
post #248

Earlier quoted context omitted.

Optimizing for "simple" for the sake of robustness is exactly backward. > visible and understandable False. Something is neither visible nor understandable if it's misleading - which file extensions are. There are absolutely no guarantees that a file extension will match file contents, and that assumption can cause security risks - like in this article. An actually good alternative is to encode file type as metadata,…

> There are absolutely no guarantees that a file extension will match file contents, and that assumption can cause security risks Only in software that ignores the extension. > An actually good alternative is to encode file type as metadata, instead of inside the file contents or file-name, and then configure viewers to display it. That, while not "simple", is also visible and understandable to the user, while simult…

> Only in software that ignores the extension

No, only in software that blindly follows file extensions.

Re: Man who thought opening a TXT file is fine thought wrong

#312

Oh, man. The idea that TextEdit automatically parsed .txt files as HTML if they started with a certain file signature is problematic... ...but the fact that file:// schemes can access remote files by appending /net/ followed by a domain name is pretty shocking. I mean, the entire purpose of "file://" would seem to be to provide access to local/mounted files and only those. The fact that a Mac engineer thought it woul…

The extension is meaningless outside of Windows...

No

Re: Man who thought opening a TXT file is fine thought wrong

#313
post #288

Earlier quoted context omitted.

> There are absolutely no guarantees that a file extension will match file contents, and that assumption can cause security risks Only in software that ignores the extension. > An actually good alternative is to encode file type as metadata, instead of inside the file contents or file-name, and then configure viewers to display it. That, while not "simple", is also visible and understandable to the user, while simult…

> Only in software that ignores the extension No, only in software that blindly follows file extensions.

The problem is that the text editor ignored the extension of the txt file. That's what lead to unsafe behaviour - the user thought the file was fine to open because the extension was txt, and improving users is not practical.

The exact same thing would happen with metadata - indeed file extensions are just a form of metadata - if the metadata says this is a text file but the application ignores it, we would have the exact same issue.

Re: Man who thought opening a TXT file is fine thought wrong

#314
post #231

Earlier quoted context omitted.

File extensions are simple and, crucially, visible and understandable to the user. They're far better than any proposed alternative.

They are also trivial to get wrong, can be mangled when the files are moved around, and are easy to use as an attack vector. They are not far better than the alternatives, it's just that no alternative reached a critical mass due to them not being how Windows works.

> They are also trivial to get wrong, can be mangled when the files are moved around, and are easy to use as an attack vector.

On the contrary, they're the only kind of metadata that doesn't get mangled when files are moved around, and they're far less of an attack vector than other approaches. Of course you can set the wrong file type, but no approach avoids that problem.

Re: Man who thought opening a TXT file is fine thought wrong

#315
post #253

Earlier quoted context omitted.

If you follow the everything is a file philosophy it seems quite natural does it not?

Except permissions aren't granular enough / are too confusing, it's a giant footgun with the current Linux architecture, which doesn't have all the nice things Plan9 does

I didn't say that the everything is a file philosophy is necessarily correct and well implemented on Linux. Merely that if you where to continue along this direction it would seem like a logical next step. I don't think I would use this for anything but for shell scripts at best. However especially if you are a plan 9 fanatic then it would seem like quite a good idea which is what the original question was.

Re: Man who thought opening a TXT file is fine thought wrong

#316

Earlier quoted context omitted.

I mean, unless you're host is extremely locked down you'll probably also have telnet,netcat, etc installed, so no great difference.

Anything you can do in telnet or netcat can also be done in python, perl, ruby. One of those is likely installed, most probably python.

And if you think about if all applications where using files for communication blocking one program from the internet would be as simple as a chmod.
Post reply on HN