Simon Willison on Nostr: Here's a surprisingly difficult question: I'm looking for an implementation of a ...
Here's a surprisingly difficult question: I'm looking for an implementation of a simple expression language in Python that can do bits of arithmetic and basic string operations (eg concatenetion) against some variables I pass to it... but is safe against untrusted input - and operates with limits on CPU and memory usage
I'm not looking for a full sandboxed Python (though that would be nice) - I just want to be able to do "a + b * c" with untrusted input
Any good options I might have missed?
Published at
2023-11-23 19:08:38Event JSON
{
"id": "e36e987be3a43fbd4fd26a487f58ac4edd3150771f6265a8ce8ac5411b1aa555",
"pubkey": "8b0be93ed69c30e9a68159fd384fd8308ce4bbf16c39e840e0803dcb6c08720e",
"created_at": 1700766518,
"kind": 1,
"tags": [
[
"proxy",
"https://fedi.simonwillison.net/users/simon/statuses/111461434573782088",
"activitypub"
]
],
"content": "Here's a surprisingly difficult question: I'm looking for an implementation of a simple expression language in Python that can do bits of arithmetic and basic string operations (eg concatenetion) against some variables I pass to it... but is safe against untrusted input - and operates with limits on CPU and memory usage\n\nI'm not looking for a full sandboxed Python (though that would be nice) - I just want to be able to do \"a + b * c\" with untrusted input\n\nAny good options I might have missed?",
"sig": "2ffb523d8e2fd71431dd8cc5241b1c8b71fc1822b888f7d879db08086bf26be439472d383ee97a75499f1bd1d44f3c95c70c5350a95bde366ba849566f4a6d11"
}