Page MenuHomePhabricator

Security review of IP Info extension
Closed, ResolvedPublic

Description

Project Information

Description of the tool/project:

Basic description

A new extension for providing information about an IP address without (1) the need for the user to use an external service themselves and (2) exposing the IP address itself to the user. (Actually hiding the IP addresses is beyond the scope of this project.)

This provides the user with information they could have retrieved from knowing the IP address. This information could be displayed in various ways (popup on hover/click, special page, etc.).

Data

Based on our investigation in T259726, the data our users are looking for is not accessible from freely licensed datasets alone. Ideally IPInfo would combine several datasets, but this depends on agreeing licences with different providers, and will only be considered in future iterations.

The first iteration of IPInfo will use only MaxMind's GeoIP2 library, which we already have licences for, and which are already available on our servers: T263263#6534392. A PHP package providing an API for these databases is undergoing a security readiness review: T262963.

For third parties who do not have access to the proprietary datasets, IPInfo will use MaxMind's free GeoLite2 databases.

API

IPInfo provides two API endpoints, taking an edit id or a log id. If the edit or log was performed by an anonymous user (or the log target is an anonymous user), the API returns data about the relevant IP address(es).

Client-side UI

Currently IPInfo adds a button next to IP addresses on Special:Log and history pages. The data are retrieved on clicking this button, and displayed in a popup. This design may change.

Description of how the tool will be used at WMF:

Deployment

We expect the feature to be deployed to all wikis, and be available on certain pages that show IP addresses. It will initially be available only to checkusers.

Preventing abuse

Sending an edit/log ID rather than the IP address will allow the IP address to remain hidden (once they become hidden in the future), and is intended to prevent IPInfo from being used as an API for getting information about arbitrary IP addresses.

Only users with the 'ipinfo' right can see the information. At first this right will only be given to checkusers. In the future when IP addresses are no longer visible, more users may need to access this information, e.g. for patrolling to fight vandalism. This will depend on user research and testing.

Users will sign an agreement when first using this tool, and a record will be kept of which users have access. Access may be taken away from a user, and a record will be kept of this too: T264150.

Dependencies

  • GeoIP2 library: T262963
  • OOUI for UI components

Has this project been reviewed before?

No, but we are also requesting a performance review - T260821

Working test environment

IPInfo is available to logged-in users on our test environment: https://thegoodplace.wmcloud.org/index.php?title=Special:Log

Post-deployment

Anti-Harassment will be responsible for this post-deployment:

Details

Author Affiliation
WMF Product

Related Objects

StatusSubtypeAssignedTask
ResolvedSTran
ResolvedSTran
OpenNone
OpenNone
ResolvedNiharika
ResolvedTchanders
ResolvedNiharika
Resolved AGueyte
ResolvedSTran
ResolvedSTran
Resolved AGueyte
ResolvedNiharika
ResolvedSTran
ResolvedNiharika
ResolvedTchanders
InvalidNone
InvalidNone
InvalidNone
ResolvedSTran
ResolvedSTran
ResolvedSpikephuedx
ResolvedSTran
Resolved TThoabala
Resolvedphuedx
DeclinedTchanders
ResolvedSTran
ResolvedSTran
ResolvedTchanders
ResolvedTchanders
Resolvedsbassett
ResolvedDec 15 2020Tchanders
ResolvedTchanders
ResolvedTchanders
InvalidNone
ResolvedSep 22 2020Tchanders
ResolvedSep 22 2020Tchanders
ResolvedTchanders
Resolveddbarratt
ResolvedTchanders
Resolveddbarratt
ResolvedTchanders
Resolvedsbassett
ResolvedNiharika
InvalidNone
StalledNone
ResolvedSecurityUrbanecm
ResolvedUrbanecm

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Niharika renamed this task from Performance review of IP Info extension to Security review of IP Info extension [WIP].Aug 19 2020, 4:53 PM
Niharika changed the edit policy from "Custom Policy" to "All Users".Aug 19 2020, 4:55 PM
Niharika changed the visibility from "Custom Policy" to "All Users".
Niharika renamed this task from Security review of IP Info extension [WIP] to Security review of IP Info extension [WIP] [8H].Aug 19 2020, 5:05 PM

@Reedy is this the right form for asking for a security review for the extension? Or is this one better?

@Reedy is this the right form for asking for a security review for the extension? Or is this one better?

One isn't necessarily "better" than the other, it's for slightly different purposes. I think this one came from the template on https://phabricator.wikimedia.org/maniphest/task/edit/form/72/ which is for more overall/general requests; especially if you don't quite know what service/whatever you actually need, and want help being pointed in the right direction

You're presumably going to want the one from form 79, which is the readiness review (and can be a subtask of this). The question being if you require any other help/services? :)

Niharika triaged this task as Medium priority.Aug 24 2020, 10:31 PM

@Reedy is this the right form for asking for a security review for the extension? Or is this one better?

One isn't necessarily "better" than the other, it's for slightly different purposes. I think this one came from the template on https://phabricator.wikimedia.org/maniphest/task/edit/form/72/ which is for more overall/general requests; especially if you don't quite know what service/whatever you actually need, and want help being pointed in the right direction

You're presumably going to want the one from form 79, which is the readiness review (and can be a subtask of this). The question being if you require any other help/services? :)

Got it. Thanks! I think we are looking for a general direction on this project. I'll chat with Thalia about it some more.

@Tchanders This looks good to me. I added some of the Privacy risks to T260821. Might be worth explaining here, but as you say, it might end up being a licensing restriction anyways.

We expect the feature to be deployed to all wikis, and be available on certain pages that show IP addresses, e.g. Special:RecentChanges. (@Niharika do we know which pages?)

We don't know for sure yet. We will start with Special:Investigate and gradually expand to other pages (such as Special:RecentChanges)based on user research and testing.

We expect the feature to be available only to CheckUsers initially, and later to other trusted user groups. (@Niharika Do we know which user groups?)

This will also depend on user research and testing. There is also a possibility of there being a new user group for users who will have access to this information.

Aklapper changed the visibility from "All Users" to "Public (No Login Required)".Sep 9 2020, 5:46 AM
Aklapper subscribed.

