Shopify / Shopify/liquid

How to prevent denial of service caused by endless loop?

Open
#1,563 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

Description

I have noticed that there is no upper limits on iterations which makes it easy for someone to brick an app by launching an infinite loop:

Liquid::Template.parse("{% for n in (1..100000) %}{% endfor %}").render

Is there a configuration to prevent this?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported Liquid::Template.parse(...).render example and inspect the rendering and configuration entry points that govern loop execution. Done should include a defined way to prevent unbounded iteration and a clear behavior for templates exceeding the limit.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
performance, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.