mirror of
1
Fork 0
forgejo/modules
Twenty Panda 5561e80b04 fix(hook): ignore unknown push options instead of failing
If a repository has

git config --add push.pushOption submit=".sourcehut/*.yml"

it failed when pushed because of the unknown submit push
option. It will be ignored instead.

Filtering out the push options is done in an earlier stage, when the
hook command runs, before it submits the options map to the private
endpoint.

* move all the push options logic to modules/git/pushoptions
* add 100% test coverage for modules/git/pushoptions

Test coverage for the code paths from which code was moved to the
modules/git/pushoptions package:

* cmd/hook.go:runHookPreReceive
* routers/private/hook_pre_receive.go:validatePushOptions
  tests/integration/git_push_test.go:TestOptionsGitPush runs through
  both. The test verifying the option is rejected was removed and, if
  added again, will fail because the option is now ignored instead of
  being rejected.

* cmd/hook.go:runHookProcReceive
* services/agit/agit.go:ProcReceive
  tests/integration/git_test.go: doCreateAgitFlowPull runs through
  both. It uses variations of AGit related push options.

* cmd/hook.go:runHookPostReceive
* routers/private/hook_post_receive.go:HookPostReceive
  tests/integration/git_test.go:doPushCreate called by TestGit/HTTP/sha1/PushCreate
  runs through both.
  Note that although it provides coverage for this code path it does not use push options.

Fixes: https://codeberg.org/forgejo/forgejo/issues/3651
2024-07-02 21:39:01 +02:00
..
actions Add support for workflow_dispatch (#3334) 2024-06-28 05:17:11 +00:00
activitypub FIX: use proper time format (activitypub/client) (#4132) 2024-06-14 15:22:37 +00:00
analyze
assetfs
auth Enable `unparam` linter (#31277) 2024-06-16 13:42:58 +02:00
avatar
base
cache [PORT] Add cache test for admins (#31265) 2024-06-23 11:38:35 +02:00
charset
container
csv Refactor locale&string&template related code (#29165) 2024-02-16 15:20:52 +01:00
emoji
eventsource
forgefed
generate
git fix(hook): ignore unknown push options instead of failing 2024-07-02 21:39:01 +02:00
gitgraph
gitrepo
graceful
hcaptcha
highlight
hostmatcher
html Refactor backend SVG package and add tests (#26335) 2023-08-05 04:34:59 +00:00
httpcache
httplib
indexer Fix bug filtering issues which have no project (#31337) 2024-06-16 13:42:59 +02:00
issue/template
json Replace `interface{}` with `any` (#25686) 2023-07-04 18:36:08 +00:00
label
lfs Support legacy _links LFS batch responses (#31513) 2024-06-29 07:56:18 +02:00
log
markup Fix markdown math brackets render problem (#31420) 2024-06-23 12:40:06 +02:00
mcaptcha
metrics
migration
nosql
optional
options
packages Extract and display readme and comments for Composer packages (#30927) 2024-06-16 13:42:59 +02:00
paginator
pprof
private fix(hook): ignore unknown push options instead of failing 2024-07-02 21:39:01 +02:00
process
proxy
proxyprotocol
public
queue
recaptcha
references Refactor to use UnsafeStringToBytes (#31358) 2024-06-16 13:42:58 +02:00
regexplru
repository fix(repository): git push to an adopted repository fails 2024-06-16 19:06:06 +02:00
secret
session
setting Add support for workflow_dispatch (#3334) 2024-06-28 05:17:11 +00:00
sitemap
ssh
storage test(avatar): deleting a user avatar is idempotent 2024-06-05 09:10:42 +02:00
structs Add support for workflow_dispatch (#3334) 2024-06-28 05:17:11 +00:00
svg
sync
system Refactor to use UnsafeStringToBytes (#31358) 2024-06-16 13:42:58 +02:00
templates Add slogan config (#3752) 2024-06-07 17:12:48 +00:00
test
testlogger
timeutil
translation
turnstile
typesniffer
updatechecker
uri
user
util Refactor to use UnsafeStringToBytes (#31358) 2024-06-16 13:42:58 +02:00
validation added validation fixes 2024-05-14 08:31:34 +02:00
web Delete legacy cookie before setting new cookie (#31306) 2024-06-16 08:21:32 +02:00
webhook Add support for workflow_dispatch (#3334) 2024-06-28 05:17:11 +00:00