Skip to content

Fix permissions of atomically-written files#274

Merged
ofek merged 3 commits into
mainfrom
ofek/perms
May 13, 2026
Merged

Fix permissions of atomically-written files#274
ofek merged 3 commits into
mainfrom
ofek/perms

Conversation

@ofek
Copy link
Copy Markdown
Contributor

@ofek ofek commented May 13, 2026

Fix atomic config rewrites so replacement files preserve expected permissions. New config files now respect the user's umask, while rewrites preserve the existing file mode and avoid temporarily exposing private files with broader permissions.

See a workaround in the dev env here. Atomic writes were creating the temporary replacement file with private owner-only permissions, so replacing config.toml made it inaccessible to other users in the same shared group.


new_config[key] = new_value
new_config = new_config[key] # type: ignore[assignment]
new_config = new_config[key]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@datadog-prod-us1-3
Copy link
Copy Markdown

🎯 Code Coverage (details)
Patch Coverage: 85.00%
Overall Coverage: 71.11%

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 4e25056 | Docs | Datadog PR Page | Give us feedback!

@ofek ofek marked this pull request as ready for review May 13, 2026 19:24
@ofek ofek requested a review from a team as a code owner May 13, 2026 19:24
@ofek
Copy link
Copy Markdown
Contributor Author

ofek commented May 13, 2026

I'm merging the fix now as tomorrow is a holiday in the EU and there will be no reviews.

@ofek ofek merged commit 50c5ffb into main May 13, 2026
26 checks passed
@ofek ofek deleted the ofek/perms branch May 13, 2026 22:12
github-actions Bot pushed a commit that referenced this pull request May 13, 2026
* Fix permissions of atomically-written files

* Fix type hint for new release of TOML writing dependency

* Fix tests on non-Windows platforms 50c5ffb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant