infra icon indicating copy to clipboard operation
infra copied to clipboard

fix(envd): handle TOCTOU race in EnsureDirs mkdir

Open beran-t opened this issue 8 months ago • 1 comments

Summary

  • Fix TOCTOU race condition in EnsureDirs where two concurrent calls both see a directory as non-existent via os.Stat(), both call os.Mkdir(), and the second fails with "file exists"
  • Ignore os.IsExist errors from os.Mkdir so concurrent directory creation is safe

Test plan

  • [ ] Verify go build ./... passes for envd package
  • [ ] Verify existing tests pass: go test ./internal/permissions/...

beran-t avatar Mar 10 '26 17:03 beran-t

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. Credits must be used to enable repository wide code reviews.