Show More
@@ -1244,6 +1244,11 b' coreconfigitem(' | |||||
1244 | ) |
|
1244 | ) | |
1245 | coreconfigitem( |
|
1245 | coreconfigitem( | |
1246 | b'experimental', |
|
1246 | b'experimental', | |
|
1247 | b'server.allow-hidden-access', | |||
|
1248 | default=list, | |||
|
1249 | ) | |||
|
1250 | coreconfigitem( | |||
|
1251 | b'experimental', | |||
1247 | b'server.filesdata.recommended-batch-size', |
|
1252 | b'server.filesdata.recommended-batch-size', | |
1248 | default=50000, |
|
1253 | default=50000, | |
1249 | ) |
|
1254 | ) |
@@ -13,6 +13,7 b' import mimetypes' | |||||
13 | import os |
|
13 | import os | |
14 | import stat |
|
14 | import stat | |
15 |
|
15 | |||
|
16 | from ..i18n import _ | |||
16 | from ..pycompat import ( |
|
17 | from ..pycompat import ( | |
17 | getattr, |
|
18 | getattr, | |
18 | open, |
|
19 | open, | |
@@ -49,6 +50,32 b' def ismember(ui, username, userlist):' | |||||
49 | return userlist == [b'*'] or username in userlist |
|
50 | return userlist == [b'*'] or username in userlist | |
50 |
|
51 | |||
51 |
|
52 | |||
|
53 | def hashiddenaccess(repo, req): | |||
|
54 | if bool(req.qsparams.get(b'access-hidden')): | |||
|
55 | # Disable this by default for now. Main risk is to get critical | |||
|
56 | # information exposed through this. This is expecially risky if | |||
|
57 | # someone decided to make a changeset secret for good reason, but | |||
|
58 | # its predecessors are still draft. | |||
|
59 | # | |||
|
60 | # The feature is currently experimental, so we can still decide to | |||
|
61 | # change the default. | |||
|
62 | ui = repo.ui | |||
|
63 | allow = ui.configlist(b'experimental', b'server.allow-hidden-access') | |||
|
64 | user = req.remoteuser | |||
|
65 | if allow and ismember(ui, user, allow): | |||
|
66 | return True | |||
|
67 | else: | |||
|
68 | msg = ( | |||
|
69 | _( | |||
|
70 | b'ignoring request to access hidden changeset by ' | |||
|
71 | b'unauthorized user: %r\n' | |||
|
72 | ) | |||
|
73 | % user | |||
|
74 | ) | |||
|
75 | ui.warn(msg) | |||
|
76 | return False | |||
|
77 | ||||
|
78 | ||||
52 | def checkauthz(hgweb, req, op): |
|
79 | def checkauthz(hgweb, req, op): | |
53 | """Check permission for operation based on request data (including |
|
80 | """Check permission for operation based on request data (including | |
54 | authentication info). Return if op allowed, else raise an ErrorResponse |
|
81 | authentication info). Return if op allowed, else raise an ErrorResponse |
@@ -39,6 +39,7 b' from .. import (' | |||||
39 | ) |
|
39 | ) | |
40 |
|
40 | |||
41 | from . import ( |
|
41 | from . import ( | |
|
42 | common, | |||
42 | request as requestmod, |
|
43 | request as requestmod, | |
43 | webcommands, |
|
44 | webcommands, | |
44 | webutil, |
|
45 | webutil, | |
@@ -124,6 +125,16 b' class requestcontext:' | |||||
124 | self.req = req |
|
125 | self.req = req | |
125 | self.res = res |
|
126 | self.res = res | |
126 |
|
127 | |||
|
128 | # Only works if the filter actually support being upgraded to show | |||
|
129 | # visible changesets | |||
|
130 | current_filter = repo.filtername | |||
|
131 | if ( | |||
|
132 | common.hashiddenaccess(repo, req) | |||
|
133 | and current_filter is not None | |||
|
134 | and current_filter + b'.hidden' in repoview.filtertable | |||
|
135 | ): | |||
|
136 | self.repo = self.repo.filtered(repo.filtername + b'.hidden') | |||
|
137 | ||||
127 | self.maxchanges = self.configint(b'web', b'maxchanges') |
|
138 | self.maxchanges = self.configint(b'web', b'maxchanges') | |
128 | self.stripecount = self.configint(b'web', b'stripes') |
|
139 | self.stripecount = self.configint(b'web', b'stripes') | |
129 | self.maxshortchanges = self.configint(b'web', b'maxshortchanges') |
|
140 | self.maxshortchanges = self.configint(b'web', b'maxshortchanges') |
General Comments 0
You need to be logged in to leave comments.
Login now