Tags:
create new tag
, view all tags

Feature Proposals » Detect obvious recursion in preferences variables and prevent

Summary

Current State: Developer: Reason: Date: Concerns By: Bug Tracking: Proposed For:
AcceptedProposal HideyoImazu AcceptedByReleaseMeeting 2014-10-02   TWikibug:Item7569 KampalaRelease

Edit Form

TopicSummary:
CurrentState:
CommittedDeveloper:
ReasonForDecision:
DateOfCommitment:   Format: YYYY-MM-DD
ConcernRaisedBy:
BugTracking:
OutstandingIssues:
RelatedTopics:
InterestedParties:
ProposedFor:
TWikiContributors:
 

Motivation

A preferences variable may refer to itself by accident as follows, which causes a loop.

   * Set FOO = %FOO% bar
In many cases, this is not so harmful. It causes a loop detected by TWiki and the loop is stopped.

However, if the preferences variable contains %INCLUDE{...}% as follows, it has a magnifying effect.

   * Set FOO = %FOO% %INCLUDE{"http://server/path"}%
Specifically, http://server/path ends up being access 16 times or so per %FOO% on the page.

This should not be the end of the world. But what if a heavy database query is magnified by multiple references of %FOO% on the page?

This may cause a very heavy load to an external resource.

Description and Documentation

There is no comprehensive way to detect and avoid recursion. But an obvious ones like mentioned above can be easily detected and avoided.

It's a matter of enhancing TWiki::Prefs::PrefsCache::insert() as follows. When a self-reference is detected, it will be escaped by inserting <nop> between % and the variable name.

Examples

The following line will end up setting "%<nop>FOO% bar" rather than "%FOO% bar" to FOO.

   * Set FOO = %FOO% bar

Impact

Implementation

-- Contributors: Hideyo Imazu - 2014-10-02

Discussion

Sensible, no-brainer fix.

-- Peter Thoeny - 2014-10-02

Accepted by release meeting at KampalaReleaseMeeting2014x10x02

-- Peter Thoeny - 2014-10-04

Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2014-10-07 - HideyoImazu
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.