fix(adb): reject unsafe host file names when pulling one device file (#1962)
pull_adb_file derived its host file name from the last path segment of a caller-supplied device path and joined it to the output directory without checking that the name is usable on the host. A device path ending in a separator, a dot segment, a control character, a Windows reserved device name, a trailing dot or space, or a ':' alternate-data-stream marker could resolve to an unexpected host path or fail opaquely after the transfer. The single-file path now derives the name with POSIX semantics and refuses any non-portable segment as invalid_request before creating a directory or running adb pull. This matches the package path's pending host-name policy and never renames a device-reported file. Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
@@ -108,7 +108,13 @@ existing analysis families directly, for example
|
||||
`ro.kernel.qemu` value, `null` when absent.
|
||||
- **Device paths are not host paths.** `base_apk_device_path` values live on
|
||||
the device filesystem. Only pulls and captures produce host-local paths,
|
||||
each paired with byte size and SHA-256 digest.
|
||||
each paired with byte size and SHA-256 digest. A pulled file's host name is
|
||||
the device path's last segment, accepted only when every host can store it:
|
||||
a `pull_adb_file` whose device path ends in a separator, `.`/`..`, a
|
||||
control or reserved character, a Windows reserved device name, a trailing
|
||||
dot or space, or a `:` alternate-data-stream marker is refused as
|
||||
`invalid_request` before any `adb pull` runs, and REA never renames a
|
||||
device-reported file.
|
||||
- **Splits are part of the answer.** `pm path` enumerates the base APK and
|
||||
every installed split; pulls cover the whole set. System packages whose
|
||||
APKs keep other names report the `unknown` role rather than guessing.
|
||||
|
||||
Reference in New Issue
Block a user