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

Commit

Permalink
Merge pull request #477 from matrix-org/erikj/access_token_log
Browse files Browse the repository at this point in the history
Don't log urlencoded access_tokens
  • Loading branch information
erikjohnston committed Jan 19, 2016
2 parents b8518ff + 44b4fc5 commit 7a079ad
Showing 1 changed file with 5 additions and 3 deletions.
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

0 comments on commit 7a079ad

Please sign in to comment.