🔒 Secure DigiKey OAuth Token Storage Permissions - #9
Conversation
Replaced simple open() with os.open() using 0o600 permissions and explicit os.chmod() when writing DigiKey token data to ensure the file is only readable/writable by the owner. Co-authored-by: aman-katyal <181611364+aman-katyal@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
🎯 What: This PR fixes an insecure storage vulnerability where DigiKey OAuth access and refresh tokens were being written to a local file (
digikey_token.json) with default system file permissions. It restricts the permissions of this file to0o600(read and write by the owner only).🛡️ Solution: The fix replaces the simple
open()call withos.open()using explicitos.O_CREAT | os.O_WRONLY | os.O_TRUNCflags and a mode of0o600. Additionally, an explicitos.chmod()call is added to ensure that if the file already existed with more permissive settings, its permissions are correctly locked down. A unit testtest_fetch_sourcing_bom.pyhas also been added to verify that the secure permissions are enforced.PR created automatically by Jules for task 11329927201123890868 started by @aman-katyal