all repos — honk @ 032dbdcfff33b20af1c5ec11c98f2a6a5361157c

my fork of honk

record the csp violators
Ted Unangst tedu@tedunangst.com
Sat, 27 May 2023 22:47:55 -0400
commit

032dbdcfff33b20af1c5ec11c98f2a6a5361157c

parent

31855c095847427468db9f1d06d763eccf59385f

1 files changed, 12 insertions(+), 0 deletions(-)

jump to
M web.goweb.go

@@ -2440,6 +2440,16 @@ return

} } +func fiveoh(w http.ResponseWriter, r *http.Request) { + fd, err := os.OpenFile("violations.json", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666) + if err != nil { + elog.Printf("error opening violations! %s", err) + return + } + defer fd.Close() + io.Copy(fd, r.Body) +} + var endoftheworld = make(chan bool) var readyalready = make(chan bool) var workinprogress = 0

@@ -2593,6 +2603,8 @@

getters.HandleFunc("/server", serveractor) posters.HandleFunc("/server/inbox", serverinbox) posters.HandleFunc("/inbox", serverinbox) + + posters.HandleFunc("/csp-violation", fiveoh) getters.HandleFunc("/style.css", serveviewasset) getters.HandleFunc("/honkpage.js", serveviewasset)