Description
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
The Supabase Python client exposes sensitive data (tokens, query parameters) in debug logs without providing any built-in mechanism to redact this information. This was previously reported in discussion https://github.com/orgs/supabase/discussions/31019 but remains unresolved. This is a security concern as sensitive tokens and data are being logged in plaintext, potentially exposing them in log files.
To Reproduce
- Set up a Python application using the Supabase client
- Enable debug logging for the client
- Make any API call that includes sensitive data (like authentication tokens)
- Check debug logs to see exposed sensitive information:
import logging
import supabase
# Configure logging
logging.basicConfig(level=logging.DEBUG)
# Initialize Supabase client
client = supabase.create_client(...)
# Make any API call
result = client.from_('sensitive_table').select('*').execute()
The debug logs will show sensitive information like:
[DEBUG] [hpack.hpack] Decoded (b'content-location', b'/sensitive_table?sensitive_token=eq.abc-1234-567899888-23333-33333-333333-333333')
Expected behavior
The Supabase Python client should:
- Provide built-in configuration options to redact sensitive data in debug logs
- Either mask sensitive tokens and parameters by default or
- Provide clear documentation on how to properly configure logging to protect sensitive data
System information
- OS: Linux
- Version of supabase-py: latest
- Version of Python: 3.11
Additional context
Standard Python logging filters don't work effectively as the logs are generated by underlying libraries (httpx, httpcore, hpack). This is a security issue that needs proper handling at the client library level. Custom filters like:
class SensitiveDataFilter(logging.Filter):
def filter(self, record: logging.LogRecord) -> bool:
record.msg = re.sub(r"abc-[0-9a-f\-]+", "[REDACTED-TOKEN]", record.msg)
return True
don't fully address the issue as they can't catch all instances of sensitive data exposure.
This issue was previously raised in discussion https://github.com/orgs/supabase/discussions/31019 without any resolution, hence filing it as a bug report given its security implications.