Title: [291924] branches/safari-613-branch/Source/WebKit
- Revision
- 291924
- Author
- [email protected]
- Date
- 2022-03-25 18:51:57 -0700 (Fri, 25 Mar 2022)
Log Message
Cherry-pick r291057. rdar://problem/89291566
File System Access: disallows names that are not permitted by underlying file system
https://bugs.webkit.org/show_bug.cgi?id=237635
rdar://89291566
We use FileSystem::fileSystemRepresentation to convert input name to a name that is permitted in current file
system. This patch makes File System Access API to throw error if the input name does not match the converted
name.
Reviewed by Youenn Fablet.
* NetworkProcess/storage/FileSystemStorageHandle.cpp:
(WebKit::isValidFileName):
(WebKit::FileSystemStorageHandle::requestCreateHandle):
(WebKit::FileSystemStorageHandle::removeEntry):
(WebKit::FileSystemStorageHandle::move):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291057 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-613-branch/Source/WebKit/ChangeLog (291923 => 291924)
--- branches/safari-613-branch/Source/WebKit/ChangeLog 2022-03-26 01:51:54 UTC (rev 291923)
+++ branches/safari-613-branch/Source/WebKit/ChangeLog 2022-03-26 01:51:57 UTC (rev 291924)
@@ -1,5 +1,45 @@
2022-03-23 Alan Coon <[email protected]>
+ Cherry-pick r291057. rdar://problem/89291566
+
+ File System Access: disallows names that are not permitted by underlying file system
+ https://bugs.webkit.org/show_bug.cgi?id=237635
+ rdar://89291566
+
+ We use FileSystem::fileSystemRepresentation to convert input name to a name that is permitted in current file
+ system. This patch makes File System Access API to throw error if the input name does not match the converted
+ name.
+
+ Reviewed by Youenn Fablet.
+
+ * NetworkProcess/storage/FileSystemStorageHandle.cpp:
+ (WebKit::isValidFileName):
+ (WebKit::FileSystemStorageHandle::requestCreateHandle):
+ (WebKit::FileSystemStorageHandle::removeEntry):
+ (WebKit::FileSystemStorageHandle::move):
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291057 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2022-03-09 Sihui Liu <[email protected]>
+
+ File System Access: disallows names that are not permitted by underlying file system
+ https://bugs.webkit.org/show_bug.cgi?id=237635
+ rdar://89291566
+
+ We use FileSystem::fileSystemRepresentation to convert input name to a name that is permitted in current file
+ system. This patch makes File System Access API to throw error if the input name does not match the converted
+ name.
+
+ Reviewed by Youenn Fablet.
+
+ * NetworkProcess/storage/FileSystemStorageHandle.cpp:
+ (WebKit::isValidFileName):
+ (WebKit::FileSystemStorageHandle::requestCreateHandle):
+ (WebKit::FileSystemStorageHandle::removeEntry):
+ (WebKit::FileSystemStorageHandle::move):
+
+2022-03-23 Alan Coon <[email protected]>
+
Cherry-pick r290985. rdar://problem/78421282
Add a preference to mute video capture in case audio capture gets interrupted
Modified: branches/safari-613-branch/Source/WebKit/NetworkProcess/storage/FileSystemStorageHandle.cpp (291923 => 291924)
--- branches/safari-613-branch/Source/WebKit/NetworkProcess/storage/FileSystemStorageHandle.cpp 2022-03-26 01:51:54 UTC (rev 291923)
+++ branches/safari-613-branch/Source/WebKit/NetworkProcess/storage/FileSystemStorageHandle.cpp 2022-03-26 01:51:57 UTC (rev 291924)
@@ -82,9 +82,13 @@
return m_path == path;
}
-static bool isValidFileName(const String& name)
+static bool isValidFileName(const String& directory, const String& name)
{
- return name != "." && name != ".." && !name.contains(pathSeparator);
+ // https://wicg.github.io/file-system-access/#valid-file-name
+ if (name.isEmpty() || (name == ".") || (name == "..") || name.contains(pathSeparator))
+ return false;
+
+ return FileSystem::pathFileName(FileSystem::pathByAppendingComponent(directory, name)) == name;
}
Expected<WebCore::FileSystemHandleIdentifier, FileSystemStorageError> FileSystemStorageHandle::requestCreateHandle(IPC::Connection::UniqueID connection, Type type, String&& name, bool createIfNecessary)
@@ -95,8 +99,7 @@
if (!m_manager)
return makeUnexpected(FileSystemStorageError::Unknown);
- // https://wicg.github.io/file-system-access/#valid-file-name
- if (!isValidFileName(name))
+ if (!isValidFileName(m_path, name))
return makeUnexpected(FileSystemStorageError::InvalidName);
auto path = FileSystem::pathByAppendingComponent(m_path, name);
@@ -118,7 +121,7 @@
if (m_type != Type::Directory)
return FileSystemStorageError::TypeMismatch;
- if (!isValidFileName(name))
+ if (!isValidFileName(m_path, name))
return FileSystemStorageError::InvalidName;
auto path = FileSystem::pathByAppendingComponent(m_path, name);
@@ -239,7 +242,7 @@
if (path.isEmpty())
return FileSystemStorageError::Unknown;
- if (!isValidFileName(newName))
+ if (!isValidFileName(path, newName))
return FileSystemStorageError::InvalidName;
auto destinationPath = FileSystem::pathByAppendingComponent(path, newName);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes