Sandbox restriction error with html//1

I’m trying to use html//1 in a sandboxed call (swipl 8.2.4), but I’m getting sandbox restriction error (Could not derive which predicate may be called from html_write:html_expand(A,B,C,D)).

The simplest example is where my http server does safe_term(Goal) where Goal is:

html(p(hello),H,[]), with_output_to(string(S), print_html(H))

I tried declaring sandbox:safe_meta_predicate(html_write:html_expand/4). in the server, but that didn’t seem to change anything.

Any suggestions on how to get around this issue?

cheers,

RdR

Why would you do that? The HTML infrastructure is not easily compatible with sandboxing as it heavily relies on meta-calling. It can be done as you can see on this SWISH page: SWISH -- SWI-Prolog for SHaring

I don’t recall the details. I think it both relies on the devel series of SWI-Prolog and code in SWISH.

I’m actually trying to exclude html//1 from the safe_term/1 expansion, but safe_meta_predicate/1 seems to do something different than I expected in this regard. I thought it would “skip” over any such declared predicate, but it doesn’t seem to work that way (or I’m not doing it right, somehow).

But thanks for the pointer – I’ll have a look at the SWISH code to see how they did it there.