-
Notifications
You must be signed in to change notification settings - Fork 701
schemeshard: add notion and protection of system path names #19620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
schemeshard: add notion and protection of system path names #19620
Conversation
4f116a1
to
cc87125
Compare
🟢 |
cc87125
to
022912e
Compare
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Add protection against creating or renaming paths with system-reserved names under a new feature flag, propagate the user token to leaf-name validation in create operations, and update alter operations and persistence to accommodate the new ACL and naming logic.
- Propagate
context.UserToken.Get()
to allIsValidLeafName
calls in create and copy operations - Remove leaf-name, depth, paths, children and ACL checks from alter operations and adjust persistence signatures
- Introduce
EnableSystemNamesProtection
feature flag, update ticket parser domain constants, and refresh tests
Reviewed Changes
Copilot reviewed 60 out of 60 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
ydb/core/tx/schemeshard/schemeshard__operation_create_bsv.cpp | Pass UserToken to leaf-name validation |
ydb/core/tx/schemeshard/schemeshard__operation_create_backup_collection.cpp | Pass UserToken to leaf-name validation |
ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp | Pass UserToken to leaf-name validation |
ydb/core/tx/schemeshard/schemeshard__operation_copy_sequence.cpp | Pass UserToken to leaf-name validation |
ydb/core/tx/schemeshard/schemeshard__operation_common_resource_pool.h | Rename parameter acll → acl |
ydb/core/tx/schemeshard/schemeshard__operation_blob_depot.cpp | Pass UserToken to leaf-name validation |
ydb/core/tx/schemeshard/schemeshard__operation_alter_resource_pool.cpp | Remove leaf-name & ACL checks in alter; adjust PersistResourcePool |
ydb/core/tx/schemeshard/schemeshard__operation_alter_external_table.cpp | Remove leaf-name & ACL checks in alter; strip ACL from persistence |
ydb/core/tx/schemeshard/schemeshard__operation_alter_external_data_source.cpp | Remove leaf-name & ACL checks in alter; strip ACL from persistence |
ydb/core/tx/schemeshard/schemeshard__operation.cpp | Update CreateDirs signature, comment out outdated name checks |
ydb/core/tx/schemeshard/schemeshard__op_traits.h | Add operation classification declarations |
ydb/core/tx/schemeshard/schemeshard__op_traits.cpp | Implement operation classification functions |
ydb/core/tx/schemeshard/olap/operations/create_table.cpp | Pass UserToken to leaf-name validation |
ydb/core/tx/schemeshard/olap/operations/create_store.cpp | Pass UserToken to leaf-name validation |
ydb/core/testlib/basics/feature_flags.h | Add EnableSystemNamesProtection flag setter |
ydb/core/protos/feature_flags.proto | Add EnableSystemNamesProtection field to proto |
ydb/core/security/ticket_parser_impl.h | Update system-domain token parsing to use AUTH_DOMAIN_SYSTEM |
ydb/core/kqp/workload_service/ut/kqp_workload_service_actors_ut.cpp | Update test default userSID to use AUTH_DOMAIN_SYSTEM |
ydb/core/kqp/workload_service/ut/common/kqp_workload_service_ut_common.h | Update test default UserSID to use AUTH_DOMAIN_SYSTEM |
ydb/core/kqp/workload_service/ut/common/kqp_workload_service_ut_common.cpp | Refresh tests for new system-domain constant |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
e277df0
to
0748c6d
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
0748c6d
to
3df7a7d
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
3df7a7d
to
d871d82
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
d871d82
to
929e480
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Упавший тест |
929e480
to
e53ff46
Compare
This comment was marked as outdated.
This comment was marked as outdated.
4e3562c
to
bc10ca3
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
2438b8a
to
3d7e19c
Compare
⚪ Test history | Ya make output | Test bloat
🟢
*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation |
⚪ Test history | Ya make output | Test bloat
⚪ Test history | Ya make output | Test bloat | Test bloat
⚪ Test history | Ya make output | Test bloat | Test bloat | Test bloat
🟢
*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation |
For external-data-source, external-table, resource-pool. Current alters for those object check validity of the name, schema limits and rights. It makes no sense for an alter to do those checks as altering object is already exist and alter can't change rights. Apparently, those check were brought from create ops that do require those checks.
7d3edf5
to
75354df
Compare
⚪ Test history | Ya make output | Test bloat
🟢
*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation |
⚪ Test history | Ya make output | Test bloat
⚪ Test history | Ya make output | Test bloat | Test bloat
🟢
*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation |
@@ -868,10 +860,6 @@ bool CreateDirs(const TTxTransaction& tx, const TPath& parentPath, TPath path, T | |||
.NotResolved(); | |||
} | |||
|
|||
if (checks) { | |||
checks.IsValidLeafName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Что-то я не понял, почему это можно убирать?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Да, это важный момент.
Проверка здесь происходит раньше любой проверки в самих операциях, но и дублирует их. Операции создаваемые имена проверяют (а тесты проверяют, что они проверяют), и дублирующая проверка оказывается не необходимой.
Кроме того, общая проверка не может учитывать послабления, необходимые в отдельных случаях: например, при move таблицы её внутренние объекты должны уметь перемещаться, даже если их имена оказались зарезервированными -- и т.п.
Либо решение о допустимости имени принимает операция/код, который точно знает что происходит, либо эти особые условия нужно абстрагировать и доносить до уровня CreateDirs()
. Если второе сделать, то проверку имени можно будет убрать наоборот из самих операций (снова чтобы не было двойных проверок).
Однако пока легче не делать дополнительную проверку на уровне CreateDirs()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если MkDir умеет в AbortPropose, тогда, наверно, можно эту дублирующую проверку убирать. Только нужно убедиться, что есть тест, создающий объект с невалидным именем и промежуточными директориями.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если MkDir умеет в AbortPropose
Да, умеет.
что есть тест, создающий объект с невалидным именем и промежуточными директориями
Да, такие тесты делаются -- ut_system_names/ut_system_names.cpp#L862 и ниже.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kqp ok
New feature flag
enable_system_names_protection
prohibits users from creating paths with names reserved for current or future system use.YDB exclusively reserves names like
.sys
,.metadata
,.tmp
,.backups
etc. and any names starting with prefixes.
and__ydb
for its own use.More details, reasoning and behavior in:
Also introduces safeguards against carelessly using reserved names in future code.
Special tests verify that:
The latter is designed to protect well-meaning developers from careless actions.
YDB developers must obtain explicit consent from the project committee to add new names to the reserved list.