# SWISH: no permission to call sandboxed assert

**URL:** <https://swi-prolog.discourse.group/t/swish-no-permission-to-call-sandboxed-assert/1890>\
**Category:** Help!\
**Tags:** swish\
**Created:** [February 20, 2020, 2:01pm UTC](https://swi-prolog.discourse.group/t/swish-no-permission-to-call-sandboxed-assert/1890 "2020-02-20T14:01:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michele](https://avatars.discourse-cdn.com/v4/letter/m/ed8c4c/32.png) [@Michele](https://swi-prolog.discourse.group/u/Michele)\
**Post date:** [February 20, 2020, 2:01pm UTC](https://swi-prolog.discourse.group/t/swish-no-permission-to-call-sandboxed-assert/1890/1 "2020-02-20T14:01:05Z")

</div>

Hi,  
i have a problem with the following code:

```prolog
q(_) :-
   assert( (newp(F,A) :- p(F,A))).

```

The neck `:-` into the assert gives the note: `neck outofsync`,  
moreover the assert doesn’t work and gives the error : `no permission to call sandboxed assert.`

How can i do?

thanks

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [February 20, 2020, 2:37pm UTC](https://swi-prolog.discourse.group/t/swish-no-permission-to-call-sandboxed-assert/1890/2 "2020-02-20T14:37:18Z")

</div>

The out-of-sync is a bug, but rather innocent. The reason it doesn’t work is this snipped from the sandboxing code:

```prolog
%! safe_assert(+Term) is semidet.
%
% True if assert(Term) is safe, which means it asserts in the
% current module. Cross-module asserts are considered unsafe. We
% only allow for adding facts. In theory, we could also allow for
% rules if we prove the safety of the body.

safe_assert(C) :- cyclic_term(C), !, fail.
safe_assert(X) :- var(X), !, fail.
safe_assert(_Head:-_Body) :- !, fail.
safe_assert(_:_) :- !, fail.
safe_assert(_).

```

---

<div class="post-metadata">

**Author:** ![Michele](https://avatars.discourse-cdn.com/v4/letter/m/ed8c4c/32.png) [@Michele](https://swi-prolog.discourse.group/u/Michele)\
**Post date:** [February 20, 2020, 2:50pm UTC](https://swi-prolog.discourse.group/t/swish-no-permission-to-call-sandboxed-assert/1890/3 "2020-02-20T14:50:34Z")

</div>

So can i assert a rule or i have just to change the code?

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [February 20, 2020, 2:54pm UTC](https://swi-prolog.discourse.group/t/swish-no-permission-to-call-sandboxed-assert/1890/4 "2020-02-20T14:54:00Z")

</div>

safe\_assert/1 on a rule fails. So no, you cannot assert rules in the anonymous web version. You can do so if you run SWI-Prolog locally or in a local SWISH instance after tweaking the configuration to disable the sandbox. Sorry …

---

<div class="post-metadata">

**Author:** ![Michele](https://avatars.discourse-cdn.com/v4/letter/m/ed8c4c/32.png) [@Michele](https://swi-prolog.discourse.group/u/Michele)\
**Post date:** [February 20, 2020, 2:54pm UTC](https://swi-prolog.discourse.group/t/swish-no-permission-to-call-sandboxed-assert/1890/5 "2020-02-20T14:54:38Z")

</div>

Thank you anyway

---

<div class="post-metadata">

**Author:** ![Michele](https://avatars.discourse-cdn.com/v4/letter/m/ed8c4c/32.png) [@Michele](https://swi-prolog.discourse.group/u/Michele)\
**Post date:** [February 20, 2020, 2:57pm UTC](https://swi-prolog.discourse.group/t/swish-no-permission-to-call-sandboxed-assert/1890/6 "2020-02-20T14:57:29Z")

</div>

How can i make a local SWISH version to assert a fact?

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [February 20, 2020, 3:23pm UTC](https://swi-prolog.discourse.group/t/swish-no-permission-to-call-sandboxed-assert/1890/7 "2020-02-20T15:23:42Z")

</div>

Either run it as _IDE_ on top of Prolog using the supplied `ide.pl` from the SWISH distro. Alternatively, set it up with the config file `auth_http_always.pl` which demands login and disables the sandbox. See README for SWISH.
