Repository navigation
Prevent Steam Networking IPs being added to DB & being parsed by SourceSleuth #1600
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
96764ec
prevent steam networking IPs from being added to DB and being parsed …
aarmastah 60ab93f
move IsSteamNetworkingIP bool to sbpp_server_ip.inc
aarmastah f4244d1
add sdk2013 sdr comment directly to include
aarmastah 4cf84c6
Update sbpp_server_ip.inc with documentation link
rumblefrog 28aaaf0
add documentation about sdr/steam networking, rename SBPP_IsSteamNetw…
aarmastah acbcaa5
Update placeholder IPs in in-game reports
rumblefrog File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,92 @@ | ||
| <?php | ||
|
|
||
| // Steam Networking (SDR / FakeIP) cleanup. Valve's SDK 2013 hands the server a | ||
| // placeholder 169.254.x.x address for SDR clients instead of a real IP. It is | ||
| // shared by every such player, so it identifies nobody; the SourceMod plugins | ||
| // no longer store it (see `SBPP_GetClientPublicIP` in `sbpp_server_ip.inc`). | ||
| // This migration removes the placeholder from rows written by older plugins. | ||
| // | ||
| // 1. IP bans (`type = 1`) of an SDR player: the "IP" was the shared | ||
| // placeholder, so the row blocked (or, worse, would block) every SDR | ||
| // client. The plugin's SteamID-only check can't see `type = 1` rows, so | ||
| // convert the row to a SteamID ban (`type = 0`) when it carries a valid | ||
| // SteamID, and clear the placeholder. Rows without a valid SteamID are | ||
| // left as they are, only the placeholder is cleared below. | ||
| // 2. Any other `ip` still holding a placeholder is set to NULL, matching | ||
| // the shape of SteamID bans written without an IP. | ||
| // 3. `adminIp` placeholders (admins connecting over SDR) are blanked in both | ||
| // `:prefix_bans` and `:prefix_comms`. | ||
| // 4. In-game reports (`SBReportPlayer`) store the reporter's IP in | ||
| // `:prefix_submissions.ip` and the target's in `sip`. Placeholders there | ||
| // are blanked (`ip` is NOT NULL) or set to NULL (`sip`). | ||
| // | ||
| // `:prefix_protests.ip` is NOT touched: it holds the web visitor's address, | ||
| // not a game client's. | ||
| // | ||
| // Every pass is idempotent: once a row has been rewritten it no longer matches | ||
| // its own WHERE clause, so a re-run after a partial failure is safe. | ||
| // | ||
| // `$this` is supplied by Updater::update(); PHPStan can't see that, so each | ||
| // `$this->dbs` call is suppressed like every sibling migration. | ||
|
|
||
| // Pass 1: SDR IP bans with a real SteamID become SteamID bans. | ||
| // @phpstan-ignore variable.undefined | ||
| $this->dbs->query( | ||
| "UPDATE `:prefix_bans`" | ||
| . " SET `type` = 0, `ip` = NULL" | ||
| . " WHERE `type` = 1" | ||
| . " AND `ip` LIKE '169.254.%'" | ||
| . " AND `authid` REGEXP '^STEAM_[0-9]:[0-9]:[0-9]+$'" | ||
| ); | ||
| // @phpstan-ignore variable.undefined | ||
| $this->dbs->execute(); | ||
|
|
||
| // Pass 2: clear any remaining placeholder IP. | ||
| // @phpstan-ignore variable.undefined | ||
| $this->dbs->query( | ||
| "UPDATE `:prefix_bans`" | ||
| . " SET `ip` = NULL" | ||
| . " WHERE `ip` LIKE '169.254.%'" | ||
| ); | ||
| // @phpstan-ignore variable.undefined | ||
| $this->dbs->execute(); | ||
|
|
||
| // Pass 3: placeholder admin IPs. | ||
| // @phpstan-ignore variable.undefined | ||
| $this->dbs->query( | ||
| "UPDATE `:prefix_bans`" | ||
| . " SET `adminIp` = ''" | ||
| . " WHERE `adminIp` LIKE '169.254.%'" | ||
| ); | ||
| // @phpstan-ignore variable.undefined | ||
| $this->dbs->execute(); | ||
|
|
||
| // @phpstan-ignore variable.undefined | ||
| $this->dbs->query( | ||
| "UPDATE `:prefix_comms`" | ||
| . " SET `adminIp` = ''" | ||
| . " WHERE `adminIp` LIKE '169.254.%'" | ||
| ); | ||
| // @phpstan-ignore variable.undefined | ||
| $this->dbs->execute(); | ||
|
|
||
| // Pass 4: placeholder IPs from in-game reports. | ||
| // @phpstan-ignore variable.undefined | ||
| $this->dbs->query( | ||
| "UPDATE `:prefix_submissions`" | ||
| . " SET `ip` = ''" | ||
| . " WHERE `ip` LIKE '169.254.%'" | ||
| ); | ||
| // @phpstan-ignore variable.undefined | ||
| $this->dbs->execute(); | ||
|
|
||
| // @phpstan-ignore variable.undefined | ||
| $this->dbs->query( | ||
| "UPDATE `:prefix_submissions`" | ||
| . " SET `sip` = NULL" | ||
| . " WHERE `sip` LIKE '169.254.%'" | ||
| ); | ||
| // @phpstan-ignore variable.undefined | ||
| $this->dbs->execute(); | ||
|
|
||
| return true; |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -48,5 +48,6 @@ | |
| "807": "807.php", | ||
| "808": "808.php", | ||
| "809": "809.php", | ||
| "810": "810.php" | ||
| "810": "810.php", | ||
| "811": "811.php" | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.