Opened 15 years ago
Closed 15 years ago
#5760 closed defect (worksforme)
CustomFieldAdminPlugin should validate input parameters
Reported by: | Emmanuel Blot | Owned by: | osimons |
---|---|---|---|
Priority: | highest | Component: | CustomFieldAdminPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.11 |
Description
The plugin does not check for non-ASCII characters in the custom field values ("select box", at least)
It then updates the Trac configuration values with unsupported character and asks Trac to save the new configuration to the configuration file.
Trac does not handle such characters, and destroy the configuration file as an exception is raised while overwriting the existing configuration file.
I'll update this ticket with the trac related ticket when/if trac.edgewall.org comes back to life.
Attachments (0)
Change History (18)
comment:1 Changed 15 years ago by
comment:2 follow-up: 3 Changed 15 years ago by
comment:3 Changed 15 years ago by
Replying to osimons:
You are of course running latest 0.11 version of the plugin?
I'm running TracCustomFieldAdmin-0.2-py2.5.egg
, which seems to match (0.2) the version in the setup.py
file.
comment:4 Changed 15 years ago by
Wow, the setup.py
file has not been updated for 2 years, while the plugin code is 7 month old, so it's hard to tell which version I actually run.
comment:5 Changed 15 years ago by
I've bumped the version for you - and version should now also appear in 'About Trac'. See [6469].
Could you try verifying your version again?
comment:6 follow-up: 7 Changed 15 years ago by
[5161] produces UTF-8 encoded str
, and this seems to be fed into the Config API which expects unicode
objects (as nearly any other Trac API). This is quite wrong.
comment:7 follow-ups: 9 10 Changed 15 years ago by
Replying to cboos:
[5161] produces UTF-8 encoded
str
, and this seems to be fed into the Config API which expectsunicode
objects (as nearly any other Trac API). This is quite wrong.
Well, that is a matter for discussion as configuration has until a few changesets ago (in 0.11.6dev) not handled unicode well at all. Passing unicode would result in the mentioned error when config would write them to disk - if the unicode contained anything but plain ascii. I pass in utf-8, which gets saved, causing config to reload with unicode values. Remember custom fields also affects the options in the configs (keys), and not just their values.
comment:8 Changed 15 years ago by
Actually, I have other safety mechanisms in place as well to ensure that custom field names does not contain non-ascii characters... Hmm... Don't remember all the details anymore :-)
comment:9 follow-up: 11 Changed 15 years ago by
Replying to osimons:
Well, that is a matter for discussion as configuration has until a few changesets ago (in 0.11.6dev) not handled unicode well at all. Passing unicode would result in the mentioned error when config would write them to disk - if the unicode contained anything but plain ascii. I pass in utf-8, which gets saved, causing config to reload with unicode values. Remember custom fields also affects the options in the configs (keys), and not just their values.
AFAIR, it was decided a long time ago that all internal strings in Trac should be unicode only.
IMHO, the Configuration module should load and store trac.ini
file with UTF-8 encoding. I think there is an old ticket related with this topic: how to specify the encoding of trac.ini
file, I can't remember which one.
comment:10 follow-up: 14 Changed 15 years ago by
Replying to osimons:
Remember custom fields also affects the options in the configs (keys), and not just their values.
Ah yes, that's indeed a problem. But the fact that converting both keys and values to utf-8 just before saving the configuration has worked at all was just luck.
I understand that changing back to unicode wouldn't work with earlier 0.11 versions, but neither will the current code work with 0.11.6. That's a bit unfortunate, we should maybe have fixed #8162 for trunk only. Would it be possible to check for the Trac version?
comment:11 follow-up: 12 Changed 15 years ago by
Replying to eblot:
AFAIR, it was decided a long time ago that all internal strings in Trac should be unicode only.
... which doesn't mean that unicode
related bugs still surface from time to time. #T8162 was one of them.
IMHO, the Configuration module should load and store
trac.ini
file with UTF-8 encoding.
That's already what it does.
I think there is an old ticket related with this topic: how to specify the encoding of
trac.ini
file, I can't remember which one.
I don't remember having seen this.
comment:12 follow-up: 13 Changed 15 years ago by
Replying to cboos:
#T8162 was one of them.
Are you sure about this ticket ID?
IMHO, the Configuration module should load and store
trac.ini
file with UTF-8 encoding.That's already what it does.
Ok, I got confused.
I don't remember having seen this.
I'm unable to find the reference either, but I'm pretty sure it was left as an open question ;-)
comment:13 Changed 15 years ago by
comment:14 follow-ups: 15 16 Changed 15 years ago by
Replying to cboos:
I understand that changing back to unicode wouldn't work with earlier 0.11 versions, but neither will the current code work with 0.11.6. That's a bit unfortunate, we should maybe have fixed #8162 for trunk only. Would it be possible to check for the Trac version?
Not quite true - I'm running latest plugin (unchanged for a long time) with very latest 0.11.6dev. Ascii or non-ascii for values, and nothing like eblots problem is seen at my end. All works fine for me.
eblot, you are on latest plugin version now right? And you can reproduce the problem? Remember to backup configuration file... :-)
comment:15 Changed 15 years ago by
comment:16 Changed 15 years ago by
Replying to osimons:
Replying to cboos:
I understand that changing back to unicode wouldn't work with earlier 0.11 versions, but neither will the current code work with 0.11.6. That's a bit unfortunate, we should maybe have fixed #8162 for trunk only. Would it be possible to check for the Trac version?
Not quite true - I'm running latest plugin (unchanged for a long time) with very latest 0.11.6dev. Ascii or non-ascii for values, and nothing like eblots problem is seen at my end. All works fine for me.
Ok, that's probably because there are a bunch of to_unicode
calls in various places in config.py ;-)
Still, maybe the 0.12 version of the plugin could try to use unicode
only, then.
comment:17 Changed 15 years ago by
comment:18 Changed 15 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
See ticket:8623