Comments (4)
Thanks! That's great!
I've blacklisted the 'mro' method for now (man, I'm learning a lot about Python through this project), and also added in a proper exception for the lambda crash.
The current git HEAD does actually have list comprehension support added to the EvalWithCompoundTypes
class, but with an explicit limit on how many recursions it will do.
Could you poke around with that and see if you can find a way to by-pass it, and if so, raise a new issue?
from simpleeval.
Huh - now that's a weird one.
Good catch.
Please continue digging for problems!
from simpleeval.
I found one more potential vulnerability – non-whitelisted classes can be accessed through SomeClass.mro()
, you might want to block that. Other than that, blacklisting lambdas, __dunder__
methods/attributes and list comprehensions¹ seems very effective, I couldn't come up with any hacks without those.
¹ list comprehensions can be used to bind names: [... for x in (foo(),)]
≈ let x = foo() in ...
. One could use that to create a self-referencing object and call something on it to get a crash via infinite recursion. As an example, this expression yields a list that contains itself: [(x.append(x), x)[-1] for x in ([],)][0]
≈ let x = [] in (x.append(x); x)
from simpleeval.
Okay, I'll check it out! (pun partially intended)
from simpleeval.
Related Issues (20)
- Setuptools 58 breaks install HOT 1
- Possible to return function object rather than evaluate? HOT 2
- Possible to generate RPN from AST. HOT 1
- Low performance HOT 9
- We need to revisit performance limits
- We should switch to explicitly giving permission for methods / data access HOT 2
- while shortcode seems endless loop HOT 1
- Add a timeout for statements
- intercept evaluation of simpleeval and add if conditions
- MAX_STRING_LENGTH used on objects which do not increase size, creating false positives
- Allow to-bytes conversion? HOT 1
- Support implied multiply HOT 2
- Release plan HOT 6
- Possible to define my own operators HOT 1
- Problem when building using simpleeval HOT 4
- Operator with arguments?? HOT 1
- Failing install with latest setuptools (fails due to `use_2to3` no longer supported) HOT 19
- simpleeval raises NameNotDefined exception when KeyError exception occured using callable names resolver HOT 4
- Any plans for a new release? HOT 1
- how do i set limits HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simpleeval.