File tree Expand file tree Collapse file tree 1 file changed +32
-10
lines changed Expand file tree Collapse file tree 1 file changed +32
-10
lines changed Original file line number Diff line number Diff line change @@ -27,14 +27,36 @@ This plugin provides *Project Pages* for
2727
2828- 0.1: tested with gitbucket 3.9
2929
30- ## Security
31-
32- The simplistic design of this plugin suffers from XSS vulnerability,
33- you ** have to** trust your users.
34- Or if you're really panic, nginx could be used (or any other front proxy).
35- Suppose you use ` gitbucket.local ` for gitbucket and ` pages.local ` for pages:
36-
37- - redirect ` /[^/]+/[^/]+/pages.* ` under ` gitbucket.local ` ot use
38- ` pages.local `
39- - restrict ` pages.local ` to only have access to pages url above
30+ ## Security (panic mode)
31+
32+ To prevent XSS, one must use two different domain to host pages and
33+ gitbucket. Below is a working example of nginx config to achieve that.
34+
35+ ```
36+ server {
37+ listen 80;
38+ server_name git.local;
39+
40+ location ~ ^/([^/]+)/([^/]+)/pages/(.*)$ {
41+ rewrite ^/([^/]+)/([^/]+)/pages/(.*)$ http://doc.local/$1/$2/pages/$3 redirect;
42+ }
43+
44+ location / {
45+ proxy_pass 127.0.0.1:8080;
46+ }
47+ }
48+
49+ server {
50+ listen 80;
51+ server_name doc.local;
52+
53+ location ~ ^/([^/]+)/([^/]+)/(.*)$ {
54+ proxy_pass 127.0.0.1:8080;
55+ }
56+
57+ location / {
58+ return 403;
59+ }
60+ }
61+ ```
4062
You can’t perform that action at this time.
0 commit comments