Changeset 147 in code
- Timestamp:
- Mar 18, 2024, 1:23:54 AM (15 months ago)
- Location:
- trunk
- Files:
-
- 14 added
- 2 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Makefile
r146 r147 20 20 21 21 yukari: vendor 22 $(GO) build $(GOFLAGS) -o $@22 $(GO) build $(GOFLAGS) ./cmd/yukari 23 23 clean: 24 24 $(RM) -f yukari -
trunk/README.md
r142 r147 1 # Yukari 1 # Yukari's Gap 2 2 3 Web content sanitizer proxy as a service, fork of [MortyProxy](https://github.com/asciimoo/morty) with some suggestions from the issue tracker applied, named after [ Yes, that Gap Youkai](https://en.touhouwiki.net/wiki/Yukari_Yakumo)3 Web content sanitizer proxy as a service, fork of [MortyProxy](https://github.com/asciimoo/morty) with some suggestions from the issue tracker applied, named after [the youkai you shouldn't ever come near](https://en.touhouwiki.net/wiki/Yukari_Yakumo) 4 4 5 Yukari rewrites web pages to exclude malicious HTML tags and attributes. It also replaces external resource references to prevent third party information leaks.5 Yukari's Gap rewrites web pages to exclude malicious HTML tags and attributes. It also replaces external resource references to prevent third party information leaks. 6 6 7 The main goal of yukariis to provide a result proxy for [searx](https://asciimoo.github.com/searx/), but it can be used as a standalone sanitizer service too.7 The main goal of this tool is to provide a result proxy for [searx](https://asciimoo.github.com/searx/), but it can be used as a standalone sanitizer service too. 8 8 9 9 Features: 10 10 11 -HTML sanitization12 -Rewrites HTML/CSS external references to locals13 -JavaScript blocking14 -No Cookies forwarded15 -No Referrers16 -No Caching/Etag17 -Supports GET/POST forms and IFrames18 -Optional HMAC URL verifier key to prevent service abuse11 * HTML sanitization 12 * Rewrites HTML/CSS external references to locals 13 * JavaScript blocking 14 * No Cookies forwarded 15 * No Referrers 16 * No Caching/Etag 17 * Supports GET/POST forms and IFrames 18 * Optional HMAC URL verifier key to prevent service abuse 19 19 20 20 21 21 ## Installation and setup 22 Requirement: Go version 1.1 0or higher.22 Requirement: Go version 1.16 or higher. 23 23 24 24 ``` -
trunk/config/config.go
r142 r147 2 2 3 3 import ( 4 " os"4 "gopkg.in/ini.v1" 5 5 ) 6 6 7 typeConfig struct {7 var Config struct { 8 8 Debug bool 9 9 ListenAddress string … … 17 17 } 18 18 19 var DefaultConfig *Config 19 func readConfig(file string) error { 20 cfg, err := ini.Load(file) 21 if err != nil { 22 return err 23 } 24 Config.Debug, _ = cfg.Section("yukari").Key("debug").Bool() 25 Config.ListenAddress = cfg.Section("yukari").Key("listen").String() 26 Config.Key = cfg.Section("yukari").Key("key").String() 27 Config.IPV6, _ = cfg.Section("yukari").Key("ipv6").Bool() 28 Config.RequestTimeout, _ = cfg.Section("yukari").Key("timeout").Uint() 29 Config.FollowRedirect, _ = cfg.Section("yukari").Key("followredirect").Bool() 30 Config.MaxConnsPerHost, _ = cfg.Section("yukari").Key("max_conns_per_host").Uint() 31 Config.UrlParameter = cfg.Section("yukari").Key("urlparam").String() 32 Config.HashParameter = cfg.Section("yukari").Key("hashparam").String() 20 33 21 func init() { 22 default_listen_addr := os.Getenv("YUKARI_ADDRESS") 23 if default_listen_addr == "" { 24 default_listen_addr = "127.0.0.1:3000" 25 } 26 default_url_parameter := os.Getenv("YUKARI_URL_PARAM") 27 if default_url_parameter == "" { 28 default_url_parameter = "yukariurl" 29 } 30 default_hash_parameter := os.Getenv("YUKARI_HASH_PARAM") 31 if default_hash_parameter == "" { 32 default_hash_parameter = "yukarihash" 33 } 34 default_key := os.Getenv("YUKARI_KEY") 35 DefaultConfig = &Config{ 36 Debug: os.Getenv("DEBUG") != "false", 37 ListenAddress: default_listen_addr, 38 Key: default_key, 39 IPV6: true, 40 RequestTimeout: 5, 41 FollowRedirect: false, 42 MaxConnsPerHost: 4, 43 UrlParameter: default_url_parameter, 44 HashParameter: default_hash_parameter, 45 } 34 return nil 46 35 } -
trunk/go.mod
r142 r147 1 1 module marisa.chaotic.ninja/yukari 2 2 3 go 1.1 43 go 1.16 4 4 5 5 require ( 6 github.com/stretchr/testify v1.9.0 // indirect 6 7 github.com/valyala/fasthttp v1.34.0 7 8 golang.org/x/net v0.7.0 8 9 golang.org/x/text v0.7.0 10 gopkg.in/ini.v1 v1.67.0 9 11 ) -
trunk/go.sum
r140 r147 1 1 github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= 2 2 github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= 3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 4 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 5 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 3 6 github.com/klauspost/compress v1.15.0 h1:xqfchp4whNFxn5A4XFyyYtitiWI8Hy5EW59jEwcyL6U= 4 7 github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= 8 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 9 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 10 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 11 github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= 12 github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= 13 github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= 14 github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 15 github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= 16 github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= 17 github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= 18 github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= 5 19 github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= 6 20 github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= … … 44 58 golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= 45 59 golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 60 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 61 gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= 62 gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= 63 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 64 gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 65 gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -
trunk/yukari.1
r142 r147 1 .TH MORTY "1" "2018" "yukari" "User Commands" 2 .SH NAME 3 yukari \- Privacy aware web content sanitizer proxy as a service 4 .SH SYNOPSIS 5 .B yukari 6 .RI [ OPTIONS ] 7 .br 8 .SH DESCRIPTION 9 Yukari rewrites web pages to exclude malicious HTML tags and attributes. It 10 also replaces external resource references to prevent third party 1 .Dd $Mdocdate$ 2 .Dt YUKARI 1 3 .Os 4 .Sh NAME 5 .Nm yukari 6 .Nd Privacy-aware Web Content Sanitizer Proxy As A Service (WCSPAAS) 7 .Sh SYNOPSIS 8 .Nm 9 .Op Fl f Ar string 10 .Op Fl proxy Ar string 11 .Op Fl proxyenv Ar bool 12 .Op Fl socks5 Ar string 13 .Op Fl version 14 .Sh DESCRIPTION 15 Yukari's Gap rewrites web pages to exclude malicious HTML tags and attributes. 16 It also replaces external resource references in order to prevent third-party 11 17 information leaks. 12 .sp 13 The main goal of yukari is to provide a result proxy for searx, but it can be 14 used as a standalone sanitizer service too. 15 .SH OPTIONS 16 .HP 17 \fB\-ipv6\fR 18 .IP 19 Allow IPv6 HTTP requests 20 .HP 21 \fB\-key\fR string 22 .IP 23 HMAC url validation key (hexadecimal encoded) \- leave blank to disable 24 .HP 25 \fB\-listen\fR string 26 .IP 27 Listen address (default "127.0.0.1:3000") 28 .HP 29 \fB\-timeout\fR uint 30 .IP 31 Request timeout (default 2) 32 .HP 33 \fB\-version\fR 34 .IP 35 Show version 36 .SH BUGS 37 Bugs or suggestions? Visit the issue tracker at 38 https://git.chaotic.ninja/yakumo.izuru/yukari/issues. 39 .SH SEE ALSO 40 .BR searx (1) 41 .SH LICENSE 42 Copyright 2023-present Izuru Yakumo <yakumo.izuru@chaotic.ninja> 43 .br 44 Copyright 2016-2018 Adam Tauber <asciimoo@gmail.com> 45 .br 46 Copyright 2016 Alexandre Flament <alex@al-f.net> 47 .sp 48 This program is free software: you can redistribute it and/or modify it under 49 the terms of the GNU Affero General Public License as published by the Free 50 Software Foundation, either version 3 of the License, or (at your option) any 51 later version. 52 .sp 18 .Pp 19 The main goal of Yukari's Gap is to provide a result proxy for SearX, but it 20 can be used as a standalone sanitizer service, too. 21 .Sh OPTIONS 22 .Bl -tag -width Ds 23 .It Fl f Ar path 24 Load configuration file from path 25 .It Fl proxy Ar string 26 Use the specified HTTP proxy (ie: [user:pass@]hostname:port), 27 this overrides the 28 .Fl socks5 29 option and the IPv6 setting 30 .It Fl proxyenv Ar bool 31 Use a HTTP proxy as set in the environment (such as 32 .Ev HTTP_PROXY , 33 .Ev HTTPS_PROXY , 34 .Ev NO_PROXY 35 ). 36 Overrides the 37 .Fl proxy , 38 .Fl socks5 , 39 flags and the IPv6 setting 40 .It Fl socks5 Ar string 41 Use a SOCKS5 proxy (ie: hostname:port), this 42 overrides the IPv6 setting 43 .El 44 .Sh SEE ALSO 45 .Xr SearX 1 46 .Sh AUTHORS 47 .An Adam Tauber Aq Mt asciimoo@gmail.com 48 .An Alexandre Flament Aq Mt alex@al-f.net 49 .Sh MAINTAINERS 50 .An Izuru Yakumo Aq Mt yakumo.izuru@chaotic.ninja 51 .Sh BUGS 52 Bugs or suggestions? 53 Send an email to 54 .Aq Mt yukari-dev@chaotic.ninja 55 .Sh LICENSE 56 This program is free software: you can redistribute it and/or modify it 57 under the terms of the GNU Affero General Public License as published 58 by the Free Software Foundation, either version 3 of the License, or 59 (at your option) any later version. 60 .Pp 53 61 This program is distributed in the hope that it will be useful, but WITHOUT ANY 54 62 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 55 PARTICULAR PURPOSE. See the GNU Affero General Public License for more 56 details. 57 .sp 58 You should have received a copy of the GNU Affero General Public License along 59 with this program. If not, see <http://www.gnu.org/licenses/>. 63 PARTICULAR PURPOSE. 64 See the GNU Affero General Public License for more details.
Note:
See TracChangeset
for help on using the changeset viewer.