Mercurial > p > roundup > code
diff roundup/cgi/templating.py @ 5232:462b0f76fce8
issue2550864 - Potential information leakage via journal/history
Fix this by making the hyperdb::Class::history function check for view
permissions on the journaled properties. So a user that sees [hidden]
for a property in the web interface doesn;t see the property changes
in the history.
While doing this, relocated the filter for quiet properties
from the templating class to the hyperdb.
Also added the skipquiet option to the history command in
roundup-admin.py to enable filtering of quiet params.
Also changed calls to history() in the backend databases to report all
items.
Changed inline documentation for all history calls that document the
actions. The create action (before nov 6 2002) used to record all
parameters. After that point the create call uses an empty dictionary.
The filtering code depends on the create dictionary being empty.
It may not operate properly on very old roundup databases.
Changed calls to logging.getLogger to roundup.hyperdb.backends to
allow filtering the back end while keeping hyperdb logging.
In cgi/templating.py, changed history() function consolidating
handiling of link and unlink actions
Added tests for quiet property filtering and permission filtering
of history.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Fri, 14 Apr 2017 23:24:18 -0400 |
| parents | 9bf221cebef3 |
| children | 198b6e810c67 |
line wrap: on
line diff
--- a/roundup/cgi/templating.py Tue Apr 11 22:20:13 2017 -0400 +++ b/roundup/cgi/templating.py Fri Apr 14 23:24:18 2017 -0400 @@ -973,7 +973,7 @@ classname, id, current[prop_n]) # get the journal, sort and reverse - history = self._klass.history(self._nodeid) + history = self._klass.history(self._nodeid, skipquiet=(not showall)) history.sort() history.reverse() @@ -987,22 +987,13 @@ for id, evt_date, user, action, args in history: date_s = str(evt_date.local(timezone)).replace("."," ") arg_s = '' - if action == 'link' and type(args) == type(()): + if action in ['link', 'unlink'] and type(args) == type(()): if len(args) == 3: linkcl, linkid, key = args arg_s += '<a rel="nofollow" href="%s%s">%s%s %s</a>'%(linkcl, linkid, linkcl, linkid, key) else: arg_s = str(args) - - elif action == 'unlink' and type(args) == type(()): - if len(args) == 3: - linkcl, linkid, key = args - arg_s += '<a rel="nofollow" href="%s%s">%s%s %s</a>'%(linkcl, linkid, - linkcl, linkid, key) - else: - arg_s = str(args) - elif type(args) == type({}): cell = [] for k in args.keys(): @@ -1041,10 +1032,7 @@ except NoTemplate: hrefable = 0 - if (not showall) and prop.quiet: - # Omit quiet properties from history/changelog - continue - elif isinstance(prop, hyperdb.Multilink) and args[k]: + if isinstance(prop, hyperdb.Multilink) and args[k]: ml = [] for linkid in args[k]: if isinstance(linkid, type(())):
