Can I execute untrusted Common Lisp code in a restricted environment?

Suppose I wanted to take advantage of the ability of Common Lisp to read and execute Common Lisp code so that my program could execute external code written in Lisp, but I do not believe this code, you want it to have access to the full power of Common Lisp. Can I limit his environment so that he can only see packets / characters that I explicitly give him access to, effectively creating DSL?

+4
source share
2 answers

To read the code, start by turning off *read-eval*(which prevents people from entering execution during parsing, using something like #.(do-evil-stuff). You probably want to do the reading using a custom reading table that disables most (if not all) read-macros. Probably you want to do the reading with a custom disposable package, importing only those characters that you allow.

, , , /. , , : " " ( , ) " " ( ).

, .

, , , , - .

+2

" " 4 "Let over lambda" , . , , , *read-eval* nil. , Common Lisp, . , Let over lambda ( ). , .

+2

Source: https://habr.com/ru/post/1569388/


All Articles