User:DWalden (WMF)/Blocking

Types of block

 * Account block
 * Special:Block against a user account. These may also be referred to as "Database account blocks".


 * Autoblock
 * When creating an account block, you can optionally check an option . This creates an IP block against the IP of the account. This differs from a normal IP block because it is not meant to show information about an account's IP. The account needs to have performed some action first (e.g. editing a page) in order for the system to know what their IP address is. See Autoblock.


 * Hidden block
 * For a Special:Block account block or autoblock which has an indefinite expiry you can check the option . Only users with the hideuser right (on enwiki this is users in the Oversighters group) will be able to see these blocks in Special:BlockList, Special:Log/block (and perhaps other places) and the account name will be hidden from normal users (e.g. in revision history).


 * IP block
 * Special:Block against an IP (e.g.,  ). These may also be referred to as "Database IP blocks".


 * Range block
 * Special:Block against an IP range (e.g.,  ). These may also be referred to as "Database range blocks".


 * Global IP
 * Special:GlobalBlock against an IP.


 * Global Range
 * Special:GlobalBlock against an IP range.


 * System block
 * There are several configuration variables which can block IP addresses/ranges. Add these to :
 * $wgProxyList
 * $wgSoftBlockRanges
 * $wgDnsBlacklistUrls (to block all IPs, set . Remember to also set  .)

''N.B. There are other types of blocks which I haven't listed above, e.g. Extension:TorBlock. We probably don't have to worry about those.''

Ways blocks can be applied

 * Logged in
 * If you have an account block or autoblock applied to an account you are logged in as.


 * Public IP
 * Your public IP address is blocked.


 * Cookie
 * If you login to an account which has an autoblock you will have a cookie added to your browser. Even if you log out, the account block will still be applied to you, until the cookie expires. See $wgCookieSetOnAutoblock and Autoblock.
 * A similar thing will happen if you attempt an action with a blocked IP, see $wgCookieSetOnIpBlock.


 * X-Forward-For (XFF)
 * If a blocked IP address is in your XFF header and  is true.

Block parameters
For some types of blocks (esp. database blocks) what exactly a user is blocked from can be determined when creating the block. For example, we can decide whether we want to block users from sending an email.


 * Anonymous
 * For database and global blocks we can choose whether the block applies only to anonymous (IP) users or to both anonymous and logged in users.

Important things to know

 * Partial block
 * When creating an Account, IP or Range block in Special:Block, you can check the radio button . This then gives you the option to block editing of only certain pages and/or namespaces and/or doing certain actions. You might want to add   to your   to be able to block other actions.


 * Composite block
 * When you have multiple types of blocks applied to you, the software will create a "composite block". You cannot create these directly. Instead, you need to create multiple individual blocks which affect the same user. For example, you can block someone's account and their IP, or have a Global block and an IP block against the same IP. A composite block can include database blocks, system blocks and Global blocks.

The above two interact with one another. For example, if I have a partial block against my account blocking me from editing "Page A" and a partial block against my IP blocking me from editing "Page B", this will form a composite block where I will be blocked from editing both "Page A" and "Page B". It will always apply the most strict restrictions of all the individual blocks.

Oracles
There are a variety of different messages you should see when you are blocked and attempting to perform an action you are blocked from doing.

It is sometimes useful to be able to identify which message you are seeing by its internal name. You can see this by adding  to the URL.

Test tools and scripts
See https://gitlab.wikimedia.org/dwalden/block-testing/-/tree/main.

Simulate a different IP address locally (on docker)
Add this to :

Install a browser extension which allows you to change your X-Forward-For header. For example, this one for Firefox or Chrome.

Follow the instructions provided by the addon to change your X-Forward-For header to the IP you want to simulate.

Then interact with the wiki as usual.

Example matrix of test block scenarios
Due to the fact that composite blocks can apply multiple blocks at the same time, there are a large number of possible combinations of blocks a user can have affecting them at any one time. Below is just a small sample. Create your own combinations you think represent realistic or interesting scenarios.

Description of example scenarios

 * 1) You are logged in an account which is blocked (but not autoblocked) and your public IP is also globally blocked.
 * 2) You share the same public IP as an account which is autoblocked and that IP is also in a globally blocked range.
 * 3) You have just logged out of an account which is autoblocked (so a cookie has been set on your browser) and you have an IP address in your XFF header which is in a globally blocked range.