Skip to content

Commit

Permalink
ncp-web: sanitize the ref parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Jun 4, 2018
1 parent 3c462f6 commit 05c14ce
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ncp-web/ncp-launcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@

else if ( $_POST['action'] == "launch" && $_POST['config'] )
{
// sanity checks
if ( !$_POST['ref'] ) exit( '{ "output": "Invalid request" }' );

preg_match( '/^[a-z-]+$/' , $_POST['ref'] , $matches )
or exit( '{ "output": "Invalid input" , "token": "' . getCSRFToken() . '" }' );

// CSRF check
$token = isset($_POST['csrf_token']) ? $_POST['csrf_token'] : '';
if ( empty($token) || !validateCSRFToken($token) )
Expand Down

0 comments on commit 05c14ce

Please sign in to comment.