I am Sarang, a GSoC contributor interested in improving security in this project.
In server/app/worker/tasks.py, the RLS session context is currently set using interpolated SQL:
SET app.current_user_id = '{user_id}'
Since user_id originates from request context, this introduces a potential SQL injection risk in a security-sensitive execution path.
Proposed Solution:
- Replace string interpolation with a safe parameterized approach (e.g., using database parameter binding or
set_config)
- Enforce strict UUID validation before setting the session context
Acceptance Criteria:
- Remove SQL string interpolation when setting
app.current_user_id
- Validate
user_id as a proper UUID before database execution
- Reject invalid or malicious inputs with clear error handling
- Preserve existing RLS behavior and upload flow for valid users
- Add unit tests for:
- Valid UUID input
- Invalid UUID input
- Injection-like input (e.g., SQL payloads)
I am Sarang, a GSoC contributor interested in improving security in this project.
In
server/app/worker/tasks.py, the RLS session context is currently set using interpolated SQL:SET app.current_user_id = '{user_id}'
Since
user_idoriginates from request context, this introduces a potential SQL injection risk in a security-sensitive execution path.Proposed Solution:
set_config)Acceptance Criteria:
app.current_user_iduser_idas a proper UUID before database execution