frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

NanoChat – The best ChatGPT that $100 can buy

https://github.com/karpathy/nanochat
312•huseyinkeles•3h ago•41 comments

Show HN: SQLite Online – 11 years of solo development, 11K daily users

https://sqliteonline.com/
236•sqliteonline•6h ago•95 comments

From Millions to Billions

https://www.geocod.io/code-and-coordinates/2025-10-02-from-millions-to-billions/
30•mjwhansen•5d ago•1 comments

Android's sideloading limits are its most anti-consumer move

https://www.makeuseof.com/androids-sideloading-limits-are-anti-consumer-move-yet/
257•josephcsible•3h ago•130 comments

Environment variables are a legacy mess: Let's dive deep into them

https://allvpv.org/haotic-journey-through-envvars/
149•signa11•2h ago•89 comments

Spotlight on pdfly, the Swiss Army knife for PDF files

https://chezsoi.org/lucas/blog/spotlight-on-pdfly.html
266•Lucas-C•10h ago•81 comments

More random home lab things I've recently learned

https://chollinger.com/blog/2025/10/more-homelab-things-ive-recently-learned/
150•otter-in-a-suit•1w ago•70 comments

American solar farms

https://tech.marksblogg.com/american-solar-farms.html
155•marklit•9h ago•193 comments

JSON River – Parse JSON incrementally as it streams in

https://github.com/rictic/jsonriver
64•rickcarlino•5d ago•44 comments

Optery (YC W22) – Hiring Tech Lead with Node.js Experience (U.S. & Latin America)

https://www.optery.com/careers/
1•beyondd•2h ago

CRDT and SQLite: Local-First Value Synchronization

https://marcobambini.substack.com/p/the-secret-life-of-a-local-first
12•marcobambini•4d ago•1 comments

The Sveriges Riksbank Prize in Economic Sciences in Memory of Alfred Nobel 2025

https://www.nobelprize.org/prizes/economic-sciences/2025/summary/
101•k2enemy•7h ago•122 comments

Smartphones and being present

https://herman.bearblog.dev/being-present/
121•articsputnik•4h ago•82 comments

MPTCP for Linux

https://www.mptcp.dev/
84•SweetSoftPillow•9h ago•13 comments

AI and the Future of American Politics

https://www.schneier.com/blog/archives/2025/10/ai-and-the-future-of-american-politics.html
75•zdw•4h ago•29 comments

Control your Canon Camera wirelessly

https://github.com/JulianSchroden/cine_remote
70•nklswbr•6d ago•14 comments

Ofcom fines 4chan £20K and counting for violating UK's Online Safety Act

https://www.theregister.com/2025/10/13/4chan_ofcom_fine/
120•klez•4h ago•112 comments

Matrices can be your Friends

https://www.sjbaker.org/steve/omniv/matrices_can_be_your_friends.html
103•todsacerdoti•8h ago•74 comments

A16Z-backed data firms Fivetran, dbt Labs to merge in all-stock deal

https://www.reuters.com/business/a16z-backed-data-firms-fivetran-dbt-labs-merge-all-stock-deal-20...
90•mjirv•4h ago•30 comments

LaTeXpOsEd: A Systematic Analysis of Information Leakage in Preprint Archives

https://arxiv.org/abs/2510.03761
63•oldfuture•10h ago•16 comments

Two Paths to Memory Safety: CHERI and OMA

https://ednutting.com/2025/10/05/cheri-vs-oma.html
42•yvdriess•8h ago•30 comments

Putting a dumb weather station on the internet

https://colincogle.name/blog/byo-weather-station/
131•todsacerdoti•5d ago•36 comments

Clockss: Digital preservation services run by academic publishers and libraries

https://clockss.org/
46•robtherobber•5d ago•8 comments

Roger Dean – His legendary artwork in gaming history (Psygnosis)

https://spillhistorie.no/2025/10/03/legends-of-the-games-industry-roger-dean/
17•thelok•4h ago•2 comments

Programming in Assembly Is Brutal, Beautiful, and Maybe Even a Path to Better AI

https://www.wired.com/story/programming-assembly-artificial-intelligence/
5•fcpguru•27m ago•0 comments

Ask HN: What are you working on? (October 2025)

310•david927•22h ago•865 comments

Jeep software update bricks vehicles, leaves owners stranded

https://www.thestack.technology/jeep-software-update-bricks-vehicles-leaves-owners-stranded/
51•croes•2h ago•3 comments

Tauri binding for Python through Pyo3

https://github.com/pytauri/pytauri
153•0x1997•5d ago•47 comments

Some graphene firms have reaped its potential but others are struggling

https://www.theguardian.com/business/2025/oct/13/lab-to-fab-are-promises-of-a-graphene-revolution...
61•robaato•10h ago•31 comments

Making regular GPS ultra-precise

https://norwegianscitechnews.com/2025/10/making-regular-gps-ultra-precise/
52•giuliomagnifico•6d ago•54 comments
Open in hackernews

Environment variables are a legacy mess: Let's dive deep into them

https://allvpv.org/haotic-journey-through-envvars/
149•signa11•2h ago

Comments

rsyring•1h ago
Environment variables are often used to pass secrets around. But, despite its ubiquity, I believe that's a bad practice:

- On Linux systems, any user process can inspect any other process of that same user for it's environment variables. We can argue about threat model but, especially for a developer's system, there are A LOT of processes running as the same user as the developer.

- IMO, this has become an even more pronounced problem with the popularity of running non-containerized LLM agents in the same user space as the developer's primary OS user. It's a secret exfiltration exploiter's dream.

- Environment variables are usually passed down to other spawned processes instead of being contained to the primary process which is often the only one that needs it.

- Systemd exposes unit environment variables to all system clients through DBUS and warns against using environment variables for secrets[1]. I believe this means non-root users have access to environment variables set for root-only units/services. I could be wrong, I haven't tested it yet. But if this is the case, I bet that's a HUGE surprise to many system admins.

