Code Monkey home page Code Monkey logo

Comments (3)

lubieowoce avatar lubieowoce commented on June 18, 2024

also this trick can be used to construct a list that contains itself:

>>> [x for x in ([None],) for x[0] in (x,)]
[[[...]]]

repr() is smart enough to handle the infinite-ness, but it can probably still be used to crash something:

>>> [x for x in ([None],) for x[0] in (x,)] == [x for x in ([None],) for x[0] in (x,)]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RecursionError: maximum recursion depth exceeded in comparison

from simpleeval.

danthedeckie avatar danthedeckie commented on June 18, 2024

That's... fun - definitely something to handle better than that!

I'm not tooooo worried about it, it's a bug, in that it throws a non-SimpleEval exception, but I don't believe there are any security implications.

Although, it would be good to add to the documentation that users should probably wrap any public facing usage of SimpleEval in a try:catch and log errors themselves...?

from simpleeval.

lubieowoce avatar lubieowoce commented on June 18, 2024

Hah, wow, that's an old one! I haven't done Python in a couple years so thanks for the reminder, this was a fun hack. I'm not sure if exploitability is a big worry here... i guess this circularity construction could maaaaaaybe be used as a DoS vector somehow. But i don't currently have ideas for how that'd work.

from simpleeval.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.