[For the records, I have changed the View Policy of this task from "All Users" to "Public" (the former makes no sense) and also fixed https://phabricator.wikimedia.org/transactions/editengine/maniphest.task/view/72/ which had set this strange view policy default.]

Tchanders renamed this task from Security review of IP Info extension [WIP] [8H] to Security review of IP Info extension.Sep 9 2020, 5:59 PM
Tchanders updated the task description. (Show Details)

Thanks @Niharika and @Aklapper.

sbassett changed the task status from Open to Stalled.Sep 9 2020, 6:38 PM
sbassett lowered the priority of this task from Medium to Low.
sbassett moved this task from Incoming to Back Orders on the secscrum board.
sbassett subscribed.

Stalling to our backlog for now until there's some code/commit sha for the review.

Stalling to our backlog for now until there's some code/commit sha for the review.

Just wanted to note that this is ready for review - thanks.

sbassett changed the task status from Stalled to Open.Nov 18 2020, 6:24 PM
sbassett moved this task from Back Orders to Waiting on the secscrum board.

Stalling to our backlog for now until there's some code/commit sha for the review.

Just wanted to note that this is ready for review - thanks.

Ok, I'll re-open. I'm currently having a look at the related T262963, which I hope to complete this week or next.

Thank you @sbassett. We'd like to deploy on beta by the end of the year, but we also understand you're very busy at the moment.

@Niharika mentioned it might be possible to deploy before the reviews are complete if we're able to get manager buy-in (presumably from @aezell)?

@Niharika mentioned it might be possible to deploy before the reviews are complete if we're able to get manager buy-in (presumably from @aezell)?

Yes, this portion of the extension deployment documentation was recently refactored by me: https://www.mediawiki.org/wiki/Writing_an_extension_for_deployment#Preparing_for_deployment. Performance and Security reviews are no longer considered hard blockers to deploy to beta (in fact, performance reviews require beta deployment). The way that the Security-Team has been implementing this so far is by assigning a pre-review risk of medium for any code which needs a more hastened beta deployment. This requires manager-level ownership of said risk. And we would still block deployment to production pending a satisfactorily-completed security review unless there was c-level approval and ownership of all associated risk.

Thanks @sbassett. I approve the expedited release and take ownership of any risk involved.

@Tchanders - I hope to have this review completed by early next week.

Update: I've performed several automated security checks and scans against the code base and have not found anything concerning. I'd like to spend a little more time today manually exploring and pen-testing the extension, installed within a mediawiki instance, and then this review should be complete.

Security Review Summary - T260822 - 2020-12-18
Last commit reviewed: 70676b782489f26bea2a49c06f3c5b4cc932bd9c

Summary

Overall, this extension looks pretty good and I'd rate its overall risk as low, barring any further major changes or refactors. A few notes:

  1. I tested all of the OOUI sinks I could find and both the popup and infoBox widgets looked good. And the data in question should be fairly trustworthy to begin with (mw messages, maxmind db values).
  2. I didn't really investigate any potential Vuln-DoS issues as those classifications of vulnerabilities appear to have been dealt with (in different ways) during the performance review (T260821).
  3. Given some of the issues discussed within T263263 (and my own adventure building out a local development environment to test the extension), it might be worth attempting to incorporate some of the test databases and source data into unit/integration tests for both better code coverage and (hopefully) easier local development and testing.
sbassett claimed this task.
sbassett moved this task from In Progress to Our Part Is Done on the secscrum board.
sbassett added a subscriber: Tchanders.

Thanks @sbassett

it might be worth attempting to incorporate some of the test databases and source data into unit/integration tests for both better code coverage and (hopefully) easier local development and testing.

Filed as T269775

@sbassett Since this security review was done, we've experienced some delays in deployment due to additional product requirements (copying in @Niharika) and the team being unexpectedly asked to work on SecurePoll.

We would hope to deploy IPInfo to testwiki in a month and to the rest of our production sites as a BetaFeature by the end of the quarter. However, more features have been added since T260822#6702741, so we're not sure whether this plan would be blocked on another security review. (And we're aware the security team is very busy at the moment.) What would you advise?

Also copying in @JayCano, who is our (not-so) new engineering manager.

@sbassett Since this security review was done, we've experienced some delays in deployment due to additional product requirements (copying in @Niharika) and the team being unexpectedly asked to work on SecurePoll.

We would hope to deploy IPInfo to testwiki in a month and to the rest of our production sites as a BetaFeature by the end of the quarter. However, more features have been added since T260822#6702741, so we're not sure whether this plan would be blocked on another security review. (And we're aware the security team is very busy at the moment.) What would you advise?

Hey @Tchanders - could you provide a diff of the relevant changes since 70676b782489f26bea2a49c06f3c5b4cc932bd9c somewhere? I'd like to get some idea of how much code we're talking about here. I would doubt that, in all but the most extreme cases, it would be enough to block on a new security review. Thanks.

sbassett moved this task from Our Part Is Done to Waiting on the secscrum board.

Ping @Tchanders - any feedback on my above suggestion? Thanks.

Apologies @sbassett - this has been on my todo list. I've enumerated the main changes below, but it may be that this review doesn't need re-doing? As with other new projects, we're continuing to develop features according to requirements set out by our product manager @Niharika, and in response to testing and feedback as we deploy. I suppose we're uncertain of when the review process is considered over, given all that. Thanks for your help!


The full diff since the last review is here, but that includes a lot of refactoring and filename changes. Also small changes such as showing more MaxMind data, including the popup in more places, etc.

The main new features are:

  • Added src/HookHandler/BetaFeaturePreferencesHandler.php so we can deploy as a beta feature, using the BetaFeatures extension
  • Added src/InfoRetriever/BlockInfoRetriever.php and src/InfoRetriever/ContributionInfoRetriever.php, which retrieve on-wiki information (e.g. number of blocks, contributions, etc)
  • Added src/Logging/Logger.php so that logs of data access can be browsed on Special:Log (feature still under development)
  • src/HookHandler/SchemaHandler.php adds a new table, discussed with DBAs in T297696. The feature is still under development, and isn't a blocker to testwiki deployment

Thanks, @Tchanders. I'll plan to have a look at the diff, with a specific focus on the new features you mention above. At a glance, I'm not seeing anything that would warrant a reclassification of the risk, but I'll confirm that for sure. I can likely get this done by the time you plan to launch in a month or so.

Thanks, @Tchanders. I'll plan to have a look at the diff, with a specific focus on the new features you mention above. At a glance, I'm not seeing anything that would warrant a reclassification of the risk, but I'll confirm that for sure. I can likely get this done by the time you plan to launch in a month or so.

Thank you @sbassett

@sbassett do you have an update for us? Hoping to deploy by end of this week on testwiki.

@sbassett do you have an update for us? Hoping to deploy by end of this week on testwiki.

No, not yet. I'm at a team offsite this week, but I'll try to get this done this week. It shouldn't block deployment, regardless, as after glancing at the changes, none of them appeared to be high-risk.

@Niharika @Tchanders - I should have my re-review posted later today. After a cursory glance at the github diff, I'm not yet seeing anything majorly concerning that would adjust the previous risk rating of low.

@Niharika @Tchanders -

After a re-review of the new additions to ext:IPInfo, I'm going to keep the overall risk rating as low, unchanged from the initial review. Here are some notes on what I did for the re-review along with some additional, minor issues which were found:

  1. Performed a quick eyeballing of the provided github diff.
  2. Spot-checked a handful of recent commits for ext:IPInfo, with particular focus on the output of mwext-php72-phan-docker and the SecCheckPlugin's output. Also ran the plugin locally against IPInfo@master.
  3. Ran semgrep static analysis policies and rule sets against IPInfo@master, including specific JavaScript and PHP policies.
  4. Ran a number of SCA tools against IPInfo@master for various JavaScript and PHP packages.
  5. Ran some custom, security-related JavaScript and PHP greps against IPInfo@master.

Here were a few minor findings:

Vulnerable Packages - Development

VulnerabilityPackageNotesServiceRemediationRisk
Exposure of Sensitive Information to an U...nanoidstylelint-config-wikimedia >npm auditadvisory link medium
Exposure of Sensitive Information to an U...nanoidstylelint-config-wikimedia >npm auditadvisory link medium

Outdated Packages
As reported via npm outdated:
(no explicit vulnerabilities reported, simply noting for completeness' sake.)

PackageCurrentWantedLatest
PackageCurrentWantedLatest
grunt-eslint23.0.023.0.024.0.0
grunt-stylelint0.16.00.16.00.17.0
sbassett moved this task from In Progress to Our Part Is Done on the secscrum board.
sbassett moved this task from In Progress to Done on the user-sbassett board.