Skip to content

BSL188 — File system access

Summary

File system access

Identifiers

Field Value
Rule code BSL188
Compatible alias FileSystemAccess
Severity WARNING
Enabled by default Yes
Implemented Yes
Tags security, compatibility

Behavior

  • The public identifier BSL188 and alias FileSystemAccess are stable.
  • The rule reports the cases documented on this page.
  • Suppressions and project configuration are applied before publication.
  • The rule requires neither an external analyzer nor network access.

Configuration and suppression

BSL### is the primary stable identifier. The compatible alias is accepted in select, ignore, and compatible block suppression comments.

[tool.onec-hbk-bsl]
select = ["BSL188"]
ignore = ["FileSystemAccess"]

All three suppression families support both a current line and a range. When an opening comment follows code, it affects only that line. Use any one form:

  • noqa:
Value = "example";  // noqa: BSL188
  • bsl-disable:
Value = "example";  // bsl-disable: BSL188
  • compatible BSLLS form:
Value = "example";  // BSLLS:FileSystemAccess-off

When the same opening comment is on a line by itself, it starts a range. Close it with the matching marker from the same family:

// noqa: BSL188
// code without this diagnostic
// noqa-enable: BSL188

// bsl-disable: BSL188
// code without this diagnostic
// bsl-enable: BSL188

// BSLLS:FileSystemAccess-off
// code without this diagnostic
// BSLLS:FileSystemAccess-on

To disable the rule until the end of the file, omit the closing noqa-enable, bsl-enable, or BSLLS:…-on marker.

Opening and closing markers must belong to the same family.

Description

It is important to review your code. Be sure to pay attention to accessing the file system and using “external code”

The found sections of the code must be analyzed, a manual audit of the code must be performed for its correctness and safety.

Examples

    Текст = Новый ЧтениеТекста(ПутьФайла, КодировкаТекста.ANSI); // есть замечание
    Текст = Новый ЗаписьТекста(ПутьФайла, КодировкаТекста.ANSI); // есть замечание

    ЗначениеВФайл(ПутьФайла, ЛичныеДанные); // есть замечание
    КопироватьФайл(ПутьФайла, ДругойПутьФайла); // есть замечание

    МассивИмен = Новый Массив();
    МассивИмен.Добавить(ПутьФайла);
    ОбъединитьФайлы(МассивИмен, ДругойПутьФайла); // есть замечание

    ПереместитьФайл(ПутьФайла, ДругойПутьФайла); // есть замечание
    РазделитьФайл(ПутьФайла, 1024 * 1024 ); // есть замечание
    СоздатьКаталог(ИмяКаталога); // есть замечание
    УдалитьФайлы(ПутьФайла); // есть замечание

Sources