I think ephemeral file sharing between a secret managing process (e.g. 1Password's op cli tool) and the process that needs the secrets (flask, terraform, etc.) is likely the only solution that keeps secrets out of files and also out of environment variables. This is how Systemd's credentials system works. But it's far from widely supported.

Any good solutions for passing secrets around that don't involve environment variables or regular plain text files?

Edit: I think 1Password's op client has a good start in that each new "session" requires my authorization. So I can enable that tool for a cli sessions where I need some secrets but a rogue process that just tries to use the `op` binary isn't going to get to piggyback on that authorization. I'd get a new popup. But this is only step 1. Step 2 is...how to share that secret with the process that needs it and we are now back to the discussion above.

1: https://www.freedesktop.org/software/systemd/man/latest/syst...

robertlagrant•1h ago
> On Linux systems, any user process can inspect any other process of that same user for it's environment variables. We can argue about threat model but, especially for a developer's system, there are A LOT of processes running as the same user as the developer.

This is a very good point I'd never realised! I'm not sure how you get around it, though, as if that program can even find a credential and decrypt a file, if it runs as the user then everything else can go find that credential as well.

rsyring•1h ago
I added a note to my original post about how 1Password's cli tool work. Access to the binary doesn't mean automatic access to any authorized session. I think that's a good start. In my case, I have it tied into my fingerprint reader, so if something want's access to a secret using `op` I get a prompt to authorize. If I haven't just called `op` myself, I know it's a suspect request.
chasil•58m ago
If a root exploit is leveraged, then /proc/*/environ of all processes is visible to the adversary.

The classical alternative has been to store (FTP) credentials in a .netrc file (also used by curl).

I have some custom code to pull passwords out of a SQLite database.

For people who are really concerned with this, a "secrecy manger" is more appropriate, such as Cyberark conjur and summon, or Hashicorp Vault.

formerly_proven•1h ago
--passphrase-fd was always the correct thing to do (gpg has had it for ages), but support for that is very meager. I mean, you can’t even kubectl login using environment variables, you pretty much have to pass tokens through command-line arguments and we’ve known that’s terrible for around forty-five years.
bbkane•1h ago
Any good cross-platform and easy ways to share secrets without using environment variables?
zdc1•1h ago
Point to a file? E.g. `CONFIG_PATH=/etc/myapp/config.ini /opt/myapp`

That being said, I still use env vars and don't plan on stopping. I just haven't (yet?) seen any exploits or threat models relating to it that would keep me up at night.

maccard•1h ago
How do you get that file?

I also use env vars.

matthew16550•23m ago
SOPS can be part of the solution. It takes care of encrypting and decrypting config files.

https://github.com/getsops/sops

skylurk•1h ago
I've used keyring, but ultimately does not solve the issue of every application running under the same user.

https://pypi.org/project/keyring/

cedws•1h ago
Linux security model is pretty broken without namespaces. systemd has some bells and whistles that help but if you want something better than environment variables you're naturally going to reach for cgroups.
throwaway127482•1h ago
cgroups aren't relevant here, I think. Not sure if that was just a typo, since you did mention namespaces in the first sentence. PID and user namespaces in particular are relevant here.
cedws•1h ago
Yeah seems you're right, I thought namespaces came under the cgroups umbrella.
ux266478•1h ago
Linux's namespaces are not a security mechanism. Please do not use them as one.
cedws•1h ago
I've said exactly the same thing on HN myself. However for this problem what do you suggest? Using namespaces is better than using no namespaces.
jcgl•56m ago
Is there consensus around that? Given how containers and bubblewrap/flatpak are considered (to some degree) security boundaries, I approach statements like this with skepticism.
1718627440•50m ago
Linux/Unix security model is that different actors are represented by different OS users. When you don't do that, it's already like inviting the burglars in your living room.
mhitza•1h ago
> Any good solutions for passing secrets around that don't involve environment variables or regular plain text files?

memfd_secret comes to mind https://man7.org/linux/man-pages/man2/memfd_secret.2.html

I haven't seen much language support for it, though. On one part maybe because it's Linux only.

People that write in Rust (and maybe Go, depends how easy FFI is) should give it a try.

I wanted for a time to get some support for it in PHP, since wrapping a C function should be easy, but the thought of having to also modify php-fpm put a dent in that. I can't and don't want to hack on C code.

In practice it'd be great if the process manager spawn children after opening a secret file descriptor, and pass those on. Not in visible memory, not in /proc/*/environ

llimllib•1h ago
For go, it's available in /x/sys/unix: https://pkg.go.dev/golang.org/x/sys/unix#MemfdSecret
monocasa•57m ago
Oh, I like that.

You should be able to build up a nice capability model to get access to those memfds from daemon too rather than having to spawn out of a process manager if that model fits your use case a bit better.

bjourne•1h ago
If are like most users you have secrets stored in read-protected files in ~/.ssh. There's nothing wrong with that.
amluto•1h ago
Since at least 2012, environment variables have been at least as secure as ordinary memory:

    commit b409e578d9a4ec95913e06d8fea2a33f1754ea69
    Author: Cong Wang <xiyou.wangcong@gmail.com>
    Date:   Thu May 31 16:26:17 2012 -0700
    
        proc: clean up /proc/<pid>/environ handling
You can't read another process's environment unless you can ptrace-read the process, and if you can ptrace-read the process you know all its secrets anyway.

cmdline is a different story.

rsyring•1h ago
I've never tried to use ptrace-read to read secrets from a running process's memory so I can't comment on that part.

I had always assumed getting secrets from a running process' memory was non-trivial and/or required root permissions but maybe that's a bad assumption.

However, reading a process' environment is as trivial as:

`cat /proc/123456/environ`

as long as it's ran by the same user. No ptrace-read required.

intorio•7m ago
You do need PTRACE access to pid 123456 in order to access that file. It is transparent to you, but the kernel will use the current task's PTRACE_ATTACH access when attempting to get that information.

By default, on most distributions, a user has PTRACE_ATTACH to all processes owned by it. This can be configured with ptrace_scope:

https://www.kernel.org/doc/Documentation/security/Yama.txt

marcosdumay•37m ago
Just to clarify, that means that by default every process of the same user can access the variables. But it doesn't really matter because by default every process of the same user can read any secret directly from the target process anyway, right?

And that the right thing to do if you want to harden your system is to disallow ptrace-read, and not bother changing software that uses environment variables?

Because I think most people that just try will be able to read the variables of any process on their computer.

nine_k•18m ago
Yes, you can consider all processes running under the same user as able to peek at each other's data. This is the point of running under the same uid: sharing data.One uid should be considered one security domain, with any separators inside it being guardrails, not brick walls.

If you want to prevent other processes from peeking into your process, run it under a different uid. Again. that's the point. A bunch of good software does that, running only small privileged bits in separate processes, and running some / bulk of the processes under an uid with severely limited privileges. See e.g. Postfix MTA, or the typical API server + reverse proxy split.

I don't think that this part of Unix is somehow problematic, or needs changing.

amluto•5m ago
I think this part of Unix is exceedingly problematic. I want to be able to run program that don't have the ability to do anything that I, personally, can do. Ideally this would be doable without nasty kludges or root's help.

Linux has some ways to accomplish this, for example:

- seccomp. It can be done quite securely, but running general purpose software in seccomp is not necessarily a good way to prevent it from acting like the running user.

- Namespaces. Unless user namespaces are in use, only root can set this up. With user namespaces, anyone can do it, but the attack surface against the kernel is huge, mount namespaces are somewhat porous (infamously, /proc/self/exe is a hole), and they can be a bit resource-intensive, especially if you want to use network namespaces for anything interesting. Also, user namespaces have kind of obnoxious interactions with ordinary filesystem uids (if I'm going to run some complex containerized stack with access to a specific directory within my home directory, who should own the files in there, and how do I achieve that without root's help?). And userns without subuid doesn't isolate very strongly, and subuid need's root's help.

- Landlock. Kind of cool, kind of limited.

- Tools like Yama. On Ubuntu, with Yama enabled (the default), programs can't generally ptrace (or read /proc/self/environ) from other programs running as the same user.

In any case, once you've done something to prevent a process from accessing /proc/fd/PID for other pids belonging to the same user (e.g. pidns) and/or restricted ptrace (e.g. PR_SET_DUMPABLE), then environ gets protected.

vendiddy•1h ago
Not an answer, but I do wish there was a low level primitive and a corresponding high level language construct to pass around secrets.

Something like: my_secret = create_secret(value)

Then ideally it's an opaque value from that point on

1718627440•50m ago
my_secret = getenv ("VALUE");

:-)

