ContentsIndex
Darcs.CommandsAux
Contents
File paths
Synopsis
check_paths :: Patchy p => [DarcsFlag] -> FL p -> IO ()
malicious_patches :: Patchy p => [Sealed2 p] -> [Sealed2 p]
has_malicious_path :: Patchy p => p -> Bool
malicious_paths :: Patchy p => p -> [String]
is_malicious_path :: String -> Bool
is_explicitly_relative :: String -> Bool
File paths
check_paths :: Patchy p => [DarcsFlag] -> FL p -> IO ()
A convenience function to call from all darcs command functions before applying any patches. It checks for malicious paths in patches, and prints an error message and fails if it finds one.
malicious_patches :: Patchy p => [Sealed2 p] -> [Sealed2 p]
Filter out patches that contains some malicious file path
has_malicious_path :: Patchy p => p -> Bool
malicious_paths :: Patchy p => p -> [String]
is_malicious_path :: String -> Bool

What is a malicious path?

A spoofed path is a malicious path.

1. Darcs only creates explicitly relative paths (beginning with "./"), so any not explicitly relative path is surely spoofed.

2. Darcs normalizes paths so they never contain "/../", so paths with "/../" are surely spoofed.

A path to a darcs repository's meta data can modify "trusted" patches or change safety defaults in that repository, so we check for paths containing "/_darcs/" which is the entry to darcs meta data.

To do?

  • How about get repositories?
  • Would it be worth adding a --semi-safe-paths option for allowing changes to certain preference files (_darcs/prefs/) in sub repositories'?
is_explicitly_relative :: String -> Bool
Produced by Haddock version 2.4.2