~emersion/soju-dev

Match http-origin against src.Hostname instead of self v1 PROPOSED

sentriz: 1
 Match http-origin against src.Hostname instead of self

 1 files changed, 1 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/soju-dev/patches/51113/mbox | git am -3
Learn more about email & git

[PATCH] Match http-origin against src.Hostname instead of self Export this patch

it looks like for http-origin validation, path.Match() was matching a
pattern against itself. it looks to me like the validation should check
against srv.Hostname instead
---
 config/config.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config/config.go b/config/config.go
index 1d9122f..c50c5fb 100644
--- a/config/config.go
+++ b/config/config.go
@@ -220,7 +220,7 @@ func Load(filename string) (*Server, error) {
		srv.FileUpload = &FileUpload{driver, source}
	}
	for _, origin := range raw.HTTPOrigin {
		if _, err := path.Match(origin, origin); err != nil {
		if _, err := path.Match(origin, srv.Hostname); err != nil {
			return nil, fmt.Errorf("directive http-origin: %v", err)
		}
	}
-- 
2.44.0