motorest•1h ago
> Environment variables are often used to pass secrets around. But, despite its ubiquity, I believe that's a bad practice:

I think environment variables are recommended to pass configuration parameters, and also secrets, in containerized applications managed by container orchestration systems.

By design, other processes cannot inspect what environment variables are running in a container.

Also, environment variables are passed to child processes because, by design, the goal is to run child processes in the same environment (i.e., same values) as the parent process, or with minor tweaks. Also, the process that spawns child processes is the one responsible for set it's environment variables, which means it already has at least read access to those secrets.

All in all I think all your concerns are based on specious reasoning, but I'll gladly discuss them in finer detail.

rsyring•58m ago
Please note that in my OP, I never mentioned containers.

Let's say, as a developer, I need to do some API interactions with GitHub. So, in a terminal, using 1Password's cli tool `op`, I load my GH API token and pass it to my Python script that is doing the API calls.

Presumably, the reason I use that process is because I want to keep that token's exposure isolated to that script and I don't want the token exposed on the filesystem in plaintext. There is no reason for every process running as my user on my laptop to have access to that token.

But, that's not how things work. The Claude agent running in a different CLI session (as an example) also now has access to my GitHub token. Or, any extension I've ever loaded in VS Code also has access. Etc.

It's better than having it in plain text on the file system but not by much.

Additionally, unless I've misunderstood the systemd docs, if you are passing secrets through environment variables using unit's `Environment` config, ANY USER on a server can read those values. So now, we don't even have user isolation in effect.

My reasoning is pretty plain. It could be wrong, but it's hardly specious.

rustyminnow•51m ago
I think in the context of containers you're right, there's a level of isolation and secrets are probably fine. But I think under other contexts that lack that isolation (e.g. bare-metal processes, local dev tooling) there are extra concerns.

(inb4: container env-vars are isolated from other containers, not from processes on the host system)

jkrejcha•40m ago
> - On Linux systems, any user process can inspect any other process of that same user for it's environment variables. We can argue about threat model but, especially for a developer's system, there are A LOT of processes running as the same user as the developer.

Here's the thing though, the security model of most operating systems means that running a process as a user is acting as that user. There are some caveats (FreeBSD has capsicum, Linux has landlock, SELinux, AppLocker, Windows has integrity labels), but in the general case, if you can convince someone to run something, the program has delegated authority to act on behalf of that user. (And some user accounts on many systems may have authority to impersonate others.)

While it's by no means the only security model (there exists fully capability based operating systems out there), it's the security model that is used for most forms of computing, for better or worse. One of the consequences of this is that you can control anything within your domain. I can kill my own processes, put them to sleep, and most importantly for this, debug them. Anything I own that has secrets can grab them my ptrace/process_vm_readv/ReadProcessMemory/etc.

Narushia•35m ago
> Any good solutions for passing secrets around that don't involve environment variables or regular plain text files?

Honestly, my answer is still systemd-creds. It's a few years old by now, should be available on most distros. It's easy to use and solves the problem. Although credential support for user-level systemd services was added just a few weeks ago.

