bascule checks wether or not one of the sat token capabilities matches the request url. This works by checking 1) the capabilities like hooks is a subset match of the request url and 2) that match starts at index 0:
where re is the regex for hooks capability and urlToMatch should start with hooks
|
matchIdxs := re.FindStringIndex(urlToMatch) |
|
if matchIdxs == nil || matchIdxs[0] != 0 { |
|
return false |
|
} |
|
|
|
return true |
The issue at hand is that go's net lib may include a leading / in its url path. So urlToMatch would point to /hooks instead of hooks and thus failing the endpoint authorization.
The solution is to normalize both re and urlToMatch to contain a leading / such that the currently logic works.
bascule checks wether or not one of the sat token capabilities matches the request url. This works by checking 1) the capabilities like
hooksis a subset match of the request url and 2) that match starts at index 0:where
reis the regex forhookscapability andurlToMatchshould start withhooksbascule/basculechecks/endpointchecks.go
Lines 105 to 110 in ef08626
The issue at hand is that go's
netlib may include a leading/in its url path. SourlToMatchwould point to/hooksinstead ofhooksand thus failing the endpoint authorization.The solution is to normalize both
reandurlToMatchto contain a leading/such that the currently logic works.