Skip to content

Commit

Permalink
Some code added to protect from directory traversal attack.
Browse files Browse the repository at this point in the history
  • Loading branch information
sukohi committed Apr 8, 2015
1 parent e459d05 commit d22337d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ Usage
'surpass' => $surpass
]);


*Note: method dir('dir_name') can no longer receive "/" and "." to protect from directory traversal attack.

**Upload (in View)**

Expand Down
2 changes: 1 addition & 1 deletion src/Sukohi/Surpass/Surpass.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function path($path) {

public function dir($dir) {

$this->_dir = $dir;
$this->_dir = str_replace(["\0", '/', '.'], '', $dir);
$this->_id_hidden_name = self::ID_HIDDEN_NAME .'_'. $dir;
return $this;

Expand Down

0 comments on commit d22337d

Please # to comment.