mixmastamyk•35m ago
You've described the classic Unix security model, with minor improvements. While decent for the time it is showing its age. Specifically the difficulty in adapting to cheap, ubiquitous computing which it wasn't designed for.

If you need to keep secrets from other processes—don't run them under the same user account. Or access them remotely, although that brings other tradeoffs and difficulties.

simonask•1h ago
Interesting read. Another interesting fact is that `setenv()` is fundamentally broken on POSIX, and should essentially never be called in library code. In application code, it should be called only in the absence of any alternative, and certainly before any threads have started.

The reason is that `getenv()` hands out raw pointers to the variables, so overwriting a variable using `setenv()` is impossible to guard against. Treat with extreme caution.

wmf•1h ago
AFAIK Solaris solved that problem but Linux refuses to copy their solution.
foofoo12•1h ago
Link?
ori_b•1h ago
Their solution was that setenv leaks memory rather than overwriting in place.

FreeBSD does the same. See here for discussion: https://freebsd-current.freebsd.narkive.com/NwqZQDWm/fix-for...

monocasa•1h ago
Sure. But practically the amount you leak is infinitesimal.

For a lot of applications that's the right call given the rest of the posix semantics you're constrained to and the kinds and frequency of data you pass via env vars.

cbsmith•55m ago
An infinitesimal leak becomes a problem if it is done an infinite number of times...

execve seems like the preferable choice on a lot of grounds.

Analemma_•1h ago
IIRC the Solaris implementation of getenv()/setenv() leaks memory, because they want it to still be POSIX-compatible and the POSIX API has a "obey the spec, don't leak memory, be thread-safe -- pick 2" thing going on and you can't actually have a bug-free solution that keeps compatibility with decades of Unix applications.

Arguably that's less harmful than the thread-safety issues on Linux, but there's no perfect solution here as long as POSIX stays what it is.

nrds•1h ago
I think it's worth specifically calling out that the right way to set environment variables is in execve() only, as communication across an exec() is the precise niche for which they are the right tool.
sureglymop•1h ago
Why are they the right tool for that instead of passing data with program args or another way of IPC?
fullstop•44m ago
Program args can be seen with tools like 'ps', so passing credentials that way is a poor choice.
skissane•7m ago
NetBSD has had getenv_r for ages, [0] and I believe FreeBSD has very recently copied it. [1] If FreeBSD has it, macOS might eventually adopt it too. People tried already to get it into both glibc and POSIX, and it was rejected, but if it becomes more common on other platforms, that increases the chance they’ll both eventually accept it.

[0] https://man.netbsd.org/getenv_r.3

[1] https://github.com/freebsd/freebsd-src/commit/873420ca1e6e8a...

shmerl•1h ago
> POSIX-specified utilities use uppercase envvars, but that’s not prescriptive for your programs. Quite the contrary: you’re encouraged to use lowercase for your envvars so they don’t collide with the standard tools.

> But in reality, not many applications use lowercase. The proper etiquette in software development is to use ALL_UPPERCASE

I always prefer lower case for env variables in scripts. Thanks for pointing out that it can help reduce clashes with standard tools.

amelius•1h ago
Another legacy mess:

    Argument list too long
It's absolutely crazy that this isn't a dynamically resizable vector.
formerly_proven•1h ago
It is, there’s just a limit set by the kernel for the number of pages the command line as a whole can occupy or something like that.
amelius•1h ago
No, it's still an artificial limit, even if you can change it (usually after your command has failed).
chasil•52m ago
The xargs command was designed to address this. From this perspective, it is a kludge.
the__alchemist•1h ago
I get anxiety whenever I need to set an environment var on Linux. There are (somewhat distro-specific) ways that work properly, but the usual procedures you find online stops working once you reboot (or close the terminal I think?). They should add a simple env var GUI like Windows has that just works, and isn't terminal-specific. Windows has the annoyance of needing to restart the the terminal (or open a new one) for changes to take effect, but works well other than that.
zdragnar•1h ago
> but the usual procedures you find online stops working once you reboot (or close the terminal I think?)

The environment isn't persistent between sessions. That means you need to make the change in a way that runs on every new session (login or new terminal window).

Depending on how your system is configured:

.bash_profile gets run once on every login

.bashrc gets run once on every non-login new session (i.e. a new terminal window)

