[PATCH] hgweb, config: make search restrictions configurable with web.restrictsearch
Alexander Plavin
alexander at plav.in
Wed Sep 11 11:52:33 CDT 2013
# HG changeset patch
# User Alexander Plavin <alexander at plav.in>
# Date 1378459856 -14400
# Fri Sep 06 13:30:56 2013 +0400
# Node ID ab7d6890e62500ad220ba733db2af7edf055c5f4
# Parent 763804a97b788beaad3c9edb05634e068dc17529
hgweb, config: make search restrictions configurable with web.restrictsearch
Add boolean config option to allow disabling all search restrictions.
diff -r 763804a97b78 -r ab7d6890e625 mercurial/help/config.txt
--- a/mercurial/help/config.txt Fri Sep 06 13:30:56 2013 +0400
+++ b/mercurial/help/config.txt Fri Sep 06 13:30:56 2013 +0400
@@ -1461,6 +1461,10 @@
Whether to require that inbound pushes be transported over SSL to
prevent password sniffing. Default is True.
+``restrictsearch``
+ Whether to restrict usage of regular expressions and
+ heavyweight revset functions in search. Default is True.
+
``staticurl``
Base URL to use for static files. If unset, static files (e.g. the
hgicon.png favicon) will be served by the CGI script itself. Use
diff -r 763804a97b78 -r ab7d6890e625 mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py Fri Sep 06 13:30:56 2013 +0400
+++ b/mercurial/hgweb/webcommands.py Fri Sep 06 13:30:56 2013 +0400
@@ -177,13 +177,14 @@
# no revset syntax used
return MODE_KEYWORD, query
- if util.any((token, (value or '')[:3]) == ('string', 're:')
- for token, value, pos in revset.tokenize(revdef)):
- return MODE_KEYWORD, query
+ if web.configbool('web', 'restrictsearch', True):
+ if util.any((token, (value or '')[:3]) == ('string', 're:')
+ for token, value, pos in revset.tokenize(revdef)):
+ return MODE_KEYWORD, query
- funcsused = revset.funcsused(tree)
- if not funcsused.issubset(revset.safesymbols):
- return MODE_KEYWORD, query
+ funcsused = revset.funcsused(tree)
+ if not funcsused.issubset(revset.safesymbols):
+ return MODE_KEYWORD, query
mfunc = revset.match(web.repo.ui, revdef)
try:
More information about the Mercurial-devel
mailing list