You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gitea/models
Jason Song edf98a2dc3
Require approval to run actions for fork pull request (#22803)
Currently, Gitea will run actions automatically which are triggered by
fork pull request. It's a security risk, people can create a PR and
modify the workflow yamls to execute a malicious script.

So we should require approval for first-time contributors, which is the
default strategy of a public repo on GitHub, see [Approving workflow
runs from public
forks](https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks).

Current strategy:

- don't need approval if it's not a fork PR;
- always need approval if the user is restricted;
- don't need approval if the user can write;
- don't need approval if the user has been approved before;
- otherwise, need approval.

https://user-images.githubusercontent.com/9418365/217207121-badf50a8-826c-4425-bef1-d82d1979bc81.mov

GitHub has an option for that, you can see that at
`/<owner>/<repo>/settings/actions`, and we can support that later.

<img width="835" alt="image"
src="https://user-images.githubusercontent.com/9418365/217199990-2967e68b-e693-4e59-8186-ab33a1314a16.png">

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago
..
actions Require approval to run actions for fork pull request (#22803) 2 years ago
activities Rename `repo.GetOwner` to `repo.LoadOwner` (#22967) 2 years ago
admin Implement FSFE REUSE for golang files (#21840) 2 years ago
asymkey Refactor the setting to make unit test easier (#22405) 2 years ago
auth Use minio/sha256-simd for accelerated SHA256 (#23052) 2 years ago
avatars Add context cache as a request level cache (#22294) 2 years ago
db Remove all package data after tests (#22984) 2 years ago
dbfs Refactor the setting to make unit test easier (#22405) 2 years ago
fixtures Make CI use a dummy password hasher for all tests (#22983) 2 years ago
git Rename `repo.GetOwner` to `repo.LoadOwner` (#22967) 2 years ago
issues Fix intermittent panic in notify issue change content (#23019) 2 years ago
migrations Require approval to run actions for fork pull request (#22803) 2 years ago
organization Rename `GetUnits` to `LoadUnits` (#22970) 2 years ago
packages Use link in UI which returned a relative url but not html_url which contains an absolute url (#21986) 2 years ago
perm Rename `repo.GetOwner` to `repo.LoadOwner` (#22967) 2 years ago
project improve FindProjects (#23085) 2 years ago
pull refactor some functions to support ctx as first parameter (#21878) 2 years ago
repo Rename `repo.GetOwner` to `repo.LoadOwner` (#22967) 2 years ago
secret Secrets storage with SecretKey encrypted (#22142) 2 years ago
system Add context cache as a request level cache (#22294) 2 years ago
unit Repositories: by default disable all units except code and pulls on forks (#22541) 2 years ago
unittest Make CI use a dummy password hasher for all tests (#22983) 2 years ago
user Provide the ability to set password hash algorithm parameters (#22942) 2 years ago
webhook Support system hook API (#14537) 2 years ago
error.go Implement FSFE REUSE for golang files (#21840) 2 years ago
fixture_generation.go Implement FSFE REUSE for golang files (#21840) 2 years ago
fixture_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
main_test.go Refactor the setting to make unit test easier (#22405) 2 years ago
migrate.go Check primary keys for all tables and drop ForeignReference (#21721) 2 years ago
migrate_test.go Check primary keys for all tables and drop ForeignReference (#21721) 2 years ago
org.go refactor some functions to support ctx as first parameter (#21878) 2 years ago
org_team.go Supports wildcard protected branch (#20825) 2 years ago
org_team_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
org_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo.go Implement actions (#21937) 2 years ago
repo_collaboration.go refactor some functions to support ctx as first parameter (#21878) 2 years ago
repo_collaboration_test.go Rename `repo.GetOwner` to `repo.LoadOwner` (#22967) 2 years ago
repo_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo_transfer.go Always reuse transaction (#22362) 2 years ago
repo_transfer_test.go Rename almost all Ctx functions (#22071) 2 years ago