Mercurial > p > roundup > code
annotate doc/implementation.txt @ 8411:ef1ea918b07a reauth-confirm_id
feat(security): Add user confirmation/reauth for sensitive changes
Auditors can raise Reauth(reason) exception to require the user to
enter a token (e.g. account password) to verify the user is performing
the change.
Naming is subject to change.
actions.py: New ReauthAction class handler and verifyPassword() method
for overriding if needed.
client.py: Handle Reauth exception by calling Client:reauth() method.
Default client:reauth method. Add 'reauth' action declaration.
exceptions.py: Define and document Reauth exception as a subclass of
RoundupCGIException.
templating.py: Define method utils.embed_form_fields().
The original form making a change to the database has a lot of form
fields. These need to be resubmitted to Roundup as part of the form
submission that verifies the user's password.
This method turns all non file form fields into type=hidden inputs.
It escapes the names and values to prevent XSS.
For file form fields, it base64 encodes the contents and puts them
in hidden pre blocks. The pre blocks have data attributes for the
filename, filetype and the original field name. (Note the original
field name is not used.)
This stops the file content data (maybe binary e.g. jpegs) from
breaking the html page. The reauth template runs JavaScript that
turns the encoded data inside the pre tags back into a file. Then
it adds a multiple file input control to the page and attaches all
the files to it. This file input is submitted with the rest of the
fields.
_generic.reauth.html (multiple tracker templates): Generates a form
with id=reauth_form to:
display any message from the Reauth exception to the user (e.g. why
user is asked to auth).
get the user's password
submit the form
embed all the form data that triggered the reauth
recreate any file data that was submitted as part of the form and
generate a new file input to push the data to the back end
It has the JavaScript routine (as an IIFE) that regenerates a file
input without user intervention.
All the TAL based tracker templates use the same form. There is also
one for the jinja2 template. The JavaScript for both is the same.
reference.txt: document embed_form_fields utility method.
upgrading.txt: initial upgrading docs.
TODO:
Finalize naming. I am leaning toward ConfirmID rather than Reauth.
Still looking for a standard name for this workflow.
Externalize the javascript in _generic.reauth.html to a seperate file
and use utils.readfile() to embed it or change the script to load it
from a @@file url.
Clean up upgrading.txt with just steps to implement and less feature
detail/internals.
Document internals/troubleshooting in reference.txt.
Add tests using live server.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Mon, 11 Aug 2025 14:01:12 -0400 |
| parents | 81a634b7226e |
| children |
| rev | line source |
|---|---|
|
7048
6f5054751fb6
Update meta description. Also fix test command in code.txt.
John Rouillard <rouilj@ieee.org>
parents:
6905
diff
changeset
|
1 .. meta:: |
|
6f5054751fb6
Update meta description. Also fix test command in code.txt.
John Rouillard <rouilj@ieee.org>
parents:
6905
diff
changeset
|
2 :description: |
|
6f5054751fb6
Update meta description. Also fix test command in code.txt.
John Rouillard <rouilj@ieee.org>
parents:
6905
diff
changeset
|
3 Additional implementation notes for the Roundup Issue Tracker. |
|
7286
81a634b7226e
Update description metadata
John Rouillard <rouilj@ieee.org>
parents:
7048
diff
changeset
|
4 Supplement for docstrings in the Roundup package. |
|
7048
6f5054751fb6
Update meta description. Also fix test command in code.txt.
John Rouillard <rouilj@ieee.org>
parents:
6905
diff
changeset
|
5 |
|
688
b38f4f95bffd
More doc tweaks
Richard Jones <richard@users.sourceforge.net>
parents:
686
diff
changeset
|
6 ==================== |
|
111
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
7 Implementation notes |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
8 ==================== |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
9 |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
10 [see also the roundup package docstring] |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
11 |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
12 There have been some modifications to the spec. I've marked these in the |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
13 source with 'XXX' comments when I remember to. |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
14 |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
15 In short: |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
16 Class.find() - may match multiple properties, uses keyword args. |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
17 |
|
1661
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
18 Class.filter() - isn't in the spec and it's very useful to have at the |
|
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
19 Class level. |
|
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
20 |
|
111
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
21 CGI interface index view specifier layout part - lose the '+' from the |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
22 sorting arguments (it's a reserved URL character ;). Just made no |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
23 prefix mean ascending and '-' prefix descending. |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
24 |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
25 ItemClass - renamed to IssueClass to better match it only having one |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
26 hypderdb class "issue". Allowing > 1 hyperdb class breaks the |
|
1661
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
27 "superseder" multilink (since it can only link to one thing, and |
|
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
28 we'd want bugs to link to support and vice-versa). |
|
111
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
29 |
|
1661
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
30 template - the call="link()" is handled by special-case mechanisms in |
|
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
31 my top-level CGI handler. In a nutshell, the handler looks for a |
|
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
32 method on itself called 'index%s' or 'item%s' where %s is a class. |
|
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
33 Most items pass on to the templating mechanism, but the file class |
|
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
34 _always_ does downloading. It'll probably stay this way too... |
|
111
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
35 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
907
diff
changeset
|
36 template - call="link(property)" may be used to link "the current item" |
|
111
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
37 (from an index) - the link text is the property specified. |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
38 |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
39 template - added functions that I found very useful: List, History and |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
40 Submit. |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
41 |
|
1661
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
42 template - items must specify the message lists, history, etc. Having |
|
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
43 them by default was sometimes not wanted. |
|
111
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
44 |
|
1661
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
45 template - index view determines its default columns from the |
|
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
46 template's ``tal:condition="request/show/<property>"`` directives. |
|
111
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
47 |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
48 template - menu() and field() look awfully similar now .... ;) |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
49 |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
688
diff
changeset
|
50 roundup_admin.py - the command-line tool has a lot more commands at its |
|
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
688
diff
changeset
|
51 disposal |
|
111
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
52 |
|
686
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
111
diff
changeset
|
53 ----------------- |
|
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
111
diff
changeset
|
54 |
|
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
111
diff
changeset
|
55 Back to `Table of Contents`_ |
|
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
111
diff
changeset
|
56 |
|
6905
9ca128103a3a
fix broken links to doc table of contents
John Rouillard <rouilj@ieee.org>
parents:
4557
diff
changeset
|
57 .. _`Table of Contents`: ../docs.html |
|
686
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
111
diff
changeset
|
58 |
