set_secure_flag, set_secure_modeset_secure_flag, set_secure_mode は
asir を web サーバ等で公開するために加えられた関数.
set_secure_flag で公開する関数を指定する.
secure_mode が 1 の場合は set_secure_flag で指定された
関数しか実行できない.
関数の実行途中では secure_mode が 0 となっているので,
任意の関数を実行できる.
またエラーの時等は, secure_mode は 1 に自動的に復帰する.
ただし def は実行できない.
公開する関数では, その処理中は任意の関数が実行できるので,
security に十分注意した実装をする必要がある.
set_secure_flag は, fname の secure flag を m
にする.
公開する命令は 1 に設定する.
secure_mode が 1 となり,
公開された関数しか実行できなくなる.
quit 等も実行できないので注意.
timer の引数として secure_flag を設定していない関数を
指定して実行してもエラーが表示されない.
このときは, ctrl("error_in_timer",1) を実行しておく.
[1194] set_secure_flag("print_input_form_",1);
1
[1195] set_secure_flag("fctr",1);
1
[220] set_secure_mode(1);
1
[1197] fctr((x-1)^3);
[[1,1],[x-1,3]]
[1198] fctr(shell("ls"));
evalf : shell not permitted
return to toplevel
ChangeLog
set_secure_flag, set_secure_mode は asir を
web サーバ等で公開するために加えられた関数.
sm1 の同様な関数 RestrictedMode で採用された方法を用いている.
つまり, set_secure_flag で公開する関数を指定する.
secure_mode が 1 の場合は set_secure_flag で指定された
関数しか実行できない.
v関数の実行途中では secure_mode が 0 となっているので,
任意の関数を実行できる.
CGI_ASIR_ALLOW 環境変数で公開するコマンドを指定する.
Go to the first, previous, next, last section, table of contents.