• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item7386: Sanitize regular expressions

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Extension SpreadSheetPlugin Normal No Action Required   n/a  

Edit Form Data

Reported By:
Applies To:
Current State:
Waiting For:
Target Release:
Released In:


The SpreadSheetPlugin currently has 4 functions that accept regular expression parameters: $FILTER(), $SEARCH(), $SPLIT(), $SUBSTITUTE().

I tried to abuse the regex with the relatively new code execution feature (?{perl code}), but did not succeed. In any case, it is better to play safe and sanitize the regular expression string before applying it.

-- TWiki:Main/PeterThoeny - 2013-11-19

Only those functions that use eval for regex need to be sanitized.

-- TWiki:Main.PeterThoeny - 2013-11-20

I am closing this with "no action required" based on http://stackoverflow.com/questions/4289923/in-which-languages-is-it-a-security-hole-to-use-user-supplied-regular-expression - you cannot execute code callbacks in Perl by sneaking them in an evaluated regex. This is forbidden. You have to specifically override that with a lexically scoped use re "eval";

-- TWiki:Main.PeterThoeny - 2014-10-04

Summary Sanitize regular expressions
ReportedBy TWiki:Main.PeterThoeny
Codebase ~twiki4, 6.0.0
SVN Range TWiki-6.0.0, Mon, 14 Oct 2013, build 26523
AppliesTo Extension
Component SpreadSheetPlugin
Priority Normal
CurrentState No Action Required


TargetRelease n/a

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r3 - 2014-10-04 - PeterThoeny
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback