Skip to content

Commit 1be0083

Browse files
committed
feat: finish reauth docs, enhance code.
Decided to keep name Reauth for now. admin_guide.txt: add reference mark to roundup admin help. Used for template command reference in upgrading.txt. customizing.txt: added worked example of adding a reauth auditor for address and password. Also links to OWASP recommendations. Added link to example code in design.doc on detectors. glossary.txt: reference using roundup-admin template command in def for tracker templates. pydoc.txt: Added methods for Client class. Added class and methods for (cgi) Action, LoginAction and ReauthAction. reference.txt Edited and restructured detector section. Added section on registering a detector and priority use/execution order. (reference to design doc was used before). Added/enhanced description of exception an auditor can raise (includes Reauth). Added section on Reauth implementation and use (Confirming the User). Also has paragraph on future ideas. upgrading.txt Stripped down the original section. Moved a lot to reference.txt. Referenced customizing example, mention installation of _generic.reauth.html and reference reference.txt. cgi/actions.py: fixed bad ReST that was breaking pydoc.txt processing changed doc on limitations of Reauth code. added docstring for Reauth::verifyPassword cgi/client.py: fix ReST for a method breaking pydoc.py processing cgi/templating.py: fix docstring on embed_form_fields templates/*/html/_generic.reauth.html disable spelling for password field add timing info to the javascript function that processes file data. reformat javascript IIFE templates/jinja2/html/_generic.reauth.html create a valid jinja2 template. Looks like my original jinja template got overwritten and committed. feature parity with the other reauth templates. test/test_liveserver.py add test case for Reauth workflow. Makefile add doc.
1 parent 7db4be6 commit 1be0083

File tree

16 files changed

+863
-373
lines changed

16 files changed

+863
-373
lines changed

doc/admin_guide.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1729,6 +1729,8 @@ IMAPS_OAUTH:
17291729
single: roundup-admin; man page reference
17301730
pair: roundup-admin; designator
17311731

1732+
.. _`roundup-admin templates`:
1733+
17321734
Using roundup-admin
17331735
===================
17341736

doc/customizing.txt

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,6 +1815,60 @@ Some simple javascript might help in the last step. If you have high volume
18151815
you could search for all currently-Pending users and do a bulk edit of all
18161816
their roles at once (again probably with some simple javascript help).
18171817

1818+
.. _sensitive_changes:
1819+
1820+
Confirming Users Making Sensitive Account Changes
1821+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1822+
1823+
Some changes to account data: user passwords or email addresses are
1824+
particularly sensitive. The `OWASP Authentication`_ recommendations
1825+
include asking for a re-authentication or confirmation step when making
1826+
these changes. This can be easily implemented using an auditor.
1827+
1828+
Create a file in your detectors directory with the following
1829+
contents::
1830+
1831+
from roundup.cgi.exceptions import Reauth
1832+
1833+
def confirmid(db, cl, nodeid, newvalues):
1834+
1835+
if hasattr(db, 'reauth_done'):
1836+
# the user has confirmed their identity
1837+
return
1838+
1839+
# if the password or email are changing, require id confirmation
1840+
if 'password' in newvalues:
1841+
raise Reauth('Add an optional message to the user')
1842+
1843+
if 'address' in newvalues:
1844+
raise Reauth('Add an optional message to the user')
1845+
1846+
def init(db):
1847+
db.user.audit('set', confirmid, priority=110)
1848+
1849+
If a change is made to any user's password or address fields, the user
1850+
making the change will be shown a page where they have to enter an
1851+
identity verifier (by default the invoking user's account password).
1852+
If the verifier is successfully verified it will set the
1853+
``reauth_done`` attribute on the db object and reprocess the change.
1854+
1855+
The default auditor priority is 100. This auditor is set to run
1856+
**after** most other auditors. This allows the user to correct any
1857+
failing information on the form before being asked to confirm their
1858+
identity. Once they confirm their identity the change is expected to
1859+
be committed without issue. See :ref:`Confirming the User` for
1860+
details on customizing the verification operation.
1861+
1862+
Also you could use an existing auditor and add::
1863+
1864+
if 'someproperty' in newvalues and not hasattr(db, 'reauth_done'):
1865+
raise Reauth('Need verification before changing someproperty')
1866+
1867+
at the end of the auditor (after all checks are done) to force user
1868+
verification. Just make sure you import Reauth at the top of the file.
1869+
1870+
.. _`OWASP Authentication`:
1871+
https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html#require-re-authentication-for-sensitive-features
18181872

18191873
Changes to the Web User Interface
18201874
---------------------------------
@@ -2436,6 +2490,10 @@ The `reference document`_ also has examples:
24362490
<reference.html#extending-the-configuration-file>`_.
24372491
* `Adding a new Permission <reference.html#adding-a-new-permission>`_
24382492

2493+
as does the design document:
2494+
2495+
* `detector examples <design.html#detector-example>`_
2496+
24392497
Examples on the Wiki
24402498
====================
24412499

doc/glossary.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ Roundup Glossary
9999
tracker with a particular look and feel, :term:`schema`,
100100
permissions model, and :term:`detectors`. Roundup ships with
101101
five templates and people on the net `have produced other
102-
templates`_
102+
templates`_. You can find the installed location of the
103+
standard Roundup templates using the :ref:`roundup-admin
104+
templates <roundup-admin templates>` command.
103105

104106

105107
tracker

doc/pydoc.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,32 @@ Client class
99
============
1010

1111
.. autoclass:: roundup.cgi.client::Client
12+
:members:
13+
14+
CGI Action class
15+
================
16+
17+
Action class and selected derived classes.
18+
19+
Action
20+
------
21+
.. autoclass:: roundup.cgi.actions::Action
22+
:members:
23+
24+
LoginAction
25+
------------
1226

27+
.. autoclass:: roundup.cgi.actions::LoginAction
28+
:members:
29+
30+
.. _`ReauthAction_pydoc`:
31+
32+
ReauthAction
33+
------------
34+
35+
.. autoclass:: roundup.cgi.actions::ReauthAction
36+
:members:
37+
1338
Templating Utils class
1439
======================
1540

0 commit comments

Comments
 (0)