{{ message }}
Repository navigation
Commit c0cdc8c
Merged PR 2081022: NameSpace Validation for config db
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
NameSpace Validation for config and admin db
----
#### AI description (iteration 1)
#### PR Classification
New feature: Adds namespace validation to restrict operations on reserved system databases (`config` and `admin`), with a feature flag to control index creation permissions.
#### PR Summary
This PR introduces namespace validation to prevent users from creating, dropping, or modifying reserved collections in system databases (`config` and `admin`), with configurable controls for index creation. The implementation includes comprehensive test coverage and is controlled by feature flags for gradual rollout.
- **`/oss/pg_documentdb/src/metadata/collection.c`**: Added `ValidateSystemNamespace()` function to restrict operations on reserved collection names (e.g., `chunks`, `shards`, `version`) in the `config` database
- **`/oss/pg_documentdb/src/commands/`**: Integrated validation checks in `create_collection_core.c`, `drop_collection.c`, and `create_collection_view.c` to enforce namespace restrictions
- **`/gateway/managed/Mongo.Service.Postgres/`**: Added `EnableIndexCreationConfigDB` configuration flag in `PostgresTenantConfiguration.cs` and updated `PostgresMongoClient.cs` to conditionally allow index creation on system databases
- **`/oss/pg_documentdb/src/configs/feature_flag_configs.c`**: Introduced `enableNewNamespaceValidation` feature flag with default value `false` for controlled rollout
- **Test files**: Added comprehensive integration tests in `CreateIndexSystemDbTests.cs` and regression tests in `commands_admin_config_db_validation.sql` to validate both restricted and allowed operations
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
Signed-off-by: Parag Jain <paragjain@microsoft.com>1 parent aa6a5da commit c0cdc8c
9 files changed
Lines changed: 585 additions & 4 deletions
File tree
- pg_documentdb_gw/documentdb_gateway_core/src
- configuration
- processor
- pg_documentdb/src
- commands
- configs
- metadata
- test/regress
- expected
- sql
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
139 | 141 | | |
140 | 142 | | |
141 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
142 | 150 | | |
143 | 151 | | |
144 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
449 | 449 | | |
450 | 450 | | |
451 | 451 | | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
452 | 457 | | |
453 | 458 | | |
454 | 459 | | |
| |||
1187 | 1192 | | |
1188 | 1193 | | |
1189 | 1194 | | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
1190 | 1203 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
| |||
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
| 144 | + | |
143 | 145 | | |
144 | 146 | | |
145 | 147 | | |
| |||
1334 | 1336 | | |
1335 | 1337 | | |
1336 | 1338 | | |
| 1339 | + | |
1337 | 1340 | | |
1338 | 1341 | | |
1339 | 1342 | | |
1340 | 1343 | | |
1341 | 1344 | | |
1342 | | - | |
1343 | 1345 | | |
1344 | 1346 | | |
1345 | 1347 | | |
| |||
1361 | 1363 | | |
1362 | 1364 | | |
1363 | 1365 | | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
1364 | 1410 | | |
1365 | 1411 | | |
1366 | 1412 | | |
| |||

0 commit comments