forked from elijaa/phpmemcachedadmin
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the "key" validation for the MemcacheD commands, to prevent inj…
…ections.
- Loading branch information
1 parent
9d91d16
commit 0da3c16
Showing
4 changed files
with
72 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace App\Library\Command; | ||
|
||
use Exception; | ||
|
||
abstract class AbstractMemcached | ||
{ | ||
/** | ||
* @throws Exception | ||
*/ | ||
protected function validateKey(string $key) | ||
{ | ||
if (!preg_match('/^[^\x00-\x1F\x7F\s]{1,250}$/', $key)) { | ||
throw new Exception( | ||
'Key must be a string up to 250 symbols long, and not containing control and whitespace characters.' | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters