popa.bogdanp
2020-1-31 09:20:59

https://try-racket.defn.io I was playing around with sandboxes yesterday and made this.


popa.bogdanp
2020-1-31 09:21:28

popa.bogdanp
2020-1-31 09:24:23

Each sandbox (tied to a visitor session) runs a restricted (max 60s duration per eval, max 128mb, no network or file access) #lang racket 7.5. The application itself runs in a further-restricted Docker container.


samth
2020-1-31 16:01:07

Nice!


samth
2020-1-31 16:01:16

Is there an API?


popa.bogdanp
2020-1-31 17:42:41

~&gt; curl -H'Accept: application/json' -d'e=(* 1 2)' '<https://try-racket.defn.io/eval>' {"result":"2","duration":375.739990234375,"output":""} There is now!

Although this creates a new sandbox on every API request (assuming the session cookies aren’t retained and passed along with each API request), so hopefully folks won’t abuse it until I can add some IP rate limiting or at least make it expunge old sandboxes under memory pressure.


brentgordon146
2020-1-31 17:43:56

@brentgordon146 has joined the channel


soegaard2
2020-1-31 18:36:17

@popa.bogdanp Feature request: Special handling of pict structs (like http://pasterack.org\|pasterack.org).


samth
2020-1-31 18:37:00

If you returned a key that enabled using the same sandbox again that would be great for creating a slack/irc bot


popa.bogdanp
2020-1-31 18:44:20

@samth the _sid cookie that currently gets returned is effectively that. Subsequent requests with a Cookie: _sid=... value will reuse the same sandbox until it expires.

@soegaard2 I’ll give that a try.


popa.bogdanp
2020-1-31 19:18:06

@soegaard2 done!


soegaard2
2020-1-31 19:18:20

You are fast!


popa.bogdanp
2020-1-31 19:18:52

Hopefully I did it right. I’d never used pict before


soegaard2
2020-1-31 19:19:08

Yup. My standard-fish looks fine.


brentgordon146
2020-1-31 21:29:21

script i made to take a safebooru url download the pic and save the tags associated with as an extended attribute only woks on macos and linux