Edgewall Software

Ticket #4084 (closed defect: duplicate)

Opened 2 years ago

Last modified 6 months ago

TracError: Missing or invalid form token. Do you have cookies enabled?

Reported by: anj Owned by: jonas
Priority: normal Milestone:
Component: general Version: devel
Severity: normal Keywords:
Cc:

Description (last modified by mgood) (diff)

How to Reproduce

While doing a POST operation on /admin, Trac issued an internal error.

{'cat_id': None,
 'description': u'My example project',
 'name': u'Arb-Silva',
 'page_id': None,
 'path_info': None,
 'url': u'http://mamba/trac/arb-silva/admin'}

System Information

Python 2.4.3 (#2, Oct 6 2006, 08:04:11)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)]
SQLite 2.8.17
pysqlite 1.0.1

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 405, in dispatch_request
    del req.chrome
AttributeError: chrome

Attachments

Change History

  Changed 2 years ago by jonas

Are these two different errors or do you get "AttributeError?: chrome" and "Missing or invalid form token" at the same time somehow?

follow-up: ↓ 3   Changed 2 years ago by cboos

  • milestone set to 0.11

I believe this has been fixed already by r4114. anj, can you please upgrade and confirm?

in reply to: ↑ 2 ; follow-up: ↓ 4   Changed 2 years ago by eblot

Replying to cboos:

I believe this has been fixed already by r4114. anj, can you please upgrade and confirm?

Which release is active on t.e.o.?: I just received the same error while commenting on a ticket.
Note that the internal error has not been raised in the "Preview" rendering, but on the final change submission.

in reply to: ↑ 3   Changed 2 years ago by markus

Replying to eblot:

Which release is active on t.e.o.?

According to About Trac it's milestone:0.10.1.

  Changed 2 years ago by mgood

  • description modified (diff)

This also could've been caused by using a plugin on Trac 0.11dev that uses ClearSilver templates. In r4210 I merged the form token changes for ClearSilver into the trunk, so that should now be fixed.

anj: can you verify that this is fixed for you?

  Changed 2 years ago by anonymous

I got the same error using Trac from debian's backports and running trac with fcgi. I only target this error when I try to attach a file in a ticket.

  Changed 14 months ago by anonymous

Same thing here, using the suse package trac-0.10.4-4.1 on apache-fcgi.

This appears when attaching to a ticket or to a wiki page, cookies enabled.

  Changed 11 months ago by bpedro <pedro605@…>

Hi! I got the same problem with one of my own developed plugins. I did a bit of debugging and it seemed that the problem was with the request itself. In some cases, the req.args.get('__FORM_TOKEN') in trac/web/main.py (dispatch) returns with a list of the same tokens.

I did a quick workaround:

if ctype:
   ctype, options = cgi.parse_header(ctype)
# !diff!
token = req.args.get('__FORM_TOKEN')
from types import ListType
if isinstance(token, ListType):
   token = token[0]
if ctype in ('application/x-www-form-urlencoded',
             'multipart/form-data'):
   if token:
      if token != unicode(req.form_token):
         raise HTTPBadRequest('Missing or invalid form token. '
                              'Do you have cookies enabled?')

It worked for me, at least for my plugin :)

  Changed 6 months ago by jonas

  • status changed from new to closed
  • resolution set to duplicate

A duplicate of #5637 which is now fixed.

  Changed 6 months ago by jonas

  • milestone 0.11.2 deleted

Add/Change #4084 (TracError: Missing or invalid form token. Do you have cookies enabled?)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from jonas. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.