From 048468560f98929bdb252403ef5c3012900769ea Mon Sep 17 00:00:00 2001 From: Antoine GIRARD Date: Sat, 9 Jun 2018 18:03:23 +0200 Subject: [PATCH 1/8] Add security advice to contrib guide (#4187) * Improve contributing guidelines for security --- CONTRIBUTING.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e02110b57..13f1ce41c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -201,6 +201,10 @@ an advisor has time to code review, we will gladly welcome them back to the maintainers team. If a maintainer is inactive for more than 3 months and forgets to leave the maintainers team, the owners may move him or her from the maintainers team to the advisors team. +For security reasons, Maintainers should use 2FA for their accounts and +if possible provide gpg signed commits. +https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/ +https://help.github.com/articles/signing-commits-with-gpg/ ## Owners @@ -211,6 +215,9 @@ be the main owner, and the other two the assistant owners. When the new owners have been elected, the old owners will give up ownership to the newly elected owners. If an owner is unable to do so, the other owners will assist in ceding ownership to the newly elected owners. +For security reasons, Owners or any account with write access (like a bot) +must use 2FA. +https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/ After the election, the new owners should proactively agree with our [CONTRIBUTING](CONTRIBUTING.md) requirements in the From 47f59589c5971f69b6ad9a066bcd6798384266df Mon Sep 17 00:00:00 2001 From: Jesse Lucas Date: Sat, 9 Jun 2018 15:16:16 -0400 Subject: [PATCH 2/8] Update backup and restore doc usage (#4165) Edit example of `./gitea dump` to include -c option to pass app.ini Signed-off-by: Jesse Lucas --- docs/content/doc/usage/backup-and-restore.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/usage/backup-and-restore.en-us.md b/docs/content/doc/usage/backup-and-restore.en-us.md index fa73c38bc..a0816ebe4 100644 --- a/docs/content/doc/usage/backup-and-restore.en-us.md +++ b/docs/content/doc/usage/backup-and-restore.en-us.md @@ -20,7 +20,7 @@ file can be unpacked and used to restore an instance. ## Backup Command (`dump`) -Switch to the user running gitea: `su git`. Run `./gitea dump` in the gitea installation +Switch to the user running gitea: `su git`. Run `./gitea dump -c /path/to/app.ini` in the gitea installation directory. There should be some output similar to the following: ``` From ef0bc57ae7df50736534563d359ef9d0f2015c1d Mon Sep 17 00:00:00 2001 From: GiteaBot Date: Sat, 9 Jun 2018 19:16:38 +0000 Subject: [PATCH 3/8] [skip ci] Updated translations via Crowdin --- options/locale/locale_uk-UA.ini | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/options/locale/locale_uk-UA.ini b/options/locale/locale_uk-UA.ini index 4f4fda0de..70d31b18e 100644 --- a/options/locale/locale_uk-UA.ini +++ b/options/locale/locale_uk-UA.ini @@ -343,9 +343,13 @@ primary=Основний primary_email=Зробити основним delete_email=Видалити email_deletion=Видалити адресу електронної пошти +openid_deletion=Видалити адресу OpenID add_new_email=Додати нову адресу електронної пошти +add_new_openid=Додати новий OpenID URI add_email=Додати адресу електронної пошти +add_openid=Додати OpenID URI add_email_confirmation_sent=Електронний лист із підтвердженням було відправлено на '%s', будь ласка, перевірте вашу поштову скриньку протягом наступних %s, щоб підтвердити адресу. +add_email_success=Додано нову адресу електронної пошти. keep_email_private=Приховати адресу електронної пошти keep_email_private_popup=Вашу адресу електронної пошти буде приховано від інших користувачів. @@ -394,6 +398,7 @@ access_token_deletion=Видалити токен доступу twofa_disable=Вимкнути двофакторну автентифікацію or_enter_secret=Або введіть секрет: %s +passcode_invalid=Некоректний пароль. Спробуй ще раз. u2f_register_key=Додати ключ безпеки u2f_nickname=Псевдонім @@ -403,8 +408,10 @@ manage_account_links=Керування обліковими записами remove_account_link=Видалити облікові записи orgs_none=Ви не є учасником будь-якої організації. +repos_none=У вас немає власних репозиторіїв delete_account=Видалити ваш обліковий запис +delete_prompt=Ця операція остаточно видалить обліковий запис користувача. Це НЕ МОЖЛИВО відмінити. confirm_delete_account=Підтвердження видалення delete_account_title=Видалити цей обліковий запис @@ -490,6 +497,7 @@ file_history=Історія file_view_raw=Перегляд Raw file_permalink=Постійне посилання file_too_large=Цей файл завеликий щоб бути показаним. +video_not_supported_in_browser=Ваш браузер не підтримує тег 'video' HTML5. stored_lfs=Збережено з Git LFS commit_graph=Графік комітів @@ -497,6 +505,7 @@ editor.new_file=Новий файл editor.upload_file=Завантажити файл editor.edit_file=Редагування файлу editor.preview_changes=Попередній перегляд змін +editor.cannot_edit_non_text_files=Бінарні файли не можливо редагувати у веб-інтерфейсі. editor.edit_this_file=Редагувати файл editor.must_be_on_a_branch=Ви повинні бути у гілці щоб зробити, або запропонувати зміни до цього файлу. editor.fork_before_edit=Необхідно зробити форк цього репозиторій, щоб внести або запропонувати зміни в цей файл. From 9033eaeec1a082bd03a726daaccb85cb64b364d1 Mon Sep 17 00:00:00 2001 From: Fluf <36822577+flufmonster@users.noreply.github.com> Date: Sat, 9 Jun 2018 16:51:10 -0400 Subject: [PATCH 4/8] Only show "You cannot fork a repository you own" when needed (#4130) --- templates/repo/header.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 6d1d9edf8..6f54cb9f6 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -32,7 +32,7 @@ {{if .CanBeForked}}
- + {{$.i18n.Tr "repo.fork"}} From f54626df0b8aed0c3374cb6caafdb49aa4198006 Mon Sep 17 00:00:00 2001 From: Fluf <36822577+flufmonster@users.noreply.github.com> Date: Sat, 9 Jun 2018 18:35:14 -0400 Subject: [PATCH 5/8] Add config path as an optional flag when changing pass via CLI (#4184) --- cmd/admin.go | 9 +++++++++ docs/content/doc/usage/command-line.md | 1 + 2 files changed, 10 insertions(+) diff --git a/cmd/admin.go b/cmd/admin.go index 6c79141ea..4fb0810c6 100644 --- a/cmd/admin.go +++ b/cmd/admin.go @@ -73,6 +73,11 @@ var ( Value: "", Usage: "New password to set for user", }, + cli.StringFlag{ + Name: "config, c", + Value: "custom/conf/app.ini", + Usage: "Custom configuration file path", + }, }, } @@ -123,6 +128,10 @@ func runChangePassword(c *cli.Context) error { return err } + if c.IsSet("config") { + setting.CustomConf = c.String("config") + } + if err := initDB(); err != nil { return err } diff --git a/docs/content/doc/usage/command-line.md b/docs/content/doc/usage/command-line.md index 9c16d4904..a7a10b4e4 100644 --- a/docs/content/doc/usage/command-line.md +++ b/docs/content/doc/usage/command-line.md @@ -62,6 +62,7 @@ Admin operations: - Options: - `--username value`, `-u value`: Username. Required. - `--password value`, `-p value`: New password. Required. + - `--config path`: Gitea configuration file path. Optional. (default: custom/conf/app.ini). - Examples: - `gitea admin change-password --username myname --password asecurepassword` - `regenerate` From af57d6ab8a5a1f0f8bb3f52a081736c8c57cbd72 Mon Sep 17 00:00:00 2001 From: David Schneiderbauer Date: Sun, 10 Jun 2018 03:48:45 +0200 Subject: [PATCH 6/8] undo #3142 because processes don't use the util.Timestamp (#4203) --- templates/admin/monitor.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/admin/monitor.tmpl b/templates/admin/monitor.tmpl index ceca29146..6cc927d68 100644 --- a/templates/admin/monitor.tmpl +++ b/templates/admin/monitor.tmpl @@ -49,8 +49,8 @@ {{.PID}} {{.Description}} - {{.Start.FormatLong}} - {{TimeSinceUnix .Start $.Lang}} + {{DateFmtLong .Start}} + {{TimeSince .Start $.Lang}} {{end}} From 2bb73fe12c1377f133192afd40197d897558de63 Mon Sep 17 00:00:00 2001 From: nickolas360 Date: Sun, 10 Jun 2018 11:42:16 -0700 Subject: [PATCH 7/8] HTML-escape text READMEs (#4192) --- routers/repo/view.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/routers/repo/view.go b/routers/repo/view.go index d2efe3009..4f1deeae4 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -105,7 +105,9 @@ func renderDirectory(ctx *context.Context, treeLink string) { ctx.Data["FileContent"] = string(markup.Render(readmeFile.Name(), buf, treeLink, ctx.Repo.Repository.ComposeMetas())) } else { ctx.Data["IsRenderedHTML"] = true - ctx.Data["FileContent"] = string(bytes.Replace(buf, []byte("\n"), []byte(`
`), -1)) + ctx.Data["FileContent"] = strings.Replace( + gotemplate.HTMLEscapeString(string(buf)), "\n", `
`, -1, + ) } } } @@ -208,7 +210,9 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st ctx.Data["FileContent"] = string(markup.Render(blob.Name(), buf, path.Dir(treeLink), ctx.Repo.Repository.ComposeMetas())) } else if readmeExist { ctx.Data["IsRenderedHTML"] = true - ctx.Data["FileContent"] = string(bytes.Replace(buf, []byte("\n"), []byte(`
`), -1)) + ctx.Data["FileContent"] = strings.Replace( + gotemplate.HTMLEscapeString(string(buf)), "\n", `
`, -1, + ) } else { // Building code view blocks with line number on server side. var fileContent string From e3b77f92c1213159c7c4b14fbc65798e8c85706d Mon Sep 17 00:00:00 2001 From: GiteaBot Date: Sun, 10 Jun 2018 18:43:21 +0000 Subject: [PATCH 8/8] [skip ci] Updated translations via Crowdin --- options/locale/locale_uk-UA.ini | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/options/locale/locale_uk-UA.ini b/options/locale/locale_uk-UA.ini index 70d31b18e..f205decda 100644 --- a/options/locale/locale_uk-UA.ini +++ b/options/locale/locale_uk-UA.ini @@ -365,6 +365,7 @@ key_id=ID ключа key_name=Ім'я ключа key_content=Зміст add_key_success=SSH ключ '%s' додано. +add_gpg_key_success=GPG ключ '%s' додано. delete_key=Видалити ssh_key_deletion=Видалити SSH ключ gpg_key_deletion=Видалити GPG ключ @@ -972,6 +973,7 @@ org_desc=Опис team_name=Назва команди team_desc=Опис team_name_helper=Назва команди має бути простою та зрозумілою. +team_desc_helper=Опишіть мету або роль команди. team_permission_desc=Права доступу team_unit_desc=Дозволити доступ до розділів репозиторію @@ -984,6 +986,8 @@ settings.website=Веб-сайт settings.location=Розташування settings.update_settings=Оновити налаштування settings.update_setting_success=Налаштування організації оновлені. +settings.change_orgname_prompt=Ця зміна змінить посилання на організацію. +settings.update_avatar_success=Аватар організації оновлений. settings.delete=Видалити організацію settings.delete_account=Видалити цю організацію settings.confirm_delete_account=Підтвердіть видалення @@ -1049,9 +1053,11 @@ dashboard.delete_inactivate_accounts_success=Усі неактивні облі dashboard.delete_repo_archives=Видалити всі архіви репозиторіїв dashboard.git_gc_repos_success=Всі репозиторії завершили збирання сміття. dashboard.server_uptime=Uptime серверу +dashboard.current_goroutine=Поточна кількість Goroutines dashboard.current_memory_usage=Поточне використання пам'яті dashboard.total_memory_allocated=Виділено пам'яті загалом dashboard.memory_obtained=Отримано пам'яті +dashboard.pointer_lookup_times=Пошуків вказівника dashboard.memory_allocate_times=Виділення пам'яті dashboard.current_heap_usage=Поточне використання динамічної пам'яті dashboard.heap_memory_obtained=Отримано динамічної пам'яті @@ -1059,6 +1065,7 @@ dashboard.heap_memory_idle=Не використовується динаміч dashboard.heap_memory_in_use=Використовується динамічною пам'яттю dashboard.heap_memory_released=Звільнено динамічної пам'яті dashboard.heap_objects=Об'єктів динамічної пам'яті +dashboard.bootstrap_stack_usage=Використання стеку Bootstrap dashboard.stack_memory_obtained=Зайнято пам'яті стеком dashboard.mspan_structures_usage=Використання структур MSpan dashboard.mspan_structures_obtained=Отримано структур MSpan @@ -1133,6 +1140,7 @@ auths.bind_dn=Прив'язати DN auths.bind_password=Прив'язати пароль auths.user_base=База пошуку користувачів auths.user_dn=DN користувача +auths.attribute_username=Атрибут імені користувача auths.search_page_size=Розмір сторінки auths.filter=Користувацький фільтр auths.admin_filter=Фільтр адміністратора @@ -1276,12 +1284,14 @@ monitor.name=Ім'я monitor.schedule=Розклад monitor.next=Наступного разу monitor.previous=Попереднього разу +monitor.execute_times=Кількість виконань monitor.process=Запущені процеси monitor.desc=Опис monitor.start=Час початку monitor.execute_time=Час виконання notices.system_notice_list=Сповіщення системи +notices.view_detail_header=Переглянути деталі повідомлення notices.actions=Дії notices.select_all=Вибрати все notices.deselect_all=Скасувати виділення @@ -1336,6 +1346,7 @@ raw_minutes=хвилини [dropzone] default_message=Перетягніть файли або натисніть тут, щоб завантажити. +invalid_input_type=Ви не можете завантажувати файли цього типу. file_too_big=Розмір файлу ({{filesize}} MB), що більше ніж максимальний розмір: ({{maxFilesize}} MB). remove_file=Видалити файл