Skip to content
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

Sanatize super-globals variables before use. #16

Closed
4 tasks done
lewisgoddard opened this issue Oct 22, 2015 · 6 comments
Closed
4 tasks done

Sanatize super-globals variables before use. #16

lewisgoddard opened this issue Oct 22, 2015 · 6 comments

Comments

@lewisgoddard
Copy link
Member

We will likely want to sanitize all the variables appropriately before we do anything else.

  • List all variables
  • Sanitize in new file
  • De-duplicate sanitation
  • Replace references
@lewisgoddard
Copy link
Member Author

From phoenix.php#L33:

// TODO Sanatize everything
// once.input.sanatize.php
// IF BINARY
if (
    isset($_GET['info_hash']) &&
    strlen($_GET['info_hash']) == 20
) {
    $_GET['info_hash'] = bin2hex($_GET['info_hash']);
}
if (
    isset($_GET['peer_id']) &&
    strlen($_GET['peer_id']) == 20
) {
    $_GET['peer_id'] = bin2hex($_GET['peer_id']);
}
// END IF BINARY

@lewisgoddard
Copy link
Member Author

We should replace all super-global references with ones similar to $Sanitized['GET']['info_hash']. $Sanitized should be SQL-safe. This will remove the need for sanitation within functions or before SQL queries.

@lewisgoddard
Copy link
Member Author

once.input.sanatize.admin.php
once.input.sanatize.announce.php
once.input.sanatize.scrape.php
once.input.sanatize.tracker.php (both)

@lewisgoddard
Copy link
Member Author

admin.php is done, I'm up to announce.php#L47

@lewisgoddard
Copy link
Member Author

announce.php is done. Only scrape.php and it's associates to do.

@lewisgoddard
Copy link
Member Author

Just de-duplication left. once.sanatize.tracker.php has two 20-bit binary or 40-bit hexadecimals that work the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant