Better HN
topnewbestaskshowjobs
Log inSign up

codedokode

9,867 karma · joined Aug 20, 2015 (11y ago) · 5,528 submissions

PHP developer from Russia.
Submissions

comment 3mo ago · link · parent

My conclusions:

- Linux is too complicated and requires lot of knowledge to build a reliable sandbox. If you do not believe me, try reading man capabilities, man user_namespaces (and man clone) and remembering all the rules from the first time. Probably that is because namespaces were implemented in the late stages of development and not since the start.

- it is always better to write your own tools instead of downloading some random project from Github written by amateurs full of vulnerabilities.

- never write shell scripts - they cannot handle spaces and special characters in variables. Just use Python. Shell scripts are worse than PHP4.

- avoid building complex infrastructure with microservices, kubernetes and VMs - if the monolith solves the problem, just use it, you will never properly setup permission on your cloud services.

Also I wish I had some capable model to test my DYI sandboxes.

comment 3mo ago · link · parent

By the way I just read about OpenAI model breaking into Hugging Face and it used "cat /proc/self/mountinfo" to collect information about third-party sandbox it wanted to break from [1]. So my intuition that these files should not be accessible to the sandboxed program, was correct.

[1] https://huggingface.co/blog/agent-intrusion-technical-timeli...

comment 3mo ago · link · parent

It is going to be a difficult task. I looked through examples, and it seems that what they do is represent conditions set out in the law as a boolean expression that answers the question whether something is allowed or not (X is allowed if Y, Z and not W), and display it as a graph/AST. The problem though that the inputs to this expression are answers to non-trivial questions, like "Excudable Educational Assistance" or "Has Felony Drug Conviction" without specifying what exactly is considered a "drug conviction".

comment 3mo ago · link · parent

This is not a "source" for a tax system, but a model written after a law, which is the actual source of truth, and not this model.

comment 3mo ago · link · parent

This is just a dump of plain text files which are nearly useless without markup and adaptation. For example, when a law refers to some article of another law, there should be a hyperlink, but there are no hyperlinks in the repository. Or when a law contains a term, defined elsewhere, you need a hyperlink to the definition of that term. Or when a law says things like "the rules for operating X are set by an Y Ministry", the word "rules" must have a hyperlink to the latest document defining those rules.

Some paragraphs or articles might be temporary amended/repelled by a Constitutional court, or have some related case law, so there must be links or notes.

Just to give you an idea, here is an example of a "proper" commercial law search system with notes and hyperlinks (in Russian, but Firefox translates it without issues): [1]. I noticed that the German system has no markup, so the German site feels like working with code in a notepad, without coloring and "go to definition" after using an IDE. Or like trying to read law from a gazette/journal of legislative acts.

[1] https://www.consultant.ru/document/cons_doc_LAW_37119/823a1b...

comment 3mo ago · link · parent

Very convenient for selective law enforcement.

comment 3mo ago · link · parent

> You can just set ACLs on such files.

I am not sure if I can set ACL or ownership on /proc files, it is not a disk-based filesystem.

> You don't get the ability to mount just because you created an unprivileged user namespace.

Please consult "man user_namespaces", section "Effect of capabilities within a user namespace". It clearly says that one can mount /proc inside a mount namespace governed by a user namespace without being root. The reason why you weren't aware is probably because the rules related to namespaces and capabilities are extremely complicated.

> Vim is a text editor, but you can e.g. have it make a call with ssh to get info from wherever and put that info into the buffer.

I definitely do not want proprietary applications running ssh on my system without me knowing.

comment 3mo ago · link · parent

I also wanted to limit access to files/directories inside /proc/PID, or provide fake data. The /proc/PID also contains too many data.

Also, I might want to provide some fake data, for example, if app relies on reading /proc/cmdline or /proc/cpuinfo. So the app should be able to read the files, but not the real data.

> And most sandboxes disallow unprivileged CLONE_NEWUSER with seccomp

I ma worried that some applications (like Chrome, Electron-based apps) might not work without user namespaces. GTK uses "glycin" library, it launches subprocesses for handling images in a bwrap-based sandbox, and it broke inside my sandbox, so I had to do quick fixes for it.

No, sandboxing in Linux is not easy. Just look at "man capabilities" or "man user_namespaces" and see how many rules and exceptions from rules are there. You need to understand it if you write a sandbox, but it is so complicated. And obviously AI cannot be trusted with such a responsible task.

comment 4mo ago · link · parent

The /proc contains too many unnecessary information, which can be used for fingerprinting or helping an attack. Run `ls /proc` and find yourself surprised. For example, why do applications need to know the kernel command line? What for? Why do they need the list of major and minor device numbers? List of filesystems? Network configuration?

So I want to follow the principle of minimal privileges and only grant access to files needed for running a program. Sadly many programs cannot run without /proc. For example, poorly coded Apple's Grand Central Dispatch library crashes the application (for example, Telegram) if it cannot enumerate the information about threads or processes. It needs this information to calculate how many additional worker threads need to be created, and if it cannot calculate the number, it terminates the application for reasons I do not understand.

There is also a catch that the program can create a new unprivileged user namespace and mount /proc there thus bypassing my daemon completely. Anyone can create a user namespace nowadays.

> Another option may be to set up a container or PID namespace and give your tool direct access to that /proc.

/proc contains information not only about processes, but a lot of extra information.

comment 4mo ago · link · parent

How do you write SELinux policies to allow reading only certain files in /proc, where process IDs are not known ahead? I ended up writing my own FUSE-based /proc emulation. The facilities are there, but it feels like writing your own OS.

comment 4mo ago · link · parent

They do not need this, they require you to create a Microsoft account to use your own computer (currently without a phone number, passport and selfie but that will probably change in the future).

comment 4mo ago · link · parent

Probably Windows constantly pings the MS server and they record those tuples.

comment 4mo ago · link · parent

Stopped using Windows in Windows 7 era, never regretted.

comment 4mo ago · link · parent

Why is there no Kimi 3, and GLM5.2 didn't run the third benchmark? I am more interested in knowing the abilities of open weight models.

comment 4mo ago · link · parent

Do you by chance also have information about Anthropic's training data sources?

comment 4mo ago · link · parent

Smartphones are mostly Chinese now (except for iPhones and Samsung).

comment 4mo ago · link · parent

> Domestic China is the only very large audience for their own models

I don't think so. US models are very expensive, and not available in every country. I am not willing to pay $50/1M tokens for writing my pet projects.

comment 4mo ago · link · parent

But in a safe manner.

comment 4mo ago · link · parent

Cannot non-Chinese closed weights model do the same?

comment 4mo ago · link · parent

If a developer in your company named functions like this, what would you say?

comment 4mo ago · link · parent

And to provide "correct" answers to questions like "island of Taiwan belongs to which country". It seems that there is not single agreed point of view on national borders.

comment 4mo ago · link · parent

Blockchain is unnecessary complicated, for example, it has mining, rewards for those who add new records, even VM and scripts and all of these are not needed for a government registry. I do not need scripts within a land registry.

comment 4mo ago · link · parent

It seems that wpdb doesn't support placeholders for comma-separated lists, like in "WHERE id IN (?)". So the developers have to fall back to string concatenation.

comment 4mo ago · link · parent

One usually uses "query builder" pattern for that.

Also, regarding placeholders, historically many DB and frameworks do not support passing lists for a value in a placeholder (like "WHERE id IN(?)") so users of such software fall back to string concatenation.

comment 4mo ago · link · parent

If every notary is a node, you need some mechanism to ensure they perform only legitimate transactions and constantly monitor them. It is easier to just have a central authority.

comment 4mo ago · link · parent

It doesn't matter, it's a dumb idea anyway because there is a central authority managing the land registry and there is no need for anyone else to be involved.

Also, SQL database is much more convenient to use, it has query language and indices unlike a blockchain.

comment 4mo ago · link · parent

No. Blockchain is made for managing transactions between untrusted parties. In case with a land, there is an authority managing the registry, so a standard relational DB (with optional digital signatures) is the bets option. Why someone wants to use a tool, not good for a specific purpose, for that exact purpose?

comment 4mo ago · link · parent

So that 50% attack results in someone taking all the land? No thanks.

It is a poor idea to use blockchain for government registries. If you want transparency, simply publish signed daily updates and that's enough. Just use simple DB with backups, and optionally, a printer printing changes on a paper.

comment 4mo ago · link · parent

They only paid when they got caught. And not to everyone.
1
141516
185