ydb-platform / ydb-platform/ydb-php-sdk
bug: Wrong permissions for temp_dir
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 39
- Forks
- 19
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 2
Description
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();
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/Iam.php around line 351 and reproduce the issue with an uncreated temp_dir such as /tmp/db/ using the configuration shown. Check the permissions of the created directory and the subsequent temporary-file write; done means the directory permits the SDK to create its files while matching the expected 0700 mode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100