Check permissions on configuration file, not symlink #687
No reviewers
Labels
No labels
approved, awaiting change
bug
configuration
documentation
duplicate
enhancement
extremely low priority
feature request
Fix it yourself
help wanted
invalid
mastodon_api
needs docs
needs tests
not a bug
planned
pleroma_api
privacy
question
static_fe
triage
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: AkkomaGang/akkoma#687
Loading…
Reference in a new issue
No description provided.
Delete branch "erincandescent/akkoma:config-stat-symlink"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When deploying something on Kubernetes, the idiomatic way to inject a configuration file into the container is to mount a ConfigMap. However, when mounted, a ConfigMap contains symlinks which point at the actual files; something along the lines of
(No I don't know why Kuberntes does this. I'm sure it has its reasons, maybe related to ConfigMap updates)
Now, the funny thing about symlinks is that on most Unixes (except macOS and FreeBSD with a specific mount option), symlinks don't have permissions of their own. In fact, they're hardcoded to return most bits enabled when responding to a
lstat(2)
call; all access controls are done on the target file instead.So use of
lstat(2)
here results in a false positive; we should usestat(2)
instead, which follows the symlink.(My current work around is to copy the config file into a tmpfs, which is deeply ugly)
Some discussion here
hm well that's some unusual interaction
but seems good to me(tm)