ydb-php-sdk icon indicating copy to clipboard operation
ydb-php-sdk copied to clipboard

bug: Wrong permissions for temp_dir

Open uh-zuh opened this issue 1 year ago • 0 comments

Bug Report

YDB PHP SDK version:

Commit on 2023-10-29: https://github.com/ydb-platform/ydb-php-sdk/commit/92647bd5dd78e03bef1a5e8e3cc04d8cc2ed360d 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: https://github.com/ydb-platform/ydb-php-sdk/blob/92647bd5dd78e03bef1a5e8e3cc04d8cc2ed360d/src/Iam.php#L351

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();

uh-zuh avatar Oct 29 '23 14:10 uh-zuh