You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
forgejo/modules
Gary Kim 7eed11e5e9 Check commit message hashes before making links (#7713)
* 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>
5 years ago
..
auth Make captcha and password optional for external accounts (#6606) 5 years ago
avatar Improve handling of non-square avatars (#7025) 5 years ago
base API error cleanup (#7186) 5 years ago
cache Add golangci (#6418) 5 years ago
context Removed unnecessary conversions (#7557) 5 years ago
cron Move status table to cron package (#7370) 5 years ago
generate Integrate OAuth2 Provider (#5378) 5 years ago
git Do not fetch all refs (#7797) 5 years ago
gzip Add golangci (#6418) 5 years ago
highlight Add a lot of extension to language mappings for syntax highlights (#7741) 5 years ago
httplib Add golangci (#6418) 5 years ago
indexer Remove camel case tokenization from repo indexer (#7733) 5 years ago
lfs Removed unnecessary conversions (#7557) 5 years ago
log Removed unnecessary conversions (#7557) 5 years ago
mailer Add golangci (#6418) 5 years ago
markup Check commit message hashes before making links (#7713) 5 years ago
metrics Prometheus endpoint (#5256) 6 years ago
migrations Import topics during migration (#7851) 5 years ago
minwinsvc Fix Git hooks not being executed on Windows when running as a service (#1149) 7 years ago
notification Add golangci (#6418) 5 years ago
options remove unnecessary fmt on generate bindata (#7706) 5 years ago
pprof Add golangci (#6418) 5 years ago
private #6946 Run hooks on merge/edit and cope with protected branches (#6961) 5 years ago
process Fix run command race (#1470) 7 years ago
public remove unnecessary fmt on generate bindata (#7706) 5 years ago
pull Fix duplicate call of webhook (#7821) 5 years ago
recaptcha Allow Recaptcha service url to be configured (#6820) 5 years ago
repofiles Fix duplicate call of webhook (#7821) 5 years ago
search Global code search support (#3664) 6 years ago
secret Integrate OAuth2 Provider (#5378) 5 years ago
session Add golangci (#6418) 5 years ago
setting Remove settting dependency on modules/session (#7237) 5 years ago
ssh switch to use gliderlabs/ssh for builtin server (#7250) 5 years ago
structs Be more strict with git arguments (#7715) 5 years ago
sync Fix status table race condition (#1835) 7 years ago
templates remove unnecessary fmt on generate bindata (#7706) 5 years ago
test move code.gitea.io/git to code.gitea.io/gitea/modules/git (#6364) 5 years ago
upload Refactor filetype is not allowed errors (#7309) 5 years ago
user Add golangci (#6418) 5 years ago
util Handle insecure and ports in go get (#7041) 5 years ago
validation Fix lax comparison in validation tests (#7815) 5 years ago