Skip to content

BSL185 — External applications starting

Summary

External applications starting

Identifiers

Field Value
Rule code BSL185
Compatible alias ExternalAppStarting
Severity WARNING
Enabled by default Yes
Implemented Yes
Tags security

Behavior

  • The public identifier BSL185 and alias ExternalAppStarting 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 = ["BSL185"]
ignore = ["ExternalAppStarting"]

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: BSL185
  • bsl-disable:
Value = "example";  // bsl-disable: BSL185
  • compatible BSLLS form:
Value = "example";  // BSLLS:ExternalAppStarting-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: BSL185
// code without this diagnostic
// noqa-enable: BSL185

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

// BSLLS:ExternalAppStarting-off
// code without this diagnostic
// BSLLS:ExternalAppStarting-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

To improve the quality and security of 1C solutions, it is necessary to control the launch of external applications from 1C code.

This rule applies to all methods of launching external programs, including: - System - RunSystem - RunApp - BeginRunningApplication - RunAppAsync - GotoURL or FileSystems.OpenURL - FileSystemsClient.RunApp (for client side) and FileSystems.RunApp (for server side) - FileSystemClient.OpenExplorer - FileSystemClient.OpenFile

Examples

Процедура Метод()
    СтрокаКоманды = "";
    ТекущийКаталог = "";
    ДождатьсяЗавершения = Истина;
    ОписаниеОповещения = Неопределено;
    ПараметрыКоманды = Новый Структура;

    КомандаСистемы(СтрокаКоманды, ТекущийКаталог); // есть замечание
    ЗапуститьПриложение(СтрокаКоманды, ТекущийКаталог); // есть замечание
    ЗапуститьПриложение(СтрокаКоманды, ТекущийКаталог, Истина); // есть замечание

    НачатьЗапускПриложения(ОписаниеОповещения, СтрокаКоманды, ТекущийКаталог, ДождатьсяЗавершения); // есть замечание

    ПерейтиПоНавигационнойСсылке(СтрокаКоманды); // есть замечание
    ФайловаяСистемаКлиент.ОткрытьНавигационнуюСсылку(СтрокаКоманды); // есть замечание
    ФайловаяСистемаКлиент.ОткрытьНавигационнуюСсылку(СтрокаКоманды, ОписаниеОповещения); // есть замечание

    ФайловаяСистемаКлиент.ЗапуститьПрограмму("ping 127.0.0.1 -n 5", ПараметрыКоманды); // есть замечание
    ФайловаяСистемаКлиент.ЗапуститьПрограмму(СтрокаКоманды, ПараметрыКоманды); // есть замечание
    ФайловаяСистема.ЗапуститьПрограмму(СтрокаКоманды); // есть замечание
    ФайловаяСистема.ЗапуститьПрограмму(СтрокаКоманды, ПараметрыКоманды); // есть замечание

    ФайловаяСистемаКлиент.ОткрытьПроводник("C:\Users"); // есть замечание
    ФайловаяСистемаКлиент.ОткрытьФайл(СтрокаКоманды); // есть замечание
    ФайловаяСистемаКлиент.ОткрытьФайл(СтрокаКоманды, ОписаниеОповещения); // есть замечание

КонецПроцедуры

&НаКлиенте
Асинх Процедура Подключить()
    СтрокаКоманды = "";
    ТекущийКаталог = "";
    ДождатьсяЗавершения = Истина;

    Ждать ЗапуститьПриложениеАсинх(СтрокаКоманды, ТекущийКаталог, ДождатьсяЗавершения); // есть замечание
КонецПроцедуры

&НаКлиенте
Процедура ПроверкаЗапуститьСистему(ДополнительныеПараметрыКоманднойСтроки, КодВозврата)
    ДождатьсяЗавершения = Истина;

    ЗапуститьСистему(); // есть замечание
    ЗапуститьСистему(ДополнительныеПараметрыКоманднойСтроки); // есть замечание
    ЗапуститьСистему(ДополнительныеПараметрыКоманднойСтроки, ДождатьсяЗавершения); // есть замечание
    ЗапуститьСистему(ДополнительныеПараметрыКоманднойСтроки, ДождатьсяЗавершения, КодВозврата); // есть замечание
КонецПроцедуры

Sources