Skip to content

Conversation

@MikeVenge
Copy link
Owner

Summary

Implement comprehensive cleanup mechanisms for temporary Google Cloud credentials file to prevent resource leaks and credential exposure on disk.

Changes

  • Add global tracking variable for temporary credentials file path
  • Implement cleanup_temp_credentials() function to safely remove temp file
  • Register cleanup handler in FastAPI shutdown event
  • Register cleanup handler with atexit for normal Python exit
  • Set restrictive file permissions (600) on credentials file
  • Add error handling to ensure cleanup even on credential setup failure
  • Add logging for cleanup operations

Testing

  • Verify temporary credentials file is deleted on application shutdown
  • Verify file permissions are set to 600 (owner read/write only)
  • Verify cleanup occurs on Python interpreter exit
  • Verify cleanup errors are logged appropriately

Notes

The temporary credentials file is now properly cleaned up on normal application shutdown, Python interpreter exit, and credential setup errors. This prevents sensitive Google Cloud credentials from persisting on disk after application termination.

@vercel
Copy link

vercel bot commented Dec 19, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
pddl Ready Ready Preview, Comment Dec 19, 2025 5:13pm

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