Skip to content

Commit f7843f6

Browse files
authored
Merge branch 'main' into squash-append-to-existing-trailers
2 parents a84e87e + 4cc63e9 commit f7843f6

File tree

181 files changed

+6894
-2268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+6894
-2268
lines changed

.drone.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: compliance
44

55
platform:
66
os: linux
7-
arch: arm64
7+
arch: amd64
88

99
trigger:
1010
event:
@@ -27,7 +27,7 @@ steps:
2727

2828
- name: lint-backend
2929
pull: always
30-
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
30+
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
3131
commands:
3232
- make lint-backend
3333
environment:
@@ -37,7 +37,7 @@ steps:
3737

3838
- name: lint-backend-windows
3939
pull: always
40-
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
40+
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
4141
commands:
4242
- make golangci-lint vet
4343
environment:
@@ -49,7 +49,7 @@ steps:
4949

5050
- name: lint-backend-gogit
5151
pull: always
52-
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
52+
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
5353
commands:
5454
- make lint-backend
5555
environment:

cmd/hook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ Gitea or set your environment appropriately.`, "")
179179
GitObjectDirectory: os.Getenv(private.GitObjectDirectory),
180180
GitQuarantinePath: os.Getenv(private.GitQuarantinePath),
181181
GitPushOptions: pushOptions(),
182-
ProtectedBranchID: prID,
182+
PullRequestID: prID,
183183
IsDeployKey: isDeployKey,
184184
}
185185

custom/conf/app.example.ini

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,17 @@ INTERNAL_TOKEN=
388388
;; Enables OAuth2 provider
389389
ENABLE = true
390390
;;
391+
;; Algorithm used to sign OAuth2 tokens. Valid values: HS256, HS384, HS512, RS256, RS384, RS512, ES256, ES384, ES512
392+
;JWT_SIGNING_ALGORITHM = RS256
393+
;;
394+
;; Private key file path used to sign OAuth2 tokens. The path is relative to APP_DATA_PATH.
395+
;; This setting is only needed if JWT_SIGNING_ALGORITHM is set to RS256, RS384, RS512, ES256, ES384 or ES512.
396+
;; The file must contain a RSA or ECDSA private key in the PKCS8 format. If no key exists a 4096 bit key will be created for you.
397+
;JWT_SIGNING_PRIVATE_KEY_FILE = jwt/private.pem
398+
;;
391399
;; OAuth2 authentication secret for access and refresh tokens, change this yourself to a unique string. CLI generate option is helpful in this case. https://docs.gitea.io/en-us/command-line/#generate
392-
JWT_SECRET =
400+
;; This setting is only needed if JWT_SIGNING_ALGORITHM is set to HS256, HS384 or HS512.
401+
;JWT_SECRET =
393402
;;
394403
;; Lifetime of an OAuth2 access token in seconds
395404
;ACCESS_TOKEN_EXPIRATION_TIME = 3600
@@ -1387,8 +1396,8 @@ PATH =
13871396
;; Mail server
13881397
;; Gmail: smtp.gmail.com:587
13891398
;; QQ: smtp.qq.com:465
1390-
;; Using STARTTLS on port 587 is recommended per RFC 6409.
1391-
;; Note, if the port ends with "465", SMTPS will be used.
1399+
;; As per RFC 8314 using Implicit TLS/SMTPS on port 465 (if supported) is recommended,
1400+
;; otherwise STARTTLS on port 587 should be used.
13921401
;HOST =
13931402
;;
13941403
;; Disable HELO operation when hostnames are different.
@@ -2039,6 +2048,16 @@ PATH =
20392048
;; storage type
20402049
;STORAGE_TYPE = local
20412050

2051+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2052+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2053+
;; settings for repository archives, will override storage setting
2054+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2055+
;[storage.repo-archive]
2056+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2057+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2058+
;; storage type
2059+
;STORAGE_TYPE = local
2060+
20422061
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
20432062
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
20442063
;; lfs storage will override storage

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,9 @@ Define allowed algorithms and their minimum key length (use -1 to disable a type
550550
- `DISABLE_HELO`: **\<empty\>**: Disable HELO operation.
551551
- `HELO_HOSTNAME`: **\<empty\>**: Custom hostname for HELO operation.
552552
- `HOST`: **\<empty\>**: SMTP mail host address and port (example: smtp.gitea.io:587).
553-
- Using opportunistic TLS via STARTTLS on port 587 is recommended per RFC 6409.
553+
- As per RFC 8314, if supported, Implicit TLS/SMTPS on port 465 is recommended, otherwise opportunistic TLS via STARTTLS on port 587 should be used.
554554
- `IS_TLS_ENABLED` : **false** : Forcibly use TLS to connect even if not on a default SMTPS port.
555-
- Note, if the port ends with `465` SMTPS/SMTP over TLS will be used despite this setting.
555+
- Note, if the port ends with `465` Implicit TLS/SMTPS/SMTP over TLS will be used despite this setting.
556556
- Otherwise if `IS_TLS_ENABLED=false` and the server supports `STARTTLS` this will be used. Thus if `STARTTLS` is preferred you should set `IS_TLS_ENABLED=false`.
557557
- `FROM`: **\<empty\>**: Mail from address, RFC 5322. This can be just an email address, or
558558
the "Name" \<[email protected]\> format.
@@ -861,7 +861,7 @@ NB: You must have `DISABLE_ROUTER_LOG` set to `false` for this option to take ef
861861
- `INVALIDATE_REFRESH_TOKENS`: **false**: Check if refresh token has already been used
862862
- `JWT_SIGNING_ALGORITHM`: **RS256**: Algorithm used to sign OAuth2 tokens. Valid values: \[`HS256`, `HS384`, `HS512`, `RS256`, `RS384`, `RS512`, `ES256`, `ES384`, `ES512`\]
863863
- `JWT_SECRET`: **\<empty\>**: OAuth2 authentication secret for access and refresh tokens, change this to a unique string. This setting is only needed if `JWT_SIGNING_ALGORITHM` is set to `HS256`, `HS384` or `HS512`.
864-
- `JWT_SIGNING_PRIVATE_KEY_FILE`: **jwt/private.pem**: Private key file path used to sign OAuth2 tokens. The path is relative to `CUSTOM_PATH`. This setting is only needed if `JWT_SIGNING_ALGORITHM` is set to `RS256`, `RS384`, `RS512`, `ES256`, `ES384` or `ES512`. The file must contain a RSA or ECDSA private key in the PKCS8 format.
864+
- `JWT_SIGNING_PRIVATE_KEY_FILE`: **jwt/private.pem**: Private key file path used to sign OAuth2 tokens. The path is relative to `APP_DATA_PATH`. This setting is only needed if `JWT_SIGNING_ALGORITHM` is set to `RS256`, `RS384`, `RS512`, `ES256`, `ES384` or `ES512`. The file must contain a RSA or ECDSA private key in the PKCS8 format. If no key exists a 4096 bit key will be created for you.
865865
- `MAX_TOKEN_LENGTH`: **32767**: Maximum length of token/cookie to accept from OAuth2 provider
866866

867867
## i18n (`i18n`)
@@ -907,13 +907,17 @@ Gitea supports customizing the sanitization policy for rendered HTML. The exampl
907907
ELEMENT = span
908908
ALLOW_ATTR = class
909909
REGEXP = ^\s*((math(\s+|$)|inline(\s+|$)|display(\s+|$)))+
910+
ALLOW_DATA_URI_IMAGES = true
910911
```
911912

912913
- `ELEMENT`: The element this policy applies to. Must be non-empty.
913914
- `ALLOW_ATTR`: The attribute this policy allows. Must be non-empty.
914915
- `REGEXP`: A regex to match the contents of the attribute against. Must be present but may be empty for unconditional whitelisting of this attribute.
916+
- `ALLOW_DATA_URI_IMAGES`: **false** Allow data uri images (`<img src="data:image/png;base64,..."/>`).
915917

916918
Multiple sanitisation rules can be defined by adding unique subsections, e.g. `[markup.sanitizer.TeX-2]`.
919+
To apply a sanitisation rules only for a specify external renderer they must use the renderer name, e.g. `[markup.sanitizer.asciidoc.rule-1]`.
920+
If the rule is defined above the renderer ini section or the name does not match a renderer it is applied to every renderer.
917921

918922
## Time (`time`)
919923

@@ -991,6 +995,23 @@ MINIO_USE_SSL = false
991995

992996
And used by `[attachment]`, `[lfs]` and etc. as `STORAGE_TYPE`.
993997

998+
## Repository Archive Storage (`storage.repo-archive`)
999+
1000+
Configuration for repository archive storage. It will inherit from default `[storage]` or
1001+
`[storage.xxx]` when set `STORAGE_TYPE` to `xxx`. The default of `PATH`
1002+
is `data/repo-archive` and the default of `MINIO_BASE_PATH` is `repo-archive/`.
1003+
1004+
- `STORAGE_TYPE`: **local**: Storage type for repo archive, `local` for local disk or `minio` for s3 compatible object storage service or other name defined with `[storage.xxx]`
1005+
- `SERVE_DIRECT`: **false**: Allows the storage driver to redirect to authenticated URLs to serve files directly. Currently, only Minio/S3 is supported via signed URLs, local does nothing.
1006+
- `PATH`: **./data/repo-archive**: Where to store archive files, only available when `STORAGE_TYPE` is `local`.
1007+
- `MINIO_ENDPOINT`: **localhost:9000**: Minio endpoint to connect only available when `STORAGE_TYPE` is `minio`
1008+
- `MINIO_ACCESS_KEY_ID`: Minio accessKeyID to connect only available when `STORAGE_TYPE` is `minio`
1009+
- `MINIO_SECRET_ACCESS_KEY`: Minio secretAccessKey to connect only available when `STORAGE_TYPE is` `minio`
1010+
- `MINIO_BUCKET`: **gitea**: Minio bucket to store the lfs only available when `STORAGE_TYPE` is `minio`
1011+
- `MINIO_LOCATION`: **us-east-1**: Minio location to create bucket only available when `STORAGE_TYPE` is `minio`
1012+
- `MINIO_BASE_PATH`: **repo-archive/**: Minio base path on the bucket only available when `STORAGE_TYPE` is `minio`
1013+
- `MINIO_USE_SSL`: **false**: Minio enabled ssl only available when `STORAGE_TYPE` is `minio`
1014+
9941015
## Other (`other`)
9951016

9961017
- `SHOW_FOOTER_BRANDING`: **false**: Show Gitea branding in the footer.

docs/content/doc/advanced/config-cheat-sheet.zh-cn.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,21 @@ MINIO_USE_SSL = false
382382

383383
然后你在 `[attachment]`, `[lfs]` 等中可以把这个名字用作 `STORAGE_TYPE` 的值。
384384

385+
## Repository Archive Storage (`storage.repo-archive`)
386+
387+
Repository archive 的存储配置。 如果 `STORAGE_TYPE` 为空,则此配置将从 `[storage]` 继承。如果不为 `local` 或者 `minio` 而为 `xxx`, 则从 `[storage.xxx]` 继承。当继承时, `PATH` 默认为 `data/repo-archive``MINIO_BASE_PATH` 默认为 `repo-archive/`
388+
389+
- `STORAGE_TYPE`: **local**: Repository archive 的存储类型,`local` 将存储到磁盘,`minio` 将存储到 s3 兼容的对象服务。
390+
- `SERVE_DIRECT`: **false**: 允许直接重定向到存储系统。当前,仅 Minio/S3 是支持的。
391+
- `PATH`: 存放 Repository archive 上传的文件的地方,默认是 `data/repo-archive`
392+
- `MINIO_ENDPOINT`: **localhost:9000**: Minio 地址,仅当 `STORAGE_TYPE``minio` 时有效。
393+
- `MINIO_ACCESS_KEY_ID`: Minio accessKeyID,仅当 `STORAGE_TYPE``minio` 时有效。
394+
- `MINIO_SECRET_ACCESS_KEY`: Minio secretAccessKey,仅当 `STORAGE_TYPE``minio` 时有效。
395+
- `MINIO_BUCKET`: **gitea**: Minio bucket,仅当 `STORAGE_TYPE``minio` 时有效。
396+
- `MINIO_LOCATION`: **us-east-1**: Minio location ,仅当 `STORAGE_TYPE``minio` 时有效。
397+
- `MINIO_BASE_PATH`: **repo-archive/**: Minio base path ,仅当 `STORAGE_TYPE``minio` 时有效。
398+
- `MINIO_USE_SSL`: **false**: Minio 是否启用 ssl ,仅当 `STORAGE_TYPE``minio` 时有效。
399+
385400
## Other (`other`)
386401

387402
- `SHOW_FOOTER_BRANDING`: 为真则在页面底部显示Gitea的字样。

docs/content/doc/advanced/external-renderers.en-us.md

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ IS_INPUT_FILE = false
6464
[markup.jupyter]
6565
ENABLED = true
6666
FILE_EXTENSIONS = .ipynb
67-
RENDER_COMMAND = "jupyter nbconvert --stdout --to html --template basic "
68-
IS_INPUT_FILE = true
67+
RENDER_COMMAND = "jupyter nbconvert --stdin --stdout --to html --template basic"
68+
IS_INPUT_FILE = false
6969

7070
[markup.restructuredtext]
7171
ENABLED = true
@@ -90,15 +90,50 @@ FILE_EXTENSIONS = .md,.markdown
9090
RENDER_COMMAND = pandoc -f markdown -t html --katex
9191
```
9292

93-
You must define `ELEMENT`, `ALLOW_ATTR`, and `REGEXP` in each section.
93+
You must define `ELEMENT` and `ALLOW_ATTR` in each section.
9494

9595
To define multiple entries, add a unique alphanumeric suffix (e.g., `[markup.sanitizer.1]` and `[markup.sanitizer.something]`).
9696

97+
To apply a sanitisation rules only for a specify external renderer they must use the renderer name, e.g. `[markup.sanitizer.asciidoc.rule-1]`, `[markup.sanitizer.<renderer>.rule-1]`.
98+
99+
**Note**: If the rule is defined above the renderer ini section or the name does not match a renderer it is applied to every renderer.
100+
97101
Once your configuration changes have been made, restart Gitea to have changes take effect.
98102

99103
**Note**: Prior to Gitea 1.12 there was a single `markup.sanitiser` section with keys that were redefined for multiple rules, however,
100104
there were significant problems with this method of configuration necessitating configuration through multiple sections.
101105

106+
### Example: Office DOCX
107+
108+
Display Office DOCX files with [`pandoc`](https://pandoc.org/):
109+
```ini
110+
[markup.docx]
111+
ENABLED = true
112+
FILE_EXTENSIONS = .docx
113+
RENDER_COMMAND = "pandoc --from docx --to html --self-contained --template /path/to/basic.html"
114+
115+
[markup.sanitizer.docx.img]
116+
ALLOW_DATA_URI_IMAGES = true
117+
```
118+
119+
The template file has the following content:
120+
```
121+
$body$
122+
```
123+
124+
### Example: Jupyter Notebook
125+
126+
Display Jupyter Notebook files with [`nbconvert`](https://github.com/jupyter/nbconvert):
127+
```ini
128+
[markup.jupyter]
129+
ENABLED = true
130+
FILE_EXTENSIONS = .ipynb
131+
RENDER_COMMAND = "jupyter-nbconvert --stdin --stdout --to html --template basic"
132+
133+
[markup.sanitizer.jupyter.img]
134+
ALLOW_DATA_URI_IMAGES = true
135+
```
136+
102137
## Customizing CSS
103138
The external renderer is specified in the .ini in the format `[markup.XXXXX]` and the HTML supplied by your external renderer will be wrapped in a `<div>` with classes `markup` and `XXXXX`. The `markup` class provides out of the box styling (as does `markdown` if `XXXXX` is `markdown`). Otherwise you can use these classes to specifically target the contents of your rendered HTML.
104139

docs/content/doc/developers/hacking-on-gitea.en-us.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ One of these three distributions of Make will run on Windows:
7373
- The binary is called `mingw32-make.exe` instead of `make.exe`. Add the `bin` folder to `PATH`.
7474
- [Chocolatey package](https://chocolatey.org/packages/make). Run `choco install make`
7575

76+
**Note**: If you are attempting to build using make with Windows Command Prompt, you may run into issues. The above prompts (git bash, or mingw) are recommended, however if you only have command prompt (or potentially powershell) you can set environment variables using the [set](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/set_1) command, e.g. `set TAGS=bindata`.
77+
7678
## Downloading and cloning the Gitea source code
7779

7880
The recommended method of obtaining the source code is by using `git clone`.

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ require (
3030
github.com/couchbase/goutils v0.0.0-20210118111533-e33d3ffb5401 // indirect
3131
github.com/denisenkom/go-mssqldb v0.10.0
3232
github.com/dgrijalva/jwt-go v3.2.0+incompatible
33+
github.com/djherbis/buffer v1.2.0
34+
github.com/djherbis/nio/v3 v3.0.1
3335
github.com/dustin/go-humanize v1.0.0
3436
github.com/editorconfig/editorconfig-core-go/v2 v2.4.2
3537
github.com/emirpasic/gods v1.12.0

go.sum

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,11 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm
244244
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
245245
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
246246
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
247+
github.com/djherbis/buffer v1.1.0/go.mod h1:VwN8VdFkMY0DCALdY8o00d3IZ6Amz/UNVMWcSaJT44o=
248+
github.com/djherbis/buffer v1.2.0 h1:PH5Dd2ss0C7CRRhQCZ2u7MssF+No9ide8Ye71nPHcrQ=
249+
github.com/djherbis/buffer v1.2.0/go.mod h1:fjnebbZjCUpPinBRD+TDwXSOeNQ7fPQWLfGQqiAiUyE=
250+
github.com/djherbis/nio/v3 v3.0.1 h1:6wxhnuppteMa6RHA4L81Dq7ThkZH8SwnDzXDYy95vB4=
251+
github.com/djherbis/nio/v3 v3.0.1/go.mod h1:Ng4h80pbZFMla1yKzm61cF0tqqilXZYrogmWgZxOcmg=
247252
github.com/dlclark/regexp2 v1.1.6/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
248253
github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
249254
github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E=

integrations/api_repo_tags_test.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func TestAPIRepoTags(t *testing.T) {
3939
assert.Equal(t, setting.AppURL+"user2/repo1/archive/v1.1.zip", tags[0].ZipballURL)
4040
assert.Equal(t, setting.AppURL+"user2/repo1/archive/v1.1.tar.gz", tags[0].TarballURL)
4141

42-
newTag := createNewTagUsingAPI(t, session, token, user.Name, repoName, "awesome-tag", "", "nice!\nand some text")
42+
newTag := createNewTagUsingAPI(t, session, token, user.Name, repoName, "gitea/22", "", "nice!\nand some text")
4343
resp = session.MakeRequest(t, req, http.StatusOK)
4444
DecodeJSON(t, resp, &tags)
4545
assert.Len(t, tags, 2)
@@ -51,6 +51,20 @@ func TestAPIRepoTags(t *testing.T) {
5151
assert.EqualValues(t, newTag.Commit.SHA, tag.Commit.SHA)
5252
}
5353
}
54+
55+
// get created tag
56+
req = NewRequestf(t, "GET", "/api/v1/repos/%s/%s/tags/%s?token=%s", user.Name, repoName, newTag.Name, token)
57+
resp = session.MakeRequest(t, req, http.StatusOK)
58+
var tag *api.Tag
59+
DecodeJSON(t, resp, &tag)
60+
assert.EqualValues(t, newTag, tag)
61+
62+
// delete tag
63+
delReq := NewRequestf(t, "DELETE", "/api/v1/repos/%s/%s/tags/%s?token=%s", user.Name, repoName, newTag.Name, token)
64+
resp = session.MakeRequest(t, delReq, http.StatusNoContent)
65+
66+
// check if it's gone
67+
resp = session.MakeRequest(t, req, http.StatusNotFound)
5468
}
5569

5670
func createNewTagUsingAPI(t *testing.T, session *TestSession, token string, ownerName, repoName, name, target, msg string) *api.Tag {

integrations/api_team_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ func TestAPITeamSearch(t *testing.T) {
144144
var results TeamSearchResults
145145

146146
session := loginUser(t, user.Name)
147+
csrf := GetCSRF(t, session, "/"+org.Name)
147148
req := NewRequestf(t, "GET", "/api/v1/orgs/%s/teams/search?q=%s", org.Name, "_team")
149+
req.Header.Add("X-Csrf-Token", csrf)
148150
resp := session.MakeRequest(t, req, http.StatusOK)
149151
DecodeJSON(t, resp, &results)
150152
assert.NotEmpty(t, results.Data)
@@ -154,7 +156,9 @@ func TestAPITeamSearch(t *testing.T) {
154156
// no access if not organization member
155157
user5 := models.AssertExistsAndLoadBean(t, &models.User{ID: 5}).(*models.User)
156158
session = loginUser(t, user5.Name)
159+
csrf = GetCSRF(t, session, "/"+org.Name)
157160
req = NewRequestf(t, "GET", "/api/v1/orgs/%s/teams/search?q=%s", org.Name, "team")
161+
req.Header.Add("X-Csrf-Token", csrf)
158162
resp = session.MakeRequest(t, req, http.StatusForbidden)
159163

160164
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
aacbdfe9e1c4b47f60abe81849045fa4e96f1d75

0 commit comments

Comments
 (0)