Skip to content

Unsafe SafeMode method call (UnsafeSafeModeMethodCall)

Type Scope Severity Activated
by default
Minutes
to fix
Tags
Error BSL Blocker Yes 1 deprecated
error

Description

In "1C: Enterprise 8.3" the global context method SafeMode() returns the type String, if safe mode was set with the name of the security profile.

Using the SafeMode() method, in which the result is implicitly converted to a Boolean type is unsafe, must be corrected for the code with an explicit comparison of the result with the value False. Thus, with the installed security profile, the code will be executed in the same way as in the safe mode.

Examples

Incorrect:

If SafeMode() Then
     // some logic in safe mode...
EndIf;

If No SafeMode() Then
     // some logic in unsafe mode...
EndIf;

Correct:

If SafeMode() <> False Then
   // some code
EndIf;
EndIf

Sources

Snippets

Diagnostic ignorance in code

// BSLLS:UnsafeSafeModeMethodCall-off
// BSLLS:UnsafeSafeModeMethodCall-on

Parameter for config

"UnsafeSafeModeMethodCall": false