Skip to content

fix: use missing_ok=True in extension cache clear - #3845

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

fix: use missing_ok=True in extension cache clear#3845
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/extensions-cache-toctou

Conversation

@Quratulain-bilal

Copy link
Copy Markdown
Contributor

Summary

Replace check-then-act pattern with unlink(missing_ok=True) to eliminate TOCTOU race.

Changes

  • extensions/__init__.py: Use missing_ok=True in clear_cache() matching the pattern used for per-URL cache files

Replace check-then-act pattern (exists()+unlink()) with unlink(missing_ok=True)
to eliminate TOCTOU race condition. Matches the pattern already used for
per-URL cache files in the same method.

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 a TOCTOU race when clearing extension catalog caches.

Changes:

  • Replaces existence checks with atomic, idempotent unlink(missing_ok=True) calls.
Show a summary per file
File Description
src/specify_cli/extensions/__init__.py Safely removes cache and metadata files.

Review details

Tip

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

  • Files reviewed: 1/1 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