forgejo/modules
Gary Kim 7eed11e5e9 Check commit message hashes before making links ()
* Check commit message hashes before making links

Previously, when formatting commit messages, anything
that looked like SHA1 hashes was turned into a link
using regex. This meant that certain phrases or numbers
such as `777777` or `deadbeef` could be recognized as a commit
even if the repository has no commit with those hashes.

This change will make it so that anything that looks
like a SHA1 hash using regex will then also be checked
to ensure that there is a commit in the repository
with that hash before making a link.

Signed-off-by: Gary Kim <gary@garykim.dev>

* Use gogit to check if commit exists

This commit modifies the commit hash check
in the render for commit messages to use
gogit for better performance.

Signed-off-by: Gary Kim <gary@garykim.dev>

* Make code cleaner

Signed-off-by: Gary Kim <gary@garykim.dev>

* Use rev-parse to check if commit exists

Signed-off-by: Gary Kim <gary@garykim.dev>

* Add and modify tests for checking hashes in html link rendering

Signed-off-by: Gary Kim <gary@garykim.dev>

* Return error in sha1CurrentPatternProcessor

Co-Authored-By: mrsdizzie <info@mrsdizzie.com>

* Import Gitea log module

Signed-off-by: Gary Kim <gary@garykim.dev>

* Revert "Return error in sha1CurrentPatternProcessor"

This reverts commit 28f561cac46ef7e51aa26aefcbe9aca4671366a6.

Signed-off-by: Gary Kim <gary@garykim.dev>

* Add debug logging to sha1CurrentPatternProcessor

This will log errors by the git command run in
sha1CurrentPatternProcessor if the error is one
that was unexpected.

Signed-off-by: Gary Kim <gary@garykim.dev>
2019-08-14 16:04:55 +08:00
..
auth Make captcha and password optional for external accounts () 2019-07-06 15:48:02 -04:00
avatar Improve handling of non-square avatars () 2019-05-25 14:46:14 +03:00
base API error cleanup () 2019-06-12 17:07:24 -04:00
cache Add golangci () 2019-06-12 15:41:28 -04:00
context Removed unnecessary conversions () 2019-07-23 19:50:39 +01:00
cron Move status table to cron package () 2019-07-15 20:13:03 -04:00
generate Integrate OAuth2 Provider () 2019-03-08 11:42:50 -05:00
git Do not fetch all refs () 2019-08-13 11:30:44 +03:00
gzip Add golangci () 2019-06-12 15:41:28 -04:00
highlight Add a lot of extension to language mappings for syntax highlights () 2019-08-05 23:48:31 +08:00
httplib Add golangci () 2019-06-12 15:41:28 -04:00
indexer Remove camel case tokenization from repo indexer () 2019-08-06 07:38:16 +03:00
lfs Removed unnecessary conversions () 2019-07-23 19:50:39 +01:00
log Removed unnecessary conversions () 2019-07-23 19:50:39 +01:00
mailer Add golangci () 2019-06-12 15:41:28 -04:00
markup Check commit message hashes before making links () 2019-08-14 16:04:55 +08:00
metrics Prometheus endpoint () 2018-11-04 22:20:00 -05:00
migrations Import topics during migration () 2019-08-14 14:16:12 +08:00
minwinsvc Fix Git hooks not being executed on Windows when running as a service () 2017-03-09 09:27:43 +08:00
notification Add golangci () 2019-06-12 15:41:28 -04:00
options remove unnecessary fmt on generate bindata () 2019-08-01 13:34:46 -04:00
pprof Add golangci () 2019-06-12 15:41:28 -04:00
private Run hooks on merge/edit and cope with protected branches () 2019-07-01 09:18:13 +08:00
process Fix run command race () 2017-11-13 22:51:45 +08:00
public remove unnecessary fmt on generate bindata () 2019-08-01 13:34:46 -04:00
pull Fix duplicate call of webhook () 2019-08-11 23:31:18 +03:00
recaptcha Allow Recaptcha service url to be configured () 2019-05-02 16:09:39 +03:00
repofiles Fix duplicate call of webhook () 2019-08-11 23:31:18 +03:00
search Global code search support () 2018-03-16 22:04:33 +08:00
secret Integrate OAuth2 Provider () 2019-03-08 11:42:50 -05:00
session Add golangci () 2019-06-12 15:41:28 -04:00
setting Remove settting dependency on modules/session () 2019-07-17 09:04:37 +08:00
ssh switch to use gliderlabs/ssh for builtin server () 2019-07-06 21:28:09 -04:00
structs Be more strict with git arguments () 2019-08-05 21:39:39 +01:00
sync Fix status table race condition () 2017-05-31 16:57:17 +08:00
templates remove unnecessary fmt on generate bindata () 2019-08-01 13:34:46 -04:00
test move code.gitea.io/git to code.gitea.io/gitea/modules/git () 2019-03-27 17:33:00 +08:00
upload Refactor filetype is not allowed errors () 2019-07-06 22:25:05 -04:00
user Add golangci () 2019-06-12 15:41:28 -04:00
util Handle insecure and ports in go get () 2019-05-27 22:08:38 +01:00
validation Fix lax comparison in validation tests () 2019-08-12 10:17:25 +08:00