Skip to content

Fix upload file permission#3789

Open
jkppr wants to merge 5 commits intogoogle:masterfrom
jkppr:fix-upload-permission
Open

Fix upload file permission#3789
jkppr wants to merge 5 commits intogoogle:masterfrom
jkppr:fix-upload-permission

Conversation

@jkppr
Copy link
Copy Markdown
Collaborator

@jkppr jkppr commented Apr 2, 2026

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.

google-labs-jules Bot and others added 3 commits March 31, 2026 20:25
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().
@jkppr jkppr self-assigned this Apr 2, 2026
@jkppr jkppr added Backend Data import All things that are with importing data labels Apr 2, 2026
@jkppr
Copy link
Copy Markdown
Collaborator Author

jkppr commented Apr 2, 2026

/gemini summary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend Data import All things that are with importing data

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant