Skip to content

fix: eliminate TOCTOU race in file unlink calls - #3811

Open
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/toctou-race-unlink
Open

fix: eliminate TOCTOU race in file unlink calls#3811
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/toctou-race-unlink

Conversation

@Quratulain-bilal

Copy link
Copy Markdown
Contributor

Replace if path.exists(): path.unlink() with path.unlink(missing_ok=True) in integrations/_helpers.py and extensions/init.py to eliminate TOCTOU race conditions where the file could be removed between the check and the unlink.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Eliminates TOCTOU races when deleting integration metadata and extension cache files.

Changes:

  • Uses atomic unlink(missing_ok=True) operations.
  • Preserves behavior when target files are absent.
Show a summary per file
File Description
src/specify_cli/integrations/_helpers.py Safely removes integration metadata.
src/specify_cli/extensions/__init__.py Safely clears catalog cache files.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Medium

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.

3 participants