mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-12 02:24:21 -05:00
Deprecate and remove shared secret from webhook payloads #5496
Closed
opened 2025-11-02 06:26:33 -06:00 by GiteaMirror
·
22 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
v1.16.2
v1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4.0-rc1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#5496
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @JustAnotherArchivist on GitHub (Jun 4, 2020).
Gitea currently sends the
secretin the webhook payload in plaintext. This renders signature validation entirely useless since an attacker could freely manipulate the payload without detection.Signatures were originally requested in #3901 and added in #6428. This problem was also mentioned in a comment in the former, but no separate issue for this security problem has been filed. Since then, it has been mentioned in a few comments that the
secretis deprecated and will be removed (e.g. https://github.com/go-gitea/gitea/issues/7487#issuecomment-629673826, https://github.com/go-gitea/gitea/issues/5173#issuecomment-618408121). However, a deprecation notice in the changelog and the documentation is missing, so only few people will notice.An official deprecation warning should be added to the changelog as soon as possible, ideally with the release of 1.12.0. This should also include information on when the field will be removed entirely.
@JustAnotherArchivist commented on GitHub (Jun 4, 2020):
A note on the webhook documentation: that's already quite outdated (missing fields, headers, etc.) and very incomplete. I'm working on a full rewrite (cf. #9485), but I currently don't know when that will be finished. Until then, I'd suggest simply adding a deprecation warning above the push example with a reference to the
X-Gitea-Signatureheader. I will be adding a full description in my rewrite, but until then, the PHP example already illustrates how to validate that.@stale[bot] commented on GitHub (Aug 9, 2020):
This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
@JustAnotherArchivist commented on GitHub (Aug 9, 2020):
Yes, this is still valid.
@stale[bot] commented on GitHub (Oct 10, 2020):
This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
@zeripath commented on GitHub (Oct 10, 2020):
AFAICS this is still present but it needs a security tag.
I don't understand completely why this was ever put there, and therefore I don't know why it hasn't been removed - but clearly it needs to be dealt with.
Now this is too late for 1.13 but I think we can just deprecate the secret from 1.13 so that it will be gone from 1.14 and anyone requiring it just has to do something about it.
@rakshith-ravi commented on GitHub (Oct 14, 2020):
@zeripath shouldn't this be moved to
1.14.0milestone instead of1.14? (Why do we even have1.14in the first place?) Just making sure there's no duplicate milestones created@JustAnotherArchivist commented on GitHub (Oct 14, 2020):
Shouldn't this be on the 1.13.0 milestone until the deprecation warnings are in? Just trying to make sure this isn't delayed by another version due to this.
@techknowlogick commented on GitHub (Oct 14, 2020):
@JustAnotherArchivist we will mention in 1.13.0 blog post
@JustAnotherArchivist commented on GitHub (Oct 14, 2020):
I see. I feel like a warning should also be added to the webhook docs and config page.
@techknowlogick commented on GitHub (Oct 14, 2020):
That's reasonable. Would you be open to making a PR :)
@JustAnotherArchivist commented on GitHub (Oct 14, 2020):
Sure. I'll need some guidance on how to integrate it into the web UI though.
Also, I noticed that the secret is also included on Gogs webhooks. It appears like Gogs itself didn't have it in the payload since early 2017 (https://github.com/gogs/gogs/issues/3692), but that should be verified first to avoid breaking existing hooks.
@JustAnotherArchivist commented on GitHub (Oct 27, 2020):
Checklist:
Add deprecation warning to the webhook configuration page in v1.13.0– not necessary, see below@zeripath commented on GitHub (Oct 27, 2020):
I don't think there's a sensible place for that - the webhook page simply links to gitea.io. I would guess that means we don't need to do anything about that.
@JustAnotherArchivist commented on GitHub (Oct 27, 2020):
Thinking about it again, yeah, I guess you're right. The secret itself isn't being deprecated, only its inclusion in the payload, and the web interface makes no attempt to describe what the payload is (except that you can look at the payloads on delivered hooks).
@CirnoT commented on GitHub (Oct 28, 2020):
Just FYI this will require appropriate PR for
go-scmfor Drone427b8a8589/scm/driver/gitea/webhook.go (L62-L72)@techknowlogick commented on GitHub (Oct 28, 2020):
@CirnoT
427b8a8589/scm/driver/gitea/webhook.go (L76)should already be suitable, no?@CirnoT commented on GitHub (Oct 28, 2020):
Ah sorry, yes. That's
&&there not||.Also it uses
FormValueso it looks for?secret=instead of actually examining Gitea's webhook body, meh... I suppose an ugly workaround for very old Gitea versions?@techknowlogick commented on GitHub (Oct 28, 2020):
@CirnoT no worries, I added in support for the signature checking via header so I was worried I missed something haha.
FormValueis from before my PR so I don't think that needs changing from querystring to webhook body, as that means it has been working that way since the start@JustAnotherArchivist commented on GitHub (Oct 28, 2020):
I believe
secretwas never in the query parameters at all. It was originally implemented in Gogs in commite573855aand was in the payload back then already.@CirnoT commented on GitHub (Oct 29, 2020):
It's part of URI that Drone installs as webhook; like I said, most likely workaround from when there was no support for signature in Gitea
@JustAnotherArchivist commented on GitHub (Dec 20, 2020):
@techknowlogick It appears this was missed on the release notes and blog post unless I'm blind?
@techknowlogick commented on GitHub (Dec 20, 2020):
@JustAnotherArchivist Thanks for reminder. I've just pushed up an update to the release blog post.