Fix upload file permission#3789
Open
jkppr wants to merge 5 commits intogoogle:masterfrom
Open
Conversation
The upload API endpoint previously hardcoded the file permission to 0o600 when writing uploaded chunks to disk. This caused issues in setups where the API and Worker roles run on different systems sharing a mounted disk. This commit introduces a new configuration option `UPLOAD_FILE_PERMISSION` in `timesketch.conf`, allowing administrators to override the default 0o600 permission (e.g. 0o644) so that other processes or users can read the uploaded files. A unit test was also added to `UploadFileResourceTest` to ensure the configuration value is correctly passed to `os.open()`. Co-authored-by: jkppr <99879757+jkppr@users.noreply.github.com>
Co-authored-by: jkppr <99879757+jkppr@users.noreply.github.com>
* Parse UPLOAD_FILE_PERMISSION from string to octal int to handle env vars. * Change default UPLOAD_FILE_PERMISSION from 0o600 to 0o640. * Apply UPLOAD_FILE_PERMISSION via os.chmod() for single file uploads. * Fix failing test_upload_file_permission by removing manual f.close() that conflicted with os.fdopen().
Collaborator
Author
|
/gemini summary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR allows Timesketch Admins to define the file permission used to write an uploaded file. Depending on their deployment and how the upload folder is shared between different containers or systems, this option allows to fix access.