Commit deb522a
authored
Fix Projector Plugin vulnerability (#7115)
## Summary
Fixes an arbitrary file read issue in the TensorBoard Projector plugin
by restricting asset paths to the directory that contains
`projector_config.pbtxt`.
Previously, user-controlled fields such as `metadata_path`,
`tensor_path`, `bookmarks_path`, and `sprite.image_path` could resolve
to absolute paths or traversal paths outside the intended logdir/config
directory. That allowed a malicious config to make TensorBoard read and
return arbitrary local files from the host.
## What Changed
- Hardened projector asset path resolution to:
- expand and normalize candidate paths
- resolve them against the directory containing `projector_config.pbtxt`
- reject any path that escapes that directory boundary
- Returned a clean `400` response when a requested asset path is invalid
- Applied this validation consistently across:
- metadata loading
- tensor loading
- bookmarks loading
- sprite image loading
- Updated config augmentation logic to safely skip invalid external
tensor paths instead of trying to read them
## Security Impact
This closes a path traversal / arbitrary local file read vector in the
Projector plugin for deployments where an attacker can write or
influence `projector_config.pbtxt` contents under a scanned logdir.
## Tests
Added projector integration coverage for:
- `metadata_path` using traversal outside the logdir
- `tensor_path` using an absolute path outside the logdir
- `bookmarks_path` using an absolute path outside the logdir
- `sprite.image_path` using traversal outside the logdir
## Validation
Verified:
- `python -m py_compile
tensorboard/plugins/projector/projector_plugin.py
tensorboard/plugins/projector/projector_plugin_test.py`
- `bazel test //tensorboard/plugins/projector:projector_plugin_test`
- Full build and test suite
## Risk / Compatibility
Low risk for valid configurations.
This change may reject projector configs that previously referenced
assets outside the config directory, but that behavior is now considered
unsafe and is intentionally blocked.1 parent 2331d66 commit deb522a
2 files changed
Lines changed: 181 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
217 | 230 | | |
218 | 231 | | |
219 | 232 | | |
| |||
363 | 376 | | |
364 | 377 | | |
365 | 378 | | |
366 | | - | |
367 | | - | |
368 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
369 | 391 | | |
370 | 392 | | |
371 | 393 | | |
| |||
594 | 616 | | |
595 | 617 | | |
596 | 618 | | |
597 | | - | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
598 | 623 | | |
599 | 624 | | |
600 | 625 | | |
| |||
651 | 676 | | |
652 | 677 | | |
653 | 678 | | |
654 | | - | |
655 | | - | |
656 | | - | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
657 | 685 | | |
658 | 686 | | |
659 | 687 | | |
| |||
720 | 748 | | |
721 | 749 | | |
722 | 750 | | |
723 | | - | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
724 | 755 | | |
725 | 756 | | |
726 | 757 | | |
| |||
766 | 797 | | |
767 | 798 | | |
768 | 799 | | |
769 | | - | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
770 | 804 | | |
771 | 805 | | |
772 | 806 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
59 | 63 | | |
60 | 64 | | |
61 | 65 | | |
| |||
197 | 201 | | |
198 | 202 | | |
199 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
200 | 291 | | |
201 | 292 | | |
202 | 293 | | |
| |||
213 | 304 | | |
214 | 305 | | |
215 | 306 | | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
216 | 311 | | |
217 | 312 | | |
218 | 313 | | |
| |||
336 | 431 | | |
337 | 432 | | |
338 | 433 | | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
339 | 472 | | |
340 | 473 | | |
341 | 474 | | |
| |||
0 commit comments