-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow bitbucket webhook to check atlantis server #475
Conversation
Fix #474 |
Codecov Report
@@ Coverage Diff @@
## master #475 +/- ##
=======================================
Coverage 70.58% 70.58%
=======================================
Files 63 63
Lines 4246 4246
=======================================
Hits 2997 2997
Misses 1028 1028
Partials 221 221
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #475 +/- ##
==========================================
- Coverage 70.58% 70.53% -0.05%
==========================================
Files 63 63
Lines 4246 4249 +3
==========================================
Hits 2997 2997
- Misses 1028 1031 +3
Partials 221 221
Continue to review full report at Codecov.
|
server/events_controller.go
Outdated
@@ -169,7 +169,7 @@ func (e *EventsController) handleBitbucketServerPost(w http.ResponseWriter, r *h | |||
e.respond(w, logging.Error, http.StatusBadRequest, "Unable to read body: %s %s=%s", err, bitbucketServerRequestIDHeader, reqID) | |||
return | |||
} | |||
if len(e.BitbucketWebhookSecret) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to pull this logic into a special check ahead of the rest of the code. I want to do this because I don't want there to be more conditionals where we're checking the webhook secret. I think that it might be confusing one day and we might refactor in a way that attackers could bypass the webhook secret checking.
if eventType == bitbucketserver.DiagnosticsPingHeader {
// Specially handle the diagnostics:ping event because Bitbucket Server
// doesn't send the signature with this event for some reason.
e.respond(w, logging.Info, http.StatusOK, "Successfully received %s event %s=%s", eventType, bitbucketServerRequestIDHeader, reqID)
return
}
@@ -1,6 +1,7 @@ | |||
package bitbucketserver | |||
|
|||
const ( | |||
DiagnosticsPing = "diagnostics:ping" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add Header
to match the Others.
DiagnosticsPing = "diagnostics:ping" | |
DiagnosticsPingHeader = "diagnostics:ping" |
1f738f9
to
cbc9e3b
Compare
cbc9e3b
to
dd6c324
Compare
Thanks! |
No description provided.