workflows: prevent action replay (#86577) #1095
Loading…
Reference in New Issue
No description provided.
Delete Branch "wip/86577-prevent-action-replay"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
7274e667cb
toc52a2c8fd2
c52a2c8fd2
to034d3f2354
034d3f2354
to08d85319f5
WIP: workflows: prevent action replay (#86577)to workflows: prevent action replay (#86577)@ -1692,0 +1702,4 @@
resp2 = resp.click(href='%s/' % number31.id)
resp3 = resp.click(href='%s/' % number31.id)
freezer.move_to(datetime.timedelta(seconds=10))
On se base sur le last_update_time pour détecter que le formdata a bougé et il est juste précis à la seconde, on avance donc dans le temps pour être sûr qu'une différente soit enregistrée.
@ -2349,6 +2353,7 @@ class SerieOfActionsMixin:
def get_action_form(self, filled, user, displayed_fields=None):
form = Form(enctype='multipart/form-data', use_tokens=False)
form.attrs['id'] = 'wf-actions'
form.add_hidden('_ts', str(time.mktime(filled.last_update_time)))
On pose le timestamp dans le formulaire.
@ -2395,2 +2400,4 @@
def handle_form(self, form, filled, user, evo):
if form.get('_ts') != str(time.mktime(filled.last_update_time)):
raise ReplayException()
Et quand le formulaire est envoyé, on vérifie que le timestamp correspond toujours.