Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Don't log urlencoded access_tokens #477

Merged
merged 2 commits into from
Jan 19, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions synapse/app/homeserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@
logger = logging.getLogger("synapse.app.homeserver")


ACCESS_TOKEN_RE = re.compile(r'(\?.*access(_|%5[Ff])token=)[^&]*(.*)$')


def gz_wrap(r):
return EncodingResourceWrapper(r, [GzipEncoderFactory()])

Expand Down Expand Up @@ -495,9 +498,8 @@ def __repr__(self):
)

def get_redacted_uri(self):
return re.sub(
r'(\?.*access_token=)[^&]*(.*)$',
r'\1<redacted>\2',
return ACCESS_TOKEN_RE.sub(
r'\1<redacted>\3',
self.uri
)

Expand Down