Validate source and mount path.

This CL add validations of the source and mount path to ensure:
1. The source path is fully canonicalized before being checked by the
   CanMount() method of a mount manager.
2. The mount path must be an immediate child of the mount root
   directory of a mount manager.

BUG=chromium:351811
TEST=Tested the following:
1. Build and run unit tests.
2. Run the following tests:
   - platform_CrosDisksDBus
   - platform_CrosDisksFilesystem
   - platform_CrosDisksArchive
3. Verify that Files.app can mount an external USB drive.
4. Verify that Files.app can open a ZIP file from:
   - user's Downloads directory
   - an external USB drive
   - within another ZIP file
   - Drive

Change-Id: I7a880818a565820c6549a9b127292cad178b010b
Reviewed-on: https://chromium-review.googlesource.com/189715
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
7 files changed
tree: 224c1ed74a27478f81acfed493ff982956ef46bf
  1. .gitignore
  2. LICENSE
  3. OWNERS
  4. archive_manager.cc
  5. archive_manager.h
  6. archive_manager_unittest.cc
  7. avfsd-seccomp-amd64.policy
  8. avfsd-seccomp-arm.policy
  9. avfsd-seccomp-x86.policy
  10. cros-disks.conf
  11. cros-disks.gyp
  12. cros_disks_server.cc
  13. cros_disks_server.h
  14. daemon.cc
  15. daemon.h
  16. dbus_bindings/
  17. device_ejector.cc
  18. device_ejector.h
  19. device_event.cc
  20. device_event.h
  21. device_event_dispatcher_interface.h
  22. device_event_moderator.cc
  23. device_event_moderator.h
  24. device_event_moderator_unittest.cc
  25. device_event_queue.cc
  26. device_event_queue.h
  27. device_event_queue_unittest.cc
  28. device_event_source_interface.h
  29. disk.cc
  30. disk.h
  31. disk_manager.cc
  32. disk_manager.h
  33. disk_manager_unittest.cc
  34. disk_unittest.cc
  35. disks_testrunner.cc
  36. exfat_mounter.cc
  37. exfat_mounter.h
  38. external_mounter.cc
  39. external_mounter.h
  40. external_mounter_unittest.cc
  41. file_reader.cc
  42. file_reader.h
  43. file_reader_unittest.cc
  44. filesystem.cc
  45. filesystem.h
  46. format_manager.cc
  47. format_manager.h
  48. format_manager_observer_interface.h
  49. format_manager_unittest.cc
  50. fuse_mounter.cc
  51. fuse_mounter.h
  52. glib_process.cc
  53. glib_process.h
  54. glib_process_unittest.cc
  55. inherit-review-settings-ok
  56. main.cc
  57. metrics.cc
  58. metrics.h
  59. metrics_unittest.cc
  60. mount_info.cc
  61. mount_info.h
  62. mount_info_unittest.cc
  63. mount_manager.cc
  64. mount_manager.h
  65. mount_manager_unittest.cc
  66. mount_options.cc
  67. mount_options.h
  68. mount_options_unittest.cc
  69. mounter.cc
  70. mounter.h
  71. mounter_unittest.cc
  72. ntfs_mounter.cc
  73. ntfs_mounter.h
  74. org.chromium.CrosDisks.conf
  75. platform.cc
  76. platform.h
  77. platform_unittest.cc
  78. process.cc
  79. process.h
  80. process_unittest.cc
  81. sandboxed_process.cc
  82. sandboxed_process.h
  83. session_manager_observer_interface.h
  84. session_manager_proxy.cc
  85. session_manager_proxy.h
  86. system_mounter.cc
  87. system_mounter.h
  88. system_mounter_unittest.cc
  89. udev_device.cc
  90. udev_device.h
  91. udev_device_unittest.cc
  92. usb-device-info
  93. usb_device_info.cc
  94. usb_device_info.h
  95. usb_device_info_unittest.cc