It's typical, if using these files, to do something like this:

    if [ -f ~/.bashrc ]; then
        source ~/.bashrc
    fi
in the .bash_profile file, putting most other things in .bashrc, such that you don't have to worry about the distinction.

If you're not even using bash or bash-likes at all, but instead something like Zsh, fish, etc you'll need to set things the way they want to be set there.

> They should add a simple env var GUI like Windows has that just works, and isn't terminal-specific

This doesn't exist in linux, because there isn't "one place" that all possible terminals draw from. Conceivably, it's possible to write a GUI tool that reads your .bashrc file, looks for anything that resembles a variable, parses the bash code to look for ways it is set, and then present a GUI tool that could update it in common cases, but... it's way easier to just write the change in a text editor.

petre•52m ago
> Conceivably, it's possible to write a GUI tool that reads your .bashrc file

What's wrong with an envfile or envdir? The envdir is kind of annoying but at least you can set permissions on the files inside it.

jcelerier•1h ago
Funny, as a primarily linux user the windows behaviour irks me to no end, it's the cause of so many recurrent problems on end-user machines with so many apps that pollute environment.. and then you wonder why something doesn't work and then it turns out that for some reason you're using $SOFTWARE from c:\Perl64\bin instead of its proper place
NekkoDroid•52m ago
On systemd systems you can just either set KEY=VALUE pairs in `/etc/environment` or any file in `/etc/environment.d/` (and technically a few other places [0]). In theory it should be relatively easy to write a GUI for it by manually parsing the files.

The application restarting part can't really be fixed, since environment variables aren't ever injected to a running process and can only be changed by the process itself (terms and conditions may apply) and even changes during runtime could be ignored since the program itself may have cached some already computed value based on the variable.

[0]: https://www.freedesktop.org/software/systemd/man/latest/envi...

the__alchemist•48m ago
Good info. I may write a script or tiny program to help with this.
csours•19m ago
https://xkcd.com/927/ - Standards

Situation: There are 14 competing ways to set environment variables on Linux

We should create a universal way that just works and isn't terminal specific to set environment variables!

Situation: There are 15 competing ways to set environment variables on Linux

bjourne•1h ago
We're almost rid of dotfiles in $HOME. Can we please also get rid of the abuse of environment variables for configuration? There is no reason your program needs to muck up the environment table of every process by defining MY_PROGRAM_API_KEY instead of taking a command line argument or reading a configuration file. It's not "secure" just because it's not on the command line. And it will mess up for users because it's nigh impossible to ensure you have the same environment variables over all login types. The variable might be there when you run locally, but not in an ssh session or cron. Some ephemeral configuration such as LD_LIBRARY_PATH and PWD is difficult to handle without environment variables, but those are rare exceptions and not the norm.

Contribute to a clean environment! Don't use environment variables for configuration! </rant>

1718627440•1h ago
This problem is also removed by just not exporting the variables. Also you can just pass an envp to execvE.
bjourne•33m ago
"MY_APP_SECRET_KEY=bla myapp" hardly accomplishes anything substantial over "myapp --secret-key=blah" It's just a less robust and less well-supported command-line interface. It's not supported by most gui launchers, PowerShell, nor many cron implementations, for example.
phito•58m ago
They're the standard for Docker container configuration tho. Otherwise I do agree.
mixedbit•56m ago
Depending on your system, passing secrets via environment can be more secure than passing secrets via a command line. Command line arguments of all running processes can be visible to other users of the system, environment variables are usually not.
aleksandrm•1h ago
That was a hard to read font.
lemontheme•1h ago
Huh... Guess it's what you're used to.

First thing that struck me about the site is how beautiful I found it. I even inspected the font: Iosevka Web, apparently.

db48x•1h ago
Change your browser settings. You can tell the browser what font you prefer to use, and set minimum font sizes. You can also turn off remote fonts, so that pages can only use fonts you already have. Then you can just uninstall any fonts you don’t like or that you cannot read easily.
WalterBright•1h ago
I gave up on environment variables long ago. Now my compilers read a dmd.conf file that is in the same directory as the compiler executable.
m3047•1h ago
...and people have to find special ways to set them. I didn't even know that pam_env existed until a recent security vulnerability announcement. It's never come to my attention before, I don't think I've ever seen it utilized. I've now made a runbook item to disable it. It's a shame that "configuration" includes undoing the fetishes and helpfulness [0][1] of others.

  pam-config -d --env
[0] Crowded elevator atrium. Multiple elevators running. Elevator wants to close, another one is coming (oh! I heard it "ding"!). Somebody is holding the elevator which wants to depart and trying to wave me in. Why doesn't somebody push them out?

[1] I'm at a stop sign. Some complete idiot is trying to turn left onto the street I'm leaving and waving me to turn left in front of them. Fuck no! I turn in front of you, somebody rearends you, you fly forward into me: my fault! You should be able to make this turn, if you can't go around the block! [2]

[2] I could go out of my way and turn right. Or I can just wait and see what happens.

stackskipton•1h ago
SRE/Sysadmin/DevOps/Whatever here, while blog didn't talk about doing anything difficult but setting ENVVAR standards, I will point out all replacements are just as frustrating especially when talking about secrets.

Anything involving vaults where Application reaches out to specific secret vault like Hashicorp Vault/OpenBao/Secrets Manager quickly becomes massive vendor lock in where replacement is very difficult due to library replacement and makes vault uptime extremely important. This puts Ops in extremely difficult place when it becomes time to upgrade or do maintenance.

Config files have problem of you have secrets, how do you get them into config file since config files are generally kept in public systems? Most of the time it's some form of either "Template replacement by privileged system before handing it to application" or "Entire Config File gets loaded into secret vault and passed into application". Templating can be error prone and loading entire config files into secret manager is frustrating as well since someone could screw up the load.

Speaking of config files, since most systems are running containers, and unless you are at Ops discipline company, these config files are never in the right place, it becomes error prone for Ops to screw up the mounting. Also, whatever format you use, JSON/YAML/TOML is ripe for some weird config file bug to emerge like Norway problem in YAML.

Getting secrets from Kubernetes Secrets API I've seen done but lock in again. I'd strongly not recommend this approach unless you are designing a Kubernetes operator or other such type system.

I will say I've seen Subprocess thing bite people but I've seen less and less subprocess generation these days. Most teams go with message bus type system instead of sub processing since it's more robust and allows independent scaling.

jppittma•59m ago
How is the kubernetes secret API lock in? Genuinely wondering - were you trying to use that deployment yaml for something other than a kubernetes deployment? For most applications, you should be mounting the secret on your application, then you can inject it as either an environment variable or a json file that your application reads in an environment agnostic way.

Then, on the backend, you can configure etcd to use whatever KMS provider you like for encryption.

stackskipton•53m ago
Because you can't run the container, even for development outside Kubernetes.

Yes, you can mount Secrets as Volumes or Env Var in Kubernetes which is fine but I'm not talking about "How you get env var/secret" but "Methods of dealing with config."

Nilocshot•48m ago
This is where I like things like Tilt. If you're deploying to a k8s cluster, it's probably a good idea to do local dev in as close to a similar environment as possible.

Bit more of an initial hurdle than "just run the docker image"; however.

stackskipton•32m ago
I've look at Tilt and it's another abstraction for Kubernetes which rarely ends well at scale.

However, most of time, Devs don't need to develop on Kubernetes since it's just Container Runtime and Networking Layer they don't care about. They run container, they connect to HTTP endpoint to talk to other containers, they are happy. Details are left to us Ops people.

jppittma•24m ago
Yes you can? The container should be completely agnostic to the fact that it's running in kubernetes. You can do config the same way. Configmaps are mounted as regular files and environment variables. The application doesn't care if the configmap came from the cluster resource or a file your created on your dev machine with dev credentials. You can mount local files into the container yourself. It's docker run -v "source:destination" I think.
stackskipton•9m ago
sigh I’m extremely competent Ops type and I know. If you mount secrets as Volume or Env Var, that’s Config file or Env var from Application PoV. We are looking at this from Application PoV.

I’ve seen Applications that do direct calls to Kubernetes API and retrieve the secret from it. So they have custom role with bindings and service account and Kubernetes client libraries.

cassianoleal•2m ago
Don’t use live system secrets and credentials when running your application locally. Then you don’t need to access the same secrets.

Keep it simple and design your applications so they’re agnostic to that fact.

It’s really not that hard, I’ve been doing this for at least 6 or 7 years. A little bit of good engineering goes a long way!

1718627440•55m ago
You can have a command setting that is invoked to get the string. This way you don't have vendor login, but also don't need a separate template step.
stackskipton•51m ago
You still need to present that to Application.

So Command Line leaks worse than Env Var.

Config file, see original post for problems.

Env Var, see blog for problems.

