Commit ccabc9e
committed
fix: Escape metadata values in DirectoryMetadata.__createMetaSelection
__createMetaSelection interpolated user-supplied metadata operands
directly into the SQL selection string (e.g. "{table}Value='{operand}'"),
and the callers (__findSubdirByMeta, __checkDirsForMetadata) execute the
resulting query with no bound args, so a crafted metadata query value was
live SQL -> injection via findDirectoriesByMetadata.
Escape every string operand through the DB _escapeString/_escapeValues
helpers (which quote and escape the value) before inlining it, mirroring
the FileMetadata.__createMetaSelection sibling which already does this.
Numeric operands keep their existing safe %d/%f handling.
This defect predates the SQL-parameterisation series.1 parent 61b8579 commit ccabc9e
1 file changed
Lines changed: 28 additions & 7 deletions
File tree
- src/DIRAC/DataManagementSystem/DB/FileCatalogComponents/DirectoryMetadata
Lines changed: 28 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
513 | 513 | | |
514 | 514 | | |
515 | 515 | | |
516 | | - | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
517 | 520 | | |
518 | 521 | | |
519 | | - | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
520 | 526 | | |
521 | 527 | | |
522 | | - | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
523 | 532 | | |
524 | 533 | | |
525 | | - | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
526 | 538 | | |
527 | 539 | | |
528 | | - | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
529 | 544 | | |
530 | 545 | | |
531 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
532 | 550 | | |
533 | 551 | | |
534 | 552 | | |
535 | 553 | | |
536 | 554 | | |
537 | | - | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
538 | 559 | | |
539 | 560 | | |
540 | 561 | | |
| |||
0 commit comments