Skip to content

Commit

Permalink
Protect against hostile webhook invocations
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinmit committed Jan 29, 2020
1 parent b65745b commit a23ad2e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions zcommit.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def format_commit(c, commit_url):
""" % info

try:
if not commit_url.startswith('https://api.github.com/'):
raise ValueError('refusing to fetch commit information from '+commit_url)
# Check if the diff is small enough
r = requests.get(commit_url, headers={'Accept': 'application/vnd.github.diff'})
diff = r.text
Expand Down

0 comments on commit a23ad2e

Please sign in to comment.