Skip to content

Commit 164bb7c

Browse files
committed
fix(github): Minor errors in handling of secrets.
1 parent 75bc601 commit 164bb7c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

bot/github/authenticator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def exchange_code_for_token(self, code: str) -> str:
6969
return response.json()["access_token"]
7070

7171
def use_token_for_webhooks(self, token: str, repository: str):
72-
secret = db.token_hex(20)
72+
secret = secrets.token_hex(20)
7373

7474
successful = self.storage.add_secret(repository, secret)
7575

bot/github/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def verify(self, request: LocalRequest) -> tuple[bool, str]:
9090

9191
expected_digest = headers["X-Hub-Signature-256"].split('=', 1)[-1]
9292
digest = hmac.new(
93-
secret,
93+
secret.encode(),
9494
request.body.getvalue(),
9595
hashlib.sha256,
9696
).hexdigest()

0 commit comments

Comments
 (0)