Class SecurityConfig
java.lang.Object
ortus.boxlang.runtime.config.segments.SecurityConfig
- All Implemented Interfaces:
IConfigSegment
The SecurityConfig class is a configuration segment that is used to define the security settings for the BoxLang runtime.
-
Field Summary
FieldsModifier and TypeFieldDescriptionMaps of allowed BIFs so lookups get faster as we goFile extensions which are disallowed for file operations.Disallowed BIFs in the runtime Ex: "disallowedBifs": ["createObject", "systemExecute"]Disallowed Components in the runtime Ex: "disallowedComponents": [ "execute", "http" ]A list of disallowed imports for the runtime These are a list of regular expressions that are used to match against the import statements in the code Ex: "disallowedImports": ["java\\.lang\\.(ProcessBuilder|Reflect", "java\\.io\\.(File|FileWriter)"] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasStruct()
Returns the configuration as a structboolean
isBIFAllowed
(String name) This function takes in the name of a BIF to test if it is disallowed.boolean
isClassAllowed
(String name) This function takes in a fully qualified class name and tests if it is disallowed.boolean
isComponentAllowed
(String name) This function takes in the name of a Component to test if it is disallowed.boolean
isExtensionAllowed
(String extension) Determines whether a file extension is allowed or not.boolean
isFileOperationAllowed
(String file) Determines whether a file operation is allowed or not based on the file extension.Processes the configuration struct.
-
Field Details
-
disallowedImports
A list of disallowed imports for the runtime These are a list of regular expressions that are used to match against the import statements in the code Ex: "disallowedImports": ["java\\.lang\\.(ProcessBuilder|Reflect", "java\\.io\\.(File|FileWriter)"] -
disallowedBIFs
Disallowed BIFs in the runtime Ex: "disallowedBifs": ["createObject", "systemExecute"] -
disallowedComponents
Disallowed Components in the runtime Ex: "disallowedComponents": [ "execute", "http" ] -
allowedFileOperationExtensions
File extensions which are disallowed for file operations. The allowed array overrides any items in the disallow list. -
disallowedFileOperationExtensions
-
allowedBIFsLookup
Maps of allowed BIFs so lookups get faster as we go -
allowedComponentsLookup
-
allowedImportsLookup
-
-
Constructor Details
-
SecurityConfig
public SecurityConfig()Default empty constructor
-
-
Method Details
-
isBIFAllowed
This function takes in the name of a BIF to test if it is disallowed. The search is case-insensitive. If it's disallowed, it will throw a SecurityException, else it will return true -
isComponentAllowed
This function takes in the name of a Component to test if it is disallowed. The search is case-insensitive. If it's disallowed, it will throw a SecurityException, else it will return true -
isClassAllowed
This function takes in a fully qualified class name and tests if it is disallowed. The search is case-insensitive. If it's disallowed, it will throw a SecurityException, else it will return true -
isFileOperationAllowed
Determines whether a file operation is allowed or not based on the file extension.- Parameters:
file
-- Returns:
-
isExtensionAllowed
Determines whether a file extension is allowed or not.- Parameters:
extension
-- Returns:
-
process
Processes the configuration struct. Each segment is processed individually from the initial configuration struct.- Specified by:
process
in interfaceIConfigSegment
- Parameters:
config
- the configuration struct- Returns:
- the configuration
-
asStruct
Description copied from interface:IConfigSegment
Returns the configuration as a struct- Specified by:
asStruct
in interfaceIConfigSegment
- Returns:
- A struct representation of the configuration segment
-