Skip to content

Commit

Permalink
Revert "Switch to Signature Canonicalization version 2"
Browse files Browse the repository at this point in the history
This reverts commit 14bf169.
  • Loading branch information
AaronAtDuo committed Oct 28, 2024
1 parent fab9947 commit 90ff7a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
9 changes: 2 additions & 7 deletions lib/https.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,18 +666,14 @@ https_send(struct https_request *req, const char *method, const char *uri,
BIO *b64;
HMAC_CTX *hmac;
unsigned char MD[SHA512_DIGEST_LENGTH];
char *qs, *p, date[128];
char *qs, *p;
int i, n, is_get;
time_t t;

req->done = 0;

t = time(NULL);
strftime(date, sizeof date, "%a, %d %b %Y %T %z", localtime(&t));

/* Generate query string and canonical request to sign */
if ((qs = _argv_to_qs(argc, argv)) == NULL ||
(asprintf(&p, "%s\n%s\n%s\n%s\n%s", date, method, req->host, uri, qs)) < 0) {
(asprintf(&p, "%s\n%s\n%s\n%s", method, req->host, uri, qs)) < 0) {
free(qs);
ctx.errstr = strerror(errno);
return (HTTPS_ERR_LIB);
Expand All @@ -698,7 +694,6 @@ https_send(struct https_request *req, const char *method, const char *uri,
"User-Agent: %s\r\n",
useragent);
/* Add signature */
BIO_printf(req->cbio, "X-Duo-Date: %s\r\n", date);
BIO_puts(req->cbio, "Authorization: Basic ");

if ((hmac = HMAC_CTX_new()) == NULL) {
Expand Down
8 changes: 1 addition & 7 deletions tests/mockduo.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,7 @@ def _verify_sig(self):
if ikey != IKEY:
return False

# first look for x-duo-date header
datestring = self.headers.get("x-duo-date")
if datestring is None:
# if it doesn't exist, try looking for Date header
datestring = self.headers.get("Date")

canon = [datestring, self.method, self.headers["Host"].split(":")[0].lower(), self.path]
canon = [self.method, self.headers["Host"].split(":")[0].lower(), self.path]
l = []
for k in sorted(self.args.keys()):
l.append(
Expand Down

0 comments on commit 90ff7a7

Please sign in to comment.