8000 Sanitize user input in upgrade by ozh · Pull Request #3055 · YOURLS/YOURLS · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Sanitize user input in upgrade #3055

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions admin/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

// From what are we upgrading?
if ( isset( $_GET['oldver'] ) && isset( $_GET['oldsql'] ) ) {
$oldver = (string)( $_GET['oldver'] );
$oldsql = (string)( $_GET['oldsql'] );
$oldver = yourls_sanitize_version($_GET['oldver']);
$oldsql = (intval)($_GET['oldsql']);
} else {
list( $oldver, $oldsql ) = yourls_get_current_version_from_sql();
}
Expand Down
13 changes: 13 additions & 0 deletions includes/functions-upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@
*/
function yourls_upgrade( $step, $oldver, $newver, $oldsql, $newsql ) {

/**
* Sanitize input. Two notes :
* - they should already be sanitized in the caller, eg admin/upgrade.php
* (but hey, let's make sure)
* - some vars may not be used at the moment
* (and this is ok, they are here in case a future upgrade procedure needs them)
*/
$step = intval($step);
$oldsql = intval($oldsql);
$newsql = intval($newsql);
$oldver = yourls_sanitize_version($oldver);
$newver = yourls_sanitize_version($newver);

yourls_maintenance_mode(true);

// special case for 1.3: the upgrade is a multi step procedure
Expand Down
8 changes: 8 additions & 0 deletions includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@
/**
* YOURLS version
*
* Must be one of the following :
* MAJOR.MINOR (eg 1.8)
* MAJOR.MINOR.PATCH (1.8.1)
* MAJOR.MINOR-SOMETHING (1.8-dev)
* MAJOR.MINOR.PATCH-SOMETHING (1.8.1-donotuse)
*
*/
define( 'YOURLS_VERSION', '1.8.3-dev' );

/**
* YOURLS DB version. Increments when changes are made to the DB schema, to trigger a DB update
*
* Must be a string of an integer.
*
*/
define( 'YOURLS_DB_VERSION', '506' );
0