diff --git a/devel/gogs/Makefile b/devel/gogs/Makefile --- a/devel/gogs/Makefile +++ b/devel/gogs/Makefile @@ -1,7 +1,6 @@ PORTNAME= gogs DISTVERSIONPREFIX= v -DISTVERSION= 0.12.11 -PORTREVISION= 11 +DISTVERSION= 0.13.0 CATEGORIES= devel www MAINTAINER= dmgk@FreeBSD.org @@ -57,9 +56,9 @@ -e 's|^TYPE = postgres$$|DB_TYPE = sqlite3|' \ ${WRKSRC}/conf/app.ini -pre-build: - cd ${WRKSRC} && \ - ${SETENV} ${MAKE_ENV} ${GO_ENV} ${GO_CMD} generate internal/assets/templates/templates.go \ +#pre-build: +# cd ${WRKSRC} && \ +# ${SETENV} ${MAKE_ENV} ${GO_ENV} ${GO_CMD} generate internal/template/template.go post-install: ${INSTALL_SCRIPT} ${WRKDIR}/gogs ${STAGEDIR}${PREFIX}/bin/ diff --git a/devel/gogs/distinfo b/devel/gogs/distinfo --- a/devel/gogs/distinfo +++ b/devel/gogs/distinfo @@ -1,5 +1,5 @@ -TIMESTAMP = 1677365270 -SHA256 (go/devel_gogs/gogs-v0.12.11/v0.12.11.mod) = c8db79afd06b0af9ed8878c39b5c74da5dd3b8317e28bbc8b52b77e6a440f7d1 -SIZE (go/devel_gogs/gogs-v0.12.11/v0.12.11.mod) = 3338 -SHA256 (go/devel_gogs/gogs-v0.12.11/v0.12.11.zip) = 6c9b93c2ae0d6420e79c8449d8cd55bbc6032a8e63905d028e6b0399e3f2314e -SIZE (go/devel_gogs/gogs-v0.12.11/v0.12.11.zip) = 22208341 +TIMESTAMP = 1720767779 +SHA256 (go/devel_gogs/gogs-v0.13.0/v0.13.0.mod) = 6084525915c838e3968d9f6cb4ba323fbab1368ff1a6542b63405238d144d5ef +SIZE (go/devel_gogs/gogs-v0.13.0/v0.13.0.mod) = 6566 +SHA256 (go/devel_gogs/gogs-v0.13.0/v0.13.0.zip) = 50033cdd48a521812fd1a8df0919a91b7c48ce87db927ea49751c06b722fc39c +SIZE (go/devel_gogs/gogs-v0.13.0/v0.13.0.zip) = 10027345 diff --git a/devel/gogs/files/patch-internal_db_release.go b/devel/gogs/files/patch-internal_db_release.go new file mode 100644 --- /dev/null +++ b/devel/gogs/files/patch-internal_db_release.go @@ -0,0 +1,15 @@ +--- internal/db/release.go.orig 1979-11-29 23:00:00 UTC ++++ internal/db/release.go +@@ -125,8 +125,10 @@ func createTag(gitRepo *git.Repository, r *Release) er + return fmt.Errorf("get branch commit: %v", err) + } + +- // Trim '--' prefix to prevent command line argument vulnerability. +- r.TagName = strings.TrimPrefix(r.TagName, "--") ++ // Prevent argument injection vulnerability. ++ if strings.HasPrefix(r.TagName, "-") { ++ return fmt.Errorf("invalid tag name: %v", r.TagName) ++ } + if err = gitRepo.CreateTag(r.TagName, commit.ID.String()); err != nil { + if strings.Contains(err.Error(), "is not a valid tag name") { + return ErrInvalidTagName{r.TagName} diff --git a/devel/gogs/files/patch-internal_db_repo__editor.go b/devel/gogs/files/patch-internal_db_repo__editor.go new file mode 100644 --- /dev/null +++ b/devel/gogs/files/patch-internal_db_repo__editor.go @@ -0,0 +1,35 @@ +--- internal/db/repo_editor.go.orig 1979-11-29 23:00:00 UTC ++++ internal/db/repo_editor.go +@@ -238,7 +238,7 @@ func (repo *Repository) GetDiffPreview(branch, treePat + return nil, fmt.Errorf("write file: %v", err) + } + +- cmd := exec.Command("git", "diff", treePath) ++ cmd := exec.Command("git", "diff", "--end-of-options", treePath) + cmd.Dir = localPath + cmd.Stderr = os.Stderr + +@@ -299,7 +299,22 @@ func (repo *Repository) DeleteRepoFile(doer *User, opt + } + + localPath := repo.LocalCopyPath() +- if err = os.Remove(path.Join(localPath, opts.TreePath)); err != nil { ++ noSymlinksPath, err := filepath.EvalSymlinks(path.Join(localPath, opts.TreePath)) ++ if err != nil { ++ return fmt.Errorf("invalid tree path: %v", err) ++ } ++ normalizedPath, err := filepath.Abs(noSymlinksPath) ++ if err != nil { ++ return fmt.Errorf("invalid tree path: %v", opts.TreePath) ++ } ++ if !strings.HasPrefix(normalizedPath + "/", localPath + "/") { ++ return fmt.Errorf("invalid tree path: %v", opts.TreePath) ++ } ++ gitPath := path.Join(localPath, ".git") ++ if normalizedPath == gitPath || strings.HasPrefix(normalizedPath + "/", gitPath + "/") { ++ return fmt.Errorf("invalid tree path: %v", opts.TreePath) ++ } ++ if err = os.Remove(normalizedPath); err != nil { + return fmt.Errorf("remove file %q: %v", opts.TreePath, err) + } + diff --git a/devel/gogs/files/patch-internal_route_install.go b/devel/gogs/files/patch-internal_route_install.go deleted file mode 100644 --- a/devel/gogs/files/patch-internal_route_install.go +++ /dev/null @@ -1,11 +0,0 @@ ---- internal/route/install.go.orig 2020-08-30 17:50:22 UTC -+++ internal/route/install.go -@@ -121,7 +121,7 @@ func InstallInit(c *context.Context) { - c.Title("install.install") - c.PageIs("Install") - -- c.Data["DbOptions"] = []string{"MySQL", "PostgreSQL", "MSSQL", "SQLite3"} -+ c.Data["DbOptions"] = []string{"MySQL", "PostgreSQL", "SQLite3"} - } - - func Install(c *context.Context) { diff --git a/devel/gogs/files/patch-internal_ssh_ssh.go b/devel/gogs/files/patch-internal_ssh_ssh.go new file mode 100644 --- /dev/null +++ b/devel/gogs/files/patch-internal_ssh_ssh.go @@ -0,0 +1,39 @@ +--- internal/ssh/ssh.go.orig 1979-11-29 23:00:00 UTC ++++ internal/ssh/ssh.go +@@ -6,7 +6,6 @@ import ( + + import ( + "context" +- "fmt" + "io" + "net" + "os" +@@ -54,28 +53,6 @@ func handleServerConn(keyID string, chans <-chan ssh.N + for req := range in { + payload := cleanCommand(string(req.Payload)) + switch req.Type { +- case "env": +- var env struct { +- Name string +- Value string +- } +- if err := ssh.Unmarshal(req.Payload, &env); err != nil { +- log.Warn("SSH: Invalid env payload %q: %v", req.Payload, err) +- continue +- } +- // Sometimes the client could send malformed command (i.e. missing "="), +- // see https://discuss.gogs.io/t/ssh/3106. +- if env.Name == "" || env.Value == "" { +- log.Warn("SSH: Invalid env arguments: %+v", env) +- continue +- } +- +- _, stderr, err := com.ExecCmd("env", fmt.Sprintf("%s=%s", env.Name, env.Value)) +- if err != nil { +- log.Error("env: %v - %s", err, stderr) +- return +- } +- + case "exec": + cmdName := strings.TrimLeft(payload, "'()") + log.Trace("SSH: Payload: %v", cmdName) diff --git a/devel/gogs/files/patch-templates_install.tmpl b/devel/gogs/files/patch-templates_install.tmpl --- a/devel/gogs/files/patch-templates_install.tmpl +++ b/devel/gogs/files/patch-templates_install.tmpl @@ -1,10 +1,10 @@ ---- templates/install.tmpl.orig 2017-11-22 19:46:14 UTC +--- templates/install.tmpl.orig 1979-11-29 23:00:00 UTC +++ templates/install.tmpl @@ -8,12 +8,9 @@
{{template "base/alert" .}} --

{{.i18n.Tr "install.docker_helper" "https://github.com/gogits/gogs/tree/master/docker" | Safe}}

+-

{{.i18n.Tr "install.docker_helper" "https://github.com/gogs/gogs/tree/main/docker" | Safe}}

-
@@ -13,16 +13,16 @@
-
+
-
+
{{.i18n.Tr "install.sqlite_helper" | Safe}} -@@ -79,12 +76,12 @@ +@@ -83,12 +80,12 @@ {{.i18n.Tr "install.app_name_helper"}}
@@ -37,7 +37,7 @@ {{.i18n.Tr "install.run_user_helper"}} -@@ -115,7 +112,7 @@ +@@ -119,7 +116,7 @@ {{.i18n.Tr "install.app_url_helper"}}
diff --git a/devel/gogs/pkg-plist b/devel/gogs/pkg-plist --- a/devel/gogs/pkg-plist +++ b/devel/gogs/pkg-plist @@ -5,6 +5,8 @@ @sample(%%GOGS_USER%%,%%GOGS_GROUP%%,640) %%ETCDIR%%/conf/app.ini.sample etc/rc.d/gogs libexec/gogs/conf/app.ini +libexec/gogs/conf/embed.go +libexec/gogs/conf/embed_test.go libexec/gogs/conf/auth.d/github.conf.example libexec/gogs/conf/auth.d/ldap_bind_dn.conf.example libexec/gogs/conf/auth.d/ldap_simple_auth.conf.example @@ -230,10 +232,12 @@ libexec/gogs/conf/locale/locale_ja-JP.ini libexec/gogs/conf/locale/locale_ko-KR.ini libexec/gogs/conf/locale/locale_lv-LV.ini +libexec/gogs/conf/locale/locale_mn-MN.ini libexec/gogs/conf/locale/locale_nl-NL.ini libexec/gogs/conf/locale/locale_pl-PL.ini libexec/gogs/conf/locale/locale_pt-BR.ini libexec/gogs/conf/locale/locale_pt-PT.ini +libexec/gogs/conf/locale/locale_ro-RO.ini libexec/gogs/conf/locale/locale_ru-RU.ini libexec/gogs/conf/locale/locale_sk-SK.ini libexec/gogs/conf/locale/locale_sr-SP.ini @@ -283,6 +287,7 @@ libexec/gogs/public/css/themes/default/assets/fonts/outline-icons.woff libexec/gogs/public/css/themes/default/assets/fonts/outline-icons.woff2 libexec/gogs/public/css/themes/default/assets/images/flags.png +libexec/gogs/public/embed.go libexec/gogs/public/img/404.png libexec/gogs/public/img/500.png libexec/gogs/public/img/avatar_default.png @@ -1174,7 +1179,7 @@ libexec/gogs/public/img/gogs-hero.png libexec/gogs/public/img/slack.png libexec/gogs/public/js/gogs.js -libexec/gogs/public/js/jquery-3.4.1.min.js +libexec/gogs/public/js/jquery-3.6.0.min.js libexec/gogs/public/js/libs/clipboard-2.0.4.min.js libexec/gogs/public/js/libs/emojify-1.1.0.min.js libexec/gogs/public/js/libs/jquery.are-you-sure.js @@ -1491,6 +1496,7 @@ libexec/gogs/public/plugins/jquery.minicolors-2.2.3/jquery.minicolors.min.js libexec/gogs/public/plugins/jquery.minicolors-2.2.3/jquery.minicolors.png libexec/gogs/public/plugins/marked-0.8.1/marked.min.js +libexec/gogs/public/plugins/mermaid-8.14.0/mermaid.min.js libexec/gogs/public/plugins/notebookjs-0.4.2/notebook.min.js libexec/gogs/public/plugins/pdfjs-1.4.20/LICENSE libexec/gogs/public/plugins/pdfjs-1.4.20/build/pdf.js @@ -1605,6 +1611,7 @@ libexec/gogs/templates/base/delete_modal_actions.tmpl libexec/gogs/templates/base/footer.tmpl libexec/gogs/templates/base/head.tmpl +libexec/gogs/templates/embed.go libexec/gogs/templates/explore/navbar.tmpl libexec/gogs/templates/explore/organizations.tmpl libexec/gogs/templates/explore/page.tmpl