ydb-platform/ydb-php-sdk

bug: Wrong permissions for temp_dir

uh-zuh opened this issue · 0 comments

Bug Report

YDB PHP SDK version:

Commit on 2023-10-29: 92647bd
or v1.12.0: https://github.com/ydb-platform/ydb-php-sdk/releases/tag/v1.12.0

Environment

PHP 8.2.11
Debian 12.2
https://hub.docker.com/layers/library/php/8.2.11-apache/images/sha256-ea110a6b764ad7fcfef9ca644afd3af3968f54a1fb4a5de54e4a2750200355bf?context=explore

Current behavior:

First query creates temp directory for ydb-iam files with wrong permissions and after that it can't create file with following error:

file_put_contents(/tmp/db/apache2handler/ydb-iam-1dee583f3df30314e855015450666eac.json-tmp3dd1f59b24a7fb588572): Failed to open stream: Permission denied on .../vendor/yandex-cloud/ydb-php-sdk/src/Iam.php:418

See code here:

mkdir($temp_dir, 0600, true);

Expected behavior:

It's needed to create directory with "x" permission, 0700 insted of 0600.

Steps to reproduce:

Specify unexistend directory for temp_dir in config:

$config = [
  ...
  'iam_config' => [
    'temp_dir' => '/tmp/db/',
    ..
  ]
];
\YdbPlatform\Ydb\Ydb($config);
...
$ydb_session->executeQuery();