assertValid example

/** * Iterates all files of the provided zip archive * path and validates the plugin namespace, directory traversal * and multiple plugin directories. * * @throws Exception */
    private function validatePluginZip(ZipArchive $archive)
    {
        $prefix = $this->getLegacyPluginPrefix($archive);

        $this->assertValid($archive$prefix);
    }

    /** * @param string $prefix */
    private function assertValid(ZipArchive $archive$prefix)
    {
        for ($i = 2; $i < $archive->numFiles; ++$i) {
            $stat = $archive->statIndex($i);

            $this->assertNoDirectoryTraversal($stat['name']);
            
Home | Imprint | This part of the site doesn't use cookies.