Opened 3 years ago

Last modified 3 months ago

#11799 new enhancement

Log messages when permission checks fail rather than traceback

Reported by: rjollos Owned by: osimons
Priority: normal Component: XmlRpcPlugin
Severity: normal Keywords:
Cc: olemis Trac Release:

Description (last modified by rjollos)

Looking in the log files I see many entries like the following:

2014-05-28 12:13:22,695 Trac[web_ui] ERROR: RPC(XML-RPC) Error
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/tracrpc/", line 149, in _rpc_process
    req.perm.require('XML_RPC') # Need at least XML_RPC
  File "/usr/local/python26_trac10/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/", line 579, in require
    raise PermissionError(action, resource, self.env)

Web requests on the other hand are trapped and logged:

2014-05-28 17:01:26,569 Trac[main] WARNING: [] HTTPForbidden: 403 Forbidden (WIKI_VIEW privileges are required to perform this operation on WikiStart. You don't have the required permissions.)

I'm wondering if we could trap and log XmlRpc requests as warnings. I haven't done more than look at the code yet, but I could probably propose a patch.

See also #12408.

Attachments (0)

Change History (4)

comment:1 Changed 17 months ago by rjollos

  • Description modified (diff)

comment:2 Changed 3 months ago by jun66j5

Proposed changes in

After the patch:

06:33:44 AM Trac[web_ui] WARNING: RPC(JSON-RPC) [] PermissionError: XML_RPC privileges are required to perform this operation. You don't have the required permissions.
06:34:39 AM Trac[web_ui] ERROR: RPC(JSON-RPC) [] Exception caught while calling ticket.get(*[u'a']) by admin
Traceback (most recent call last):
  File "/src/xmlrpcplugin.git/tracrpc/", line 158, in _rpc_process
    result = (XMLRPCSystem(self.env).get_method(method_name)(req, args))[0]
  File "/src/xmlrpcplugin.git/tracrpc/", line 197, in __call__
    result = self.callable(req, *args)
  File "/src/xmlrpcplugin.git/tracrpc/", line 154, in get
    t = model.Ticket(self.env, id)
  File "/venv/trac/py27/1.0.13/local/lib/python2.7/site-packages/trac/ticket/", line 69, in __init__
    tkt_id = int(tkt_id)
ValueError: invalid literal for int() with base 10: 'a'
Last edited 3 months ago by jun66j5 (previous) (diff)

comment:3 Changed 3 months ago by rjollos

The changes look nice. Okay to merge?

comment:4 Changed 3 months ago by jun66j5

Fine by me. Could you please review patch in comment:14:ticket:12408?

Add Comment

Modify Ticket

as new The owner will remain osimons.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.