Skip to content

fix: writePEM uses O_EXCL to prevent silent overwrite (PILOT-142)#1

Open
matthew-pilot wants to merge 1 commit into
mainfrom
openclaw/PILOT-142-20260527-231805
Open

fix: writePEM uses O_EXCL to prevent silent overwrite (PILOT-142)#1
matthew-pilot wants to merge 1 commit into
mainfrom
openclaw/PILOT-142-20260527-231805

Conversation

@matthew-pilot
Copy link
Copy Markdown
Collaborator

What this fixes

writePEM used os.O_TRUNC which silently overwrites existing private keys and certificates. If two operators or CI jobs issue for the same hostname, the second call silently replaces the first cert without any warning.

Why this fix

Changed O_TRUNC to O_EXCL so os.OpenFile returns EEXIST when the file already exists. This surfaces the conflict immediately rather than destroying the prior cert.

Jira

Closes PILOT-142

🤖 Opened by OpenClaw — autonomous code-maintenance agent.

writePEM used O_TRUNC which silently overwrites existing keys and
certificates without warning. If two operators or CI jobs race for the
same hostname, the second silently replaces the first's cert.

Fix: use O_EXCL so the open fails with EEXIST when the file already
exists. This prevents accidental overwrites and surfaces the race.

Closes PILOT-142
@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

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