1718627440•37m ago
No I meant a property in the application config.

For example mbsync/isync does this.

stackskipton•30m ago
You have a config file, it needs to have secrets so likely you are going to run some templating system where you replace dbpassword: ${dbPassword} with password from some secret system. Hopefuly you understand possible issues with any templating system that could result in replacement failures.

String manipulating is one of those "This is easy" until it's not.

1718627440•9m ago
Apparently I'm still unclear.

I don't mean to hardcode secrets into the config file either. I was suggesting to put a command into the configuration file that the application then calls to get the secret. This way the secret is only ever passed over a file descriptor between two processes.

jhallenworld•1h ago
Eh, they are just more command line arguments, ones that go on the left side of the command instead of the right. I guess an alternative is something the Windows registry, but I'm not seeing that as a great improvement since it's less direct.
compiler-guy•1h ago
Command-line arguments aren't passed to subprocesseses, can't be inspected by arbitrary functions in the same process, and don't leak memory if they are changed.
jhallenworld•45m ago
Yes, I'm just highlighting that it's just as convenient to change them as command line parameters on a per-invocation basis. If there is a proposal for something else, it should retain this capability. Config files and something like the windows registry are much less convenient.
zokier•41m ago
> can't be inspected by arbitrary functions in the same process

You can not really rely on that. The initial stack layout is well-defined at least on linux, so digging up argv is not difficult. Or just open /proc/self/cmdline

jonny_eh•57m ago
I can't recommend Varlock [1] enough. A great way to manage env vars in a project. It lets you define which ones are necessary or optional, their types, and where they should be fetched from.

[1] https://varlock.dev/

peter_d_sherman•50m ago
>"Wow, I really enjoyed writing this… …and I hope it wasn’t a boring read."

No, it was very interesting actually!

An excellent deep-dive into the murky area of Unix/Linux environment variables, how they are set, how they are passed, what's really going on behind the scenes.

Basically a must-read for any present or future OS designer...

Observation (if I might!) -- environment variables are to programs (especially chains of programs, parent processes, sub processes and sub-sub processes, etc.) what parameters are to functions -- and/or what command-line parameters are... they're sort of like global variables that get passed around a lot...

They also can influence program behavior -- and thus the determinism of a program -- and thus the determinism of a chain of programs...

Phrased another way -- software that works on one developer's machine might not work on another developer's machine and/or in a production environment because one crucial environment variable was either set or not set, or set to the wrong value...

(NixOS seems to understand this pretty well... that "hermetically sealing" or closing or "performing a closure around" (that's probably slightly the wrong language/terminology in "Nix-speak" but bear with me!) a software environment, including the environment variables is the way to create deterministic software builds that run on any machine... but here I'm digressing...)

But my main point: I complete agree with the article's author -- environment variables are a legacy mess!

Although, if we think about it, environment variables (if we broaden the definition) are a sub-pattern of anything that affects the state of an individual machine or runtime environment -- in other words, things such as the Windows Registry, at least the global aspects of it -- are also in the same category.

Future OS's, when they offer environments for programs or chains of programs to run -- should be completely containerized -- that is, the view of the system -- what data/settings/environment variables/registry variables/files/syscalls/global variables it has access to -- should be completely determinable by the user, completely logabble, completely transparent, and completely able to be compared, one environment to another.

In this way, software that either a) fails to work at all b) works in a non-deterministic way -- can be more easily debugged/diagnosed/fixed (I'm looking at you, future AI's that will assist humans in doing this!) -- then if all of that information is in various different places, broken, and/or opaque...

To reiterate:

>"Wow, I really enjoyed writing this… …and I hope it wasn’t a boring read."

No, I really enjoyed reading it(!), it's a brilliant article, and thank you for writing it! :-)

Upvoted and favorited!

alexpotato•48m ago
To give an illustration of how bad this can get:

At a past firm, I was trying to debug how a particular ENV var was getting set. I started out thinking it was something simple like the user's .bashrc or equivalent.

I quickly realized that there were roughly 10 "layers" of env var loadings happening where the first couple layers were:

- firm wide

- region

- business unit

- department

- team etc etc

I ended up having to turn on a bash debug flag so that I could see exactly where the var was getting set in the layer stack.

pluto_modadic•3m ago
static secrets that you can even extract and set in a config file (or store in a secrets manager) need to go. TPM secrets that you can't extract, and public keys that you can pin without considering them "secret", along with Oauth / IAM roles, are the way to go.