ScriptStack 1.0.5
Loading...
Searching...
No Matches
InterpreterOptions.cs
Go to the documentation of this file.
1using System;
2
4{
5 public enum ClrInteropMode
6 {
8 Safe = 1,
9 Full = 2
10 }
11
17 public sealed class InterpreterOptions
18 {
19 public ClrInteropMode Clr { get; set; } = ClrInteropMode.Disabled;
20
24 public IClrPolicy? ClrPolicy { get; set; }
25
26 internal IClrPolicy ResolveClrPolicy()
27 {
28 if (ClrPolicy != null)
29 return ClrPolicy;
30
31 return Clr switch
32 {
35 _ => new DenyAllClrPolicy(),
36 };
37 }
38 }
39}
Allows all CLR interop. Use only for trusted scripts.
Denies all CLR interop. Default Policy!
Options for the ScriptStack interpreter.
IClrPolicy? ClrPolicy
Optional custom CLR policy. If set, it overrides the default policy of the selected ClrInteropMode.
A conservative "safe" policy: allows access only to a small set of generally harmless BCL types and m...
Policy hook for CLR interop. Implementations decide what is accessible from scripts.
Definition IClrPolicy.cs:10