Commit graph

9 commits

Author SHA1 Message Date
Earl Warren 10643f1d3a
[DEADCODE] update 2024-03-06 12:10:47 +08:00
Earl Warren 0f098d1ad7
[DEADCODE] update 2024-02-26 22:30:27 +01:00
wxiaoguang 65248945c9
Refactor locale&string&template related code (#29165)
Clarify when "string" should be used (and be escaped), and when
"template.HTML" should be used (no need to escape)

And help PRs like  #29059 , to render the error messages correctly.

(cherry picked from commit f3eb835886031df7a562abc123c3f6011c81eca8)

Conflicts:
	modules/web/middleware/binding.go
	routers/web/feed/convert.go
	tests/integration/branches_test.go
	tests/integration/repo_branch_test.go
	trivial context conflicts
2024-02-16 15:20:52 +01:00
Gergely Nagy a3a7af5a2b
Update .deadcode-out
Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-02-14 17:31:06 +01:00
Earl Warren 540ec0751c
Revert "Fix schedule tasks bugs (#28691)" (part 2)
This function is now being used elsewhere and cannot be reverted. Only
the part that was modified in addition to being moved is deleted.

(cherry picked from commit 72954836a4)
(cherry picked from commit 86f4d1871e)
(cherry picked from commit 8089076ee2)
2024-02-05 16:54:44 +01:00
Antonin Delpeuch 01b0ead664
[GITEA] Enable mocked HTTP responses for GitLab migration test
Fix gitlab migration unit test

Closes #1837.

The differences in dates can be explained by commit e19b9653ea, which
changed the order in which "created_date" and "updated_date" are
considered.

(cherry picked from commit b0bba20aa4)

Mock HTTP requests in GitLab migration test

This introduces a new utility which can be added to other tests
making HTTP calls to a live service, to cache the responses of this
service in the repository.

(cherry picked from commit 52053b1389)

Enable mocked HTTP responses for GitLab migration test

(cherry picked from commit 19cefc4de2)

Simplify HTTP mocking utility in unit tests

Follow-up to https://codeberg.org/forgejo/forgejo/pulls/1841

(cherry picked from commit ca517c8bb4)
(cherry picked from commit b227e0dd6b)
(cherry picked from commit 6cc9d06556)
(cherry picked from commit f0746e648d)
(cherry picked from commit 414193341b)
(cherry picked from commit 6e93df3bbb)
(cherry picked from commit db0dbab552)
(cherry picked from commit 8f9c9c63fb)

(cherry picked from commit e74e262030)
(cherry picked from commit 2e0933edcf)
(cherry picked from commit 65060c6961)
2024-02-05 16:09:41 +01:00
Earl Warren a8538928f7
[DEADCODE] update deadcode-out
(cherry picked from commit ff0554a184)
(cherry picked from commit e9901814be)
(cherry picked from commit 9ff7c41d53)
(cherry picked from commit 9601dee4a3)

[DEADCODE] update deadcode-out (squash) update

(cherry picked from commit aef379c5f5)
(cherry picked from commit 75473ea87a)

[DEADCODE] update deadcode-out (squash) update

(cherry picked from commit 868b7a436f)
(cherry picked from commit 38787c8779)

[DEADCODE] update deadcode-out (squash) update again

(cherry picked from commit 91b2932907)
(cherry picked from commit 39adff772d)
(cherry picked from commit 9f76193ea4)
(cherry picked from commit 8968396cbc)
(cherry picked from commit f87e11e2eb)
2024-02-05 15:08:04 +01:00
Gusted c6a53c3172
[SECURITY] Rework long-term authentication
- This is a 'front-port' of the already existing patch on v1.21 and
v1.20, but applied on top of what Gitea has done to rework the LTA
mechanism. Forgejo will stick with the reworked mechanism by the Forgejo
Security team for the time being. The removal of legacy code (AES-GCM) has been
left out.
- The current architecture is inherently insecure, because you can
construct the 'secret' cookie value with values that are available in
the database. Thus provides zero protection when a database is
dumped/leaked.
- This patch implements a new architecture that's inspired from: [Paragonie Initiative](https://paragonie.com/blog/2015/04/secure-authentication-php-with-long-term-persistence#secure-remember-me-cookies).
- Integration testing is added to ensure the new mechanism works.
- Removes a setting, because it's not used anymore.

(cherry picked from commit e3d6622a63)
(cherry picked from commit fef1a6dac5)
(cherry picked from commit b0c5165145)
(cherry picked from commit 7ad51b9f8d)
(cherry picked from commit 64f053f383)
(cherry picked from commit f5e78e4c20)

Conflicts:
	services/auth/auth_token_test.go
	https://codeberg.org/forgejo/forgejo/pulls/2069
(cherry picked from commit f69fc23d4b)
(cherry picked from commit d955ab3ab0)
(cherry picked from commit 9220088f90)
(cherry picked from commit c73ac63696)
(cherry picked from commit 747a176048)

Conflicts:
	models/user/user.go
	routers/web/user/setting/account.go
	https://codeberg.org/forgejo/forgejo/pulls/2295
2024-02-05 15:06:15 +01:00
Gusted 089f51a63c
[DEADCODE] Add deadcode linter
- Add the experimental
[deacode](https://pkg.go.dev/golang.org/x/tools/internal/cmd/deadcode)
linter to Forgejo.
- To deal with false positives that can happen due to build tags or with code
that's currently only referenced by test code, the output of the tool is
compared against a known-good output.
- This commit doesn't make any attempt to remove any deadcode.

(cherry picked from commit ac462279e9)
(cherry picked from commit b5ea6e85ac)
(cherry picked from commit 5915f3643c)

[CLEANUP] Remove deadcode

- This is deadcode since https://codeberg.org/forgejo/forgejo/pulls/1802
removed the usage of it.

(cherry picked from commit d840b9923e)
(cherry picked from commit 9442bab626)
(cherry picked from commit 0de9d18863)
(cherry picked from commit 26abf78374)
(cherry picked from commit 05d3a143c3)
(cherry picked from commit 4b3d38d5e1)
(cherry picked from commit a726e71986)
(cherry picked from commit cb62ae5b98)
(cherry picked from commit 8195ba06d5)
(cherry picked from commit 4570fb591a)
(cherry picked from commit 1f4d33de2b)
2024-02-05 14:45:09 +01:00