Mercurial > p > roundup > code
comparison doc/xmlrpc.txt @ 5220:14d8f61e6ef2
Reimplemented anti-csrf measures by raising exceptions rather than
returning booleans.
Redoing it using exceptions was the easiest way to return proper
xmlrpc fault messages to the clients.
Also this code should now properly make values set in the form
override values from the database. So no lost work under some
circumstances if the csrf requirements are not met.
Also this code does a better job of cleaning up old csrf tokens.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Wed, 05 Apr 2017 20:56:08 -0400 |
| parents | ade4bbc2716d |
| children | 198b6e810c67 |
comparison
equal
deleted
inserted
replaced
| 5219:ade4bbc2716d | 5220:14d8f61e6ef2 |
|---|---|
| 138 [] | 138 [] |
| 139 >>> roundup_server.lookup('user','admin') | 139 >>> roundup_server.lookup('user','admin') |
| 140 '1' | 140 '1' |
| 141 | 141 |
| 142 The one below adds Referer and X-Requested-With headers so it can pass | 142 The one below adds Referer and X-Requested-With headers so it can pass |
| 143 stronger CSRF detection methods. Note if you are using http rather | 143 stronger CSRF detection methods. It also generates a fault message |
| 144 than https, replace xmlrpclib.SafeTransport with xmlrpclib.Transport:: | 144 from the server and reports it. Note if you are using http rather than |
| 145 https, replace xmlrpclib.SafeTransport with xmlrpclib.Transport:: | |
| 145 | 146 |
| 146 import xmlrpclib | 147 import xmlrpclib |
| 147 | 148 |
| 148 class SpecialTransport(xmlrpclib.SafeTransport): | 149 class SpecialTransport(xmlrpclib.SafeTransport): |
| 149 | 150 |
| 167 | 168 |
| 168 print roundup_server.schema() | 169 print roundup_server.schema() |
| 169 print roundup_server.display('user2', 'username') | 170 print roundup_server.display('user2', 'username') |
| 170 print roundup_server.display('issue1', 'status') | 171 print roundup_server.display('issue1', 'status') |
| 171 print roundup_server.filter('user',['1','2','3'],{'username':'demo'}) | 172 print roundup_server.filter('user',['1','2','3'],{'username':'demo'}) |
| 173 | |
| 174 # this will fail with a fault | |
| 175 try: | |
| 176 print roundup_server.filter('usr',['0','2','3'],{'username':'demo'}) | |
| 177 except Exception, msg: | |
| 178 print msg |
