Skip to content
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

Custom event > releases payload does not contain secret #5173

Closed
2 tasks done
AuspeXeu opened this issue Oct 25, 2018 · 22 comments
Closed
2 tasks done

Custom event > releases payload does not contain secret #5173

AuspeXeu opened this issue Oct 25, 2018 · 22 comments

Comments

@AuspeXeu
Copy link

  • Gitea version (or commit ref): 1.5.2
  • Git version: 2.9.3
  • Operating system: CentOS
  • Database:
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Not relevant

Description

When setting up a gitea webhook, one can provide a secret that is supposed to be included in the delivered POST application/json payload. This works fine for "Push Events", however when choosing "Custom Events..." and selecting "Releases", this secret is not included in the payload anymore.

@lunny lunny added the type/bug label Oct 25, 2018
@lunny lunny added the modifies/api This PR adds API routes or modifies them label Oct 27, 2018
appleboy pushed a commit to go-gitea/go-sdk that referenced this issue Oct 27, 2018
)

affects webhooks for:
* Delete
* Fork
* IssueComment
* Release

Resolves: go-gitea/gitea#4732, go-gitea/gitea#5173
Signed-off-by: Berengar W. Lehr <[email protected]>
lafriks pushed a commit that referenced this issue Oct 30, 2018
…5208)

* Updated dependency manager via `dep ensure -update code.gitea.io/sdk`
* Gopkg.toml was not changed as sdk version is set to "master"
* affects webhooks for: Delete, Fork, IssueComment, Release
* also contains changes from go-gitea/go-sdk#125 and hence a swagger update

Signed-off-by: Berengar W. Lehr <[email protected]>
Resolves: #4732, #5173
@AuspeXeu
Copy link
Author

AuspeXeu commented Nov 12, 2018

I just tested the latest version 1.6.0-rc2 and it seems like this issue is still not resolved. Now, if I trigger a test delivery for a custom event of the type release, no request is queued whatsoever.

Edit: I tried this on the demo instance with the following settings.

screen shot 2018-11-12 at 16 04 02

As you can see here, no requests are received https://requestbin.net/r/1oa26911?inspect

@HoffmannP
Copy link
Contributor

Could you explain "trigger a test delivery"? I tried to retrace your steps but couldn't find the same error

@AuspeXeu
Copy link
Author

I simply press the "Test Delivery" button :)

@HoffmannP
Copy link
Contributor

HoffmannP commented Nov 14, 2018

Okey, but it looks to me as if the TestDelivery is always executing a push event. If your webhook only acts on releases it will not be triggered.

if err := models.PrepareWebhook(w, ctx.Repo.Repository, models.HookEventPush, p); err != nil {

Perhaps the button should be renamed to "Test push event"

@AuspeXeu
Copy link
Author

AuspeXeu commented Nov 14, 2018

My intuition was that the button tests whatever hook is specified at the top?!
Anyways, I had to put a new request bin, here the link to inspect it https://requestbin.net/r/wy4b3rwy?inspect

I pushed a tag (release) to the repository under https://try.gitea.io/test1337/Hooktest and it did not trigger a request to the request bin. So something seems to be broken, no?

Edit: Okay, I just figure out what the problem is. I am actually not sure whether it's a problem or by design. But there is definitely some confusion. If I create a tag and push it, the tag appears under releases in the repository, however the custom event hook is not triggered. BUT, if I create a release via the webinterface, the hook is triggered.

So here is some inconstancy. Either a normal tag should not be a release or it is considered a release and it should trigger the hook.

@lafriks
Copy link
Member

lafriks commented Nov 16, 2018

@AuspeXeu tag without release in release list page is displayed differently

@lafriks
Copy link
Member

lafriks commented Nov 16, 2018

release will be triggered when you create release (either by UI or API) either on new tag or existing. Pushing tag from git command will not create release, this is by design so

@AuspeXeu
Copy link
Author

Okay, I guess it's all working correctly then in that case.

@HoffmannP
Copy link
Contributor

Closeable?

@AuspeXeu
Copy link
Author

AuspeXeu commented Nov 18, 2018

I guess so :) - thanks for your efforts!
Edit: Actually ... I think the test delivery is still a bug, no? It should test whatever you set up instead of a push event?

@AuspeXeu AuspeXeu reopened this Nov 18, 2018
@lafriks
Copy link
Member

lafriks commented Nov 22, 2018

Test delivery will always issue push event

@AuspeXeu
Copy link
Author

Why? :D

@lafriks
Copy link
Member

lafriks commented Nov 23, 2018

Because it is just for testing if target can be reached not to test actual functionaliity

@AuspeXeu
Copy link
Author

AuspeXeu commented Nov 23, 2018

Well, but exactly this is not happening. If you set the hook to custom event as I showed above, and then press "test delivery" nothing happens. It claims that a fake event has been generated but no request ever reaches the specified endpoint.

Edit: these are the settings
image

And no request reaches https://requestbin.fullcontact.com/1h3kkfs1?inspect

@lafriks
Copy link
Member

lafriks commented Nov 23, 2018

Ok, now I understand the problem. It is tested if event type is enabled before sending. This would require option to choose what kind of event to send then and implement each event type webhook content generation. I don't think that is worth time needed to develop this the gains.

@AuspeXeu
Copy link
Author

Well, if we could at least have a delivery test that would be great :) One option could be, as you said, to always send a push event type. That way one could at least verify that the endpoint is reachable, no?

@lafriks
Copy link
Member

lafriks commented Nov 23, 2018

If you enable push events and then try test delivery than it will work and do request. Later you can disable it again

@AuspeXeu
Copy link
Author

Basically my point is, if someone is new to gitea and sets up a custom event webhook, they will wonder why the test delivery does not work unless the read this particular issue with our comments.

@lafriks
Copy link
Member

lafriks commented Nov 24, 2018

We could probably add warning if push event is not enabled

@stale
Copy link

stale bot commented Jan 23, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Jan 23, 2019
@lunny lunny added issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented and removed issue/stale labels Feb 7, 2019
@6543
Copy link
Member

6543 commented Apr 23, 2020

Whats the state of this issue?

@techknowlogick
Copy link
Member

Secret inside the payload has been deprecated, and the hmac header of webhook should now be used. Closing this issue.

@techknowlogick techknowlogick removed modifies/api This PR adds API routes or modifies them type/bug issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented labels Apr 23, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants