Jump to content
MediaWiki

Extension:SecurePoll

From mediawiki.org
This page is a translated version of the page Extension:SecurePoll and the translation is 83% complete.
Outdated translations are marked like this.
MediaWiki 拡張機能マニュアル
SecurePoll
リリースの状態: 安定
実装 特別ページ
説明 選挙、投票、アンケートができるようにします。
作者 Tim Starling トーク
最新バージョン 3.0.0 (継続的な更新)
互換性の方針 MediaWiki とともにリリースされるスナップショット。 master には後方互換性がありません。
MediaWiki 1.25+
データベースの変更 はい
テーブル securepoll_entity
securepoll_msgs
securepoll_properties
securepoll_elections
securepoll_questions
securepoll_options
securepoll_voters
securepoll_votes
securepoll_strike
securepoll_lists
securepoll_cookie_match
ライセンス GNU 一般公衆利用許諾書 2.0 以降
ダウンロード
  • $wgSecurePollShowErrorDetail
  • $wgSecurePollEditOtherWikis
  • $wgSecurePollUseLogging
  • $wgSecurePollKeepPrivateInfoDays
  • $wgSecurePollCreateRemoteScriptPath
  • $wgSecurePollUseNamespace
  • $wgSecurePollUseMediaWikiNamespace
  • $wgSecurePollMostActiveWikisThreshold
  • $wgSecurePollCreateWikiGroups
  • $wgSecurePollTempDir
  • $wgSecurePollCreateWikiGroupDir
  • $wgSecurePollExcludedWikis
  • securepoll-create-poll
  • securepoll-edit-poll
  • securepoll-view-voter-pii
translatewiki.net で翻訳を利用できる場合は、SecurePoll 拡張機能の翻訳にご協力ください
問題点 未解決のタスク · バグを報告

SecurePoll拡張機能は、選挙、投票、アンケートのための特別ページ拡張機能です。 ウィキメディア財団理事会選挙や裁定委員会選挙で使用されています。また、ウィキメディア・ライセンス移行投票にも使用されました。

スクリーンショット

インストール

  • ダウンロードして、ファイルをextensions/フォルダー内のSecurePollという名前のディレクトリ内に配置します。
    開発者とコード寄稿者は、上記の代わりに以下を使用してGitからインストールします:
    cdextensions/
    gitclonehttps://gerrit.wikimedia.org/r/mediawiki/extensions/SecurePoll
    
  • 以下のコードを LocalSettings.php ファイルの末尾に追加します:
    wfLoadExtension( 'SecurePoll' );
    
  • 更新スクリプト を実行します。このスクリプトは、この拡張機能が必要とするデータベーステーブルを自動的に作成します。
  • Yes 完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。

In addition, you will need to add some user groups and user rights to your LocalSettings.php file. Here is one way to do it, which gives a new group called electionadmin the power to do everything in SecurePoll (create polls, edit polls, see voter IP addresses):

$wgGroupPermissions['electionadmin']['securepoll-create-poll'] = true;
$wgGroupPermissions['electionadmin']['securepoll-edit-poll'] = true;
$wgGroupPermissions['electionadmin']['securepoll-view-voter-pii'] = true;

Once this group is created, a bureaucrat can add someone to the group using Special:UserRights. Then that person can visit Special:SecurePoll to view polls, create polls, edit polls, tally polls, etc.

Each poll's data is compartmentalized. You can have 100 electionadmins, but if you only add one electionadmin to a particular poll, only that one electionadmin will be able to edit that particular poll or see user IPs. If an electionadmin is removed from a poll, they will lose access to it.

securepoll-view-voter-pii is used for "scrutineering" a poll, which involves looking at a list of voter IPs, user agents, and X-Forwarded-For headers to look for cheating (secret duplicate votes by sockpuppets). Because this involves looking at voter IP addresses and other sensitive, personal, de-anonymizing data, it is a sensitive user right, so only trusted users should be assigned to the electionadmin group.

It is possible to split securepoll-view-voter-pii into a separate group. You can use a config such as the one below to create a group called scrutineer that contains the securepoll-view-voter-pii right, separating it from the electionadmin group:

$wgGroupPermissions['electionadmin']['securepoll-create-poll'] = true;
$wgGroupPermissions['electionadmin']['securepoll-edit-poll'] = true;
$wgGroupPermissions['scrutineer']['securepoll-create-poll'] = true;
$wgGroupPermissions['scrutineer']['securepoll-edit-poll'] = true;
$wgGroupPermissions['scrutineer']['securepoll-view-voter-pii'] = true;

A user also needs to be added to the poll (and hence have the securepoll-edit-poll right) in order to view PII - securepoll-view-voter-pii by itself has no effect.

使用法

新規投票の作成

新規投票を作成するには、手動でXMLファイルを作成してそれをインポートする方法と、Special:SecurePollの投票作成インターフェースを使用する方法があります。

手動

投票を手動で作成するためには以下のことが必要です。

  1. XMLファイルを書く
  2. コマンドラインインターフェイスのimport.phpコマンドを使用してインポートします。

テストフォルダの中には、4つのサンプルファイルがあります。

  • 3way-test.xml
  • approval-test.xml
  • radio-range.xml
  • schulze-test.xml info

投票をインポートするには、cli フォルダから以下を実行します。

extensions/SecurePoll/maintenance$phpimportElectionConfiguration.php../tests/phpunit/data/3way-test.xml

dockerを使って投票をインポートするには、cliフォルダから以下を実行します。

docker-composeexecmediawikiphpextensions/SecurePoll/maintenance/importElectionConfiguration.phpextensions/SecurePoll/tests/phpunit/data/3way-test.xml

ウェブインタフェース経由

securepoll-create-pollの権限を持った利用者は、Special:SecurePollの一番下にあるリンクから新しい投票を作成することができます。

新しい投票を作成するには、作成フォームの必須フィールドに必要事項を入力します。 以下のフィールドには特に注意を払う必要があります。

  • When adding poll admins, only members of the electionadmin group are allowed. If $wgSecurePollUseLogging is set to true, it will be logged whenever an admin is added to or removed from a poll. The logs can be viewed at Special:SecurePollLog.
  • 暗号化された投票を作成するには、暗号化方式のラジオを選択します。 GnuPGを選択した場合、(公開)暗号化キーと(非公開)復号化キーを生成します。 暗号鍵は作成フォームに入力し、秘密鍵はオフラインの場所に保管してください(選挙終了後、集計の際に必要になります)。 詳細な例は[1ドル here]をご覧ください。

さあ、Special:SecurePollを訪れて、皆さんの投票をご覧ください。 At the top of the poll is some introductory text about the poll. By default it will show [text], and this can be edited via the translation interface (see below).

既存の投票を編集

投票を編集するのは、該当の投票の管理者でなければなりません。 Special:SecurePollから、編集したい投票の「編集」リンクをクリックします。

選挙が始まる前であれば、選挙に関することは何でも編集可能です。 選挙が開始されると、一部の項目は編集できなくなります。

有権者の編集

有権者を編集するのは、当該の投票の管理者である必要があります。 Special:SecurePollから、投票の「投票資格」のリンクをクリックします。

投票の翻訳

投票を翻訳するには、当該の投票の管理者である必要があります。 Special:SecurePollから、翻訳したい投票の「翻訳」リンクをクリックします。

投票者一覧の閲覧

投票が作成されたときに、透明性機能が無効にされていない限り、誰でも投票者一覧を閲覧できます。

特定の投票所の管理者は、投票者一覧を、重複する投票者を特定するのに役立つ非公開の情報 (IP アドレス、ユーザー エージェント情報、共有 Cookie など) と共に閲覧できます。 $wgSecurePollUseLoggingtrue を設定すると、管理者が非公開データを閲覧するたびに記録されます。 ログはSpecial:SecurePollLogで閲覧できます。

管理者は重複していると確信した票を無効にできます。

票の集計

票の集計は特定の投票の管理者のみに認められます。 Special:SecurePollで、皆さんが票の集計をしたい投票への集計リンクがクリックできます。

もし投票がすでに集計されていたら、そのページに結果が表示されています。 もしなければ、または皆さんが再集計したいのであれば、新規集計を始めるためのフォームがあります。

  • 投票が暗号化されていなければ、集計ボタンをクリックしてください。
  • 投票が暗号化されている場合、より多くの情報を入力する必要があるかもしれません。例えば、GnuPGを使用した場合、(非公開の)復号化キーを入力し、集計ボタンをクリックします。暗号化された投票に多くの投票がある場合、集計に長い時間がかかることがあります。後で結果を確認する必要があるかもしれません。

次に、Special:SecurePollにアクセスすると、皆さんの投票がご覧いただけます。

(STV) 集計

単記委譲式投票方式(single transferable votes 略号STV)の詳細情報はこちらをご参照ください。

一般的なアルゴリズム(algorithm)の実装 (source).

クオータ(Quata)式投票とは + .000000001. 最低得票数(Quota)は、議席を確保するための最小限の票数です。

1. コンピューターで最低得票数を計算してみましょう。
2. 第一希望で候補者に票を割り振ります。
3. 少なくとも最低得票数に達した候補者、全員を勝利者として発表します。
4. 勝者から希望者に余剰票を移します。
5. 3から4の手順を、もはや選ばれる新しい候補者がいなくなるまで繰り返します。(いくつかの制度の元では、初めのうち、票は以前の勝者と敗者を逆転させる可能性があります。これは選挙結果に影響するかもしれません)
もし、すべての議席が勝利者で埋まれば、過程は終了です。さもなければ:
6. ひとりまたはそれ以上の候補者が敗退することになります。通例、最下位の候補者か、残った候補者のなかで合計票が最低の得票数より少ない者になります。
7. 敗者の票を残った希望のある候補者に移します。
8. 3-7を議席が埋まるまで繰り返します。

今回使用するクォータ(手順1)は、ドループクォータ(情報)方式です。

floor( no. votes / (no. seats + 1) ) + 1

選ばれた、あるいは敗退した候補者から票を移動させる方法には、ミーク(Meek)方式を用います。 w:Counting_single_transferable_votes#Meek


集計作業(JobRunner)

この作業のために、 scheduled jobを作成するか、手作業で遂行するか、はっきりさせておいてください。

  • また、集計は、手動で集計スクリプトを実行することでも進めることができます。

集計を実行するには、下記のように、1ドルにある cli フォルダから実行します。

extensions/SecurePoll/maintenance/TallyElection.php

MediaWiki-Dockerを使って集計を実行するには、1ドルに置かれた cli フォルダから、下記コマンドを動かします。

docker-composeexecmediawikiphpextensions/SecurePoll/maintenance/TallyElection.php

(STV)試験選挙を作り出す

  • 試験的な(STV)選挙は、1ドルに置かれた cli フォルダから作り出すことができます。
  • 試験選挙を作り出すには、1ドルに置かれたcli フォルダから下記コマンドを動かします。
extensions/SecurePoll/maintenance/GenerateTestElection.php
  • 試験的な(STV)選挙は集計のための足場を提供します。

Redirect polls

A redirect poll is a poll that shows up in the list of polls at Special:SecurePoll, but clicking on "vote" and other links will redirect the voter to a different wiki. This is useful if you do all of your votes on a central votewiki (in Wikimedia's case, https://vote.wikimedia.org).

Special:SecurePoll/create will show an additional drop-down list called "For wiki:"—allowing you to select "This wiki", "All wikis", or a different wiki in your wiki farm—if all of the following conditions are met:

  • You are using a wiki farm (multiple wikis using the same file system but different databases).
  • You haven't excluded all other wikis using $wgSecurePollExcludedWikis.
  • You have $wgCanonicalServer configured to have a period (use different subdomains) on each wiki.
  • You have $wgSecurePollEditOtherWikis = true; for your current wiki.

If you have a wiki in your wiki farm that doesn't have SecurePoll installed, be sure to add it to $wgSecurePollExcludedWikis to keep it out of the "For wiki:" list.

"For wiki" dropdown item selected What it does locally What it does on other wikis
このウィキ Creates a local election Nothing
すべてのウィキ Creates a local election Creates "redirect polls" at every other wiki in the wiki farm
Picking a specific other wiki such as es.wikipedia.org Creates a local election Creates a "redirect poll" at the chosen wiki

Testing note: $wgCanonicalServer must contain domains with subdomains. So for example, http://localhost will not get the dropdown list to show up, but http://en.localhost will.

$wgConf->settings = [
 'wgCanonicalServer' => [
 'my_database' => 'http://en.localhost:8080',
 'secondwiki' => 'http://es.localhost:8080'
 ],

In the database, fields related to redirect polls include the following securepoll_properties.pr_keys: jump-id, jump-url, main-wiki, and mobile-jump-url.

For developers

SQL tables

Note that configuring a poll to use encryption encrypts the securepoll_votes.vote_record field.

Most Wikimedia installations of SecurePoll only have a subset of these tables because they are configured to only host redirect polls that redirect to votewiki. They do not have any local polls. phab:T395928
Table Field prefix Description Contains sensitive data? Table needed for redirect polls?[1] [2]
securepoll_cookie_match cm_ Used on the vote details page to display the securepoll-cookie-dup-list message ("Cookie duplicate users"). Yes No
securepoll_elections el_ List of elections, and some basic config data such as the name, creator, start date, end date, language, ballot type (e.g. approval), and tally type (e.g. plurality). Additional config data is pivoted and stored in securepoll_properties instead. No Yes
securepoll_entity en_ Maps "one to many" with the securepoll_msg table. The "many" is because a securepoll_msg can be in multiple languages. Possible options for securepoll_entity.en_type are election, question, and option. No Yes
securepoll_lists li_ Stores usernames manually added via the Voter Eligibility page. Users are added in the format userName@databaseName. There are 3 types of lists:
  • Eligibility list - The li_name value is [electionId]/list/need-list. These are folks who are allowed to vote if they meet the on-the-fly eligibility requirements such as X number of edits.
  • Overrride list - The li_name value is [electionId]/list/include-list. These are folks who are allowed to vote no matter what.
  • Exclude list - The li_name value is [electionId]/list/exclude-list. These are folks who are not allowed to vote no matter what.
No Yes
securepoll_log spl_ If $wgSecurePollUseLogging is set to true, stores the log entries here. Yes. Special:SecurePollLog is private. No
securepoll_msgs msg_ List of strings. For example, the poll name, the poll questions, and the poll answers. This is mapped to from other tables such as securepoll_options and securepoll_questions, and supports having the same entity in multiple languages (securepoll_msgs.msg_lang). No Yes
securepoll_options op_ List of poll options for each question. Doesn't store the option text here, but rather maps it to the table securepoll_msgs. No No
securepoll_properties pr_ Config data for each election. For example, who the election admins are, whether it's a redirect poll, whether to shuffle the options, whether to use encryption, list of tallies and their values (tally-result), etc.

Is also the config data for on-the-fly voter eligibility calculation. For example, voter minimum edit count and voter not-sitewide-blocked is stored here.

Partial. Rows with pr_key as gpg-encrypt-key, gpg-sign-key, openssl-encrypt-key, openssl-sign-key, tally-result, tally-result-time are private data. Yes
securepoll_questions qu_ List of poll questions. Doesn't store the question text here, but rather maps it to the table securepoll_msgs. No No
securepoll_strike st_ Which votes have been struck (crossed out, removed from the tally) by election admins. Includes a reason that they can type in. Yes. Only election admins can see the strike log from the UI. No
securepoll_voters voter_ One row per voter per election. Voters are distinct and will not be duplicated in the same election. Contains data on the voter such as their user groups and whether they're blocked or not. Probably used to determine voter eligibility. voter_properties contains data such as wiki, blocked, sitewide blocked, central block count, central sitewide block count, edit count, bot, language, user groups, eligibility lists, and registration date. Partial. This is private for elections with transparency features disabled. No
securepoll_votes vote_ One row per vote per election. Contains data on the voter such as IP address and user agent, and contains the actual vote in the vote_record column. The "most active wiki" that the voter chose, if enabled for this poll, is stored in vote_voter_domain. vote_current=0 means that this is a duplicate vote and has been discarded; this is re-calculated for all of the user's previous votes each time they submit a new vote. Yes. Contains voter PII such as IP addresses and user agents. Contains the vote itself and its timestamp (the vote date is public unless the voter list is turned off, the vote time is private). No

Enabling local elections on a Wikimedia wiki

SecurePoll is installed on every wiki except loginwiki and wikitech. But additional configuration is needed to get it to host local elections (and not just redirect polls / global elections).

  • Phab ticket - Create a Phabricator ticket to start the process and centralize discussion. Tag it "Wikimedia-site-requests" and "MediaWiki-extensions-SecurePoll". Make the ticket a parent of T301180 Allow local wikis to set up elections.
  • Consensus - Get consensus to have local elections through a noticeboard discussion on your local wiki, and then link it in the phab ticket.
  • Tables - Have someone with the right production shell access (ops, deployment, restricted, analytics-privatedata-users) check that your wiki has the below tables in s1-s8 (not x1). If your wiki is missing any of these tables, ask someone with the right production shell access (ops, deployment) to create them. After T403874, these will be created by running the maintenance script WikimediaMaintenance -> createExtensionTables.php. Until that ticket is resolved, will need to do something else. Maybe copy paste some of SecurePoll -> sql/mysql/tables-generated.sql into the MariaDB monitor?
    • securepoll_cookie_match
    • securepoll_log - only needed if you're using the private logging feature ($wgSecurePollUseLogging)
    • securepoll_options
    • securepoll_questions
    • securepoll_strike
    • securepoll_voters
    • securepoll_votes
  • Patch - Write and deploy a gerrit patch similar to this one
    • If you want the public logging feature (logging when election officials change election settings, logs to public pages), set $wgSecurePollUseMediaWikiNamespace. $wgSecurePollUseNamespace is also an option, but is discouraged, because it creates an entire namespace for a small number of pages.
    • If you want the private logging feature (logging when election officials view IPs, logs to a private page), set $wgSecurePollUseLogging
  • NameTableAccessException - If you are getting the error "MediaWiki\Storage\NameTableAccessException: No insert possible but primary DB didn't give us a record for 'SecurePoll' in 'content_models", this is from T399633. The one time fix is to have a deployer run INSERT INTO content_models (model_name) VALUES ('SecurePoll')

Only the following wikis are able to run local elections, until they follow the checklist above. The ability of a wiki to create local elections depends on it having a user group with the user right securepoll-create-poll. Feel free to add your wiki here once it's gone through the above process.

  • enwiki
  • fawiki
  • officewiki
  • testwiki
  • votewiki
  • zhwiki


説明文書

セキュアポル(SecurePoll)

SecurePoll(セキュアポル)に関する一般的な説明文書はwikitech:SecurePollをご参照ください。

SecurePoll の改善

SecurePoll 改善の概要はAnti-Harassment Tools/SecurePoll Improvementsをご参照ください。(仮題:嫌がらせ行為対策ツール/セキュアポル改善)

STV 集計結果を理解する

STV 集計結果に関する解説文書はAnti-Harassment Tools/SecurePoll Improvements/Understanding the STV resultをご参照ください。(仮題:嫌がらせ行為対策ツール/セキュアポルの改善/STV集計結果を理解する)

See also

この拡張機能は 1 つ以上のウィキメディアのプロジェクトで使用されています。 これはおそらく、この拡張機能が安定していて高いトラフィックのウェブサイトでも十分に動作することを意味します。 この拡張機能がインストールされている場所を確認するには、ウィキメディアの設定ファイル CommonSettings.php および InitialiseSettings.php 内で、この拡張機能の名前を探してください。 特定のウィキにインストールされている拡張機能の完全な一覧は、そのウィキの Special:Version ページにあります。
この拡張機能は以下のウィキ ファーム/ウィキ ホスト/パッケージに含まれています:

AltStyle によって変換されたページ (->オリジナル) /