diff --git a/src/activity/events.jl b/src/activity/events.jl index 55dc20a..befc09f 100644 --- a/src/activity/events.jl +++ b/src/activity/events.jl @@ -43,7 +43,7 @@ sig_header(request::HTTP.Request) = HTTP.header(request, "X-Hub-Signature") function has_valid_secret(request::HTTP.Request, secret) if has_sig_header(request) - secret_sha = "sha1="*bytes2hex(MbedTLS.digest(MbedTLS.MD_SHA1, HTTP.payload(request), secret)) + secret_sha = "sha1="*bytes2hex(MbedTLS.digest(MbedTLS.MD_SHA1, copy(request.body), secret)) return sig_header(request) == secret_sha end return false diff --git a/test/commit_comment.jl b/test/commit_comment.jl index 94268a2..41807a7 100644 --- a/test/commit_comment.jl +++ b/test/commit_comment.jl @@ -1,3 +1,5 @@ +using Compat.Base64 + function create_event() data_base64 = "eyJhY3Rpb24iOiJjcmVhdGVkIiwiY29tbWVudCI6eyJ1cmwiOiJodHRwczovL2FwaS5naXRodWIuY29tL3JlcG9zL0p1bGlhQ0kvQmVuY2htYXJrVHJhY2tlcnMuamwvY29tbWVudHMvMTQwNDcwNTgiLCJodG1sX3VybCI6Imh0dHBzOi8vZ2l0aHViLmNvbS9KdWxpYUNJL0JlbmNobWFya1RyYWNrZXJzLmpsL2NvbW1pdC8zMmQzNWYyODU3NzdiMDc3ZDhiNmEyNTIxMzA5ZDFhYjY0NmQyMzc5I2NvbW1pdGNvbW1lbnQtMTQwNDcwNTgiLCJpZCI6MTQwNDcwNTgsInVzZXIiOnsibG9naW4iOiJqcmV2ZWxzIiwiaWQiOjMyNzc0NDMsImF2YXRhcl91cmwiOiJodHRwczovL2F2YXRhcnMuZ2l0aHVidXNlcmNvbnRlbnQuY29tL3UvMzI3NzQ0Mz92PTMiLCJncmF2YXRhcl9pZCI6IiIsInVybCI6Imh0dHBzOi8vYXBpLmdpdGh1Yi5jb20vdXNlcnMvanJldmVscyIsImh0bWxfdXJsIjoiaHR0cHM6Ly9naXRodWIuY29tL2pyZXZlbHMiLCJmb2xsb3dlcnNfdXJsIjoiaHR0cHM6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