userinfo

userinfo (URL)

[35] URL には、利用者名 (username) パスワード (password) を記述できる欄があります。

仕様書

URL 記録

[36] URL記録は、 利用者名 (username) を持ちます。 利用者名を表します。 値は ASCII文字列です。初期値は空文字列です。 >>34

[37] URL記録は、 パスワード (password) を持ちます。 パスワードを表します。 値は ASCII文字列です。初期値は空文字列です。 >>34

[65] URLcredentialsを含む (includes credentials) とは、 利用者名パスワード空文字列ではないことをいいます。 >>64

URL 文字列

構文

[38] 現行仕様である URL StandardURL文字列の構文の定義には、 利用者名パスワードに相当する部分は含まれていません。

[39] つまり、著者URL文字列を記述する時に利用者名パスワードを含めてはならないとされています。

[40] ただし URL構文解析器の処理の一部には組み込まれていますから、 Webブラウザーその他の URL を受け取るプログラムは、 利用者名パスワードも扱えなければなりません。

[43] 過去の URL 仕様では、 URL文字列authority 部分 (URL scheme:// の後に続く部分)@ が含まれる場合、それより後はホストとポートであり、 それより前は userinfo と呼ばれていました。

[44] userinfo は、 : が含まれていればそれより前が利用者名で後がパスワード、 含まれなければ全体が利用者名とされていました。

[45] 利用者名パスワードは、 それぞれ0個以上URL単位群の列とされていました。

[48] 利用者名パスワードは、空文字列とすることもできます。 しかし空文字列は既定値ですから、無指定の場合と区別できません。


[41] これは利用者名パスワードURL に含めるのはセキュリティー上好ましくないという近年の流れに沿った制限だと思われます。

[42] しかし Unix 系環境で動作するプログラム環境変数URL を指定する場合、 Webアプリケーションでアクセス先の URL (Web Hooks など) を指定する場合、 プロキシを指定する場合、 データベースのURLを指定する場合のように、 利用者名パスワードが大いに活用されている場面もあり、 それらがすべて無くなるとも思えません。むしろ、 userinfo を禁止することにより pathquery に埋め込んで回避しようとする動きが出る方が危険が多様化して好ましくないと感じますが...

構文解析

[46] URLの構文解析では、利用者名パスワードの一部とみなされる部分を、 userinfo符号化集合を使ってUTF-8パーセント符号化します。 >>53

[47] つまり、非ASCII文字と多くの記号は、パーセント符号化されて URL記録利用者名パスワードとなります。

文字コード

[27] URL文字列非ASCII文字が含まれる場合、URLの構文解析の時点で UTF-8パーセント符号化されます (>>46)。つまり UTF-8 として扱われます。

[49] URL文字列パーセント符号化が含まれる場合、 URL の他の部分の場合と同様、元の文字コードは特に規定されていません。 つまりどの文字コードか分かりませんし、そもそも文字列であるかも保証されません。

[50] 利用者名パスワードパーセント符号化復号した後どのように解釈するべきかは、 現行のどの仕様書でも明文化されていないと思われます。

[51] Webブラウザーは、 http:https:利用者名パスワードが含まれる時、 パーセント復号して何らかの文字コード復号して、 HTTP認証に使っているものと思われます。

[52] HTTP認証でどのような文字コード符号化して送信するべきかの問題もあります。 基本認証ダイジェスト認証も参照。

API

[67] URL インターフェイスusername IDL属性取得器は、 次のようにしなければなりません >>66

  1. [68] 文脈オブジェクトURL利用者名を返します。

[69] 同じく設定器は、次のようにしなければなりません >>66

  1. [81] 新しい値を、新しい値を USVString と解釈した結果に設定します。
  2. [70] 文脈オブジェクトURLcannot have a username/password/portなら、
    1. [71] ここで停止します。
  3. [72] 文脈オブジェクトURL新しい値について、利用者名の設定をします。

[73] URL インターフェイスpassword IDL属性取得器は、 次のようにしなければなりません >>66

  1. [74] 文脈オブジェクトURLパスワードを返します。

[75] 同じく設定器は、次のようにしなければなりません >>66

  1. [82] 新しい値を、新しい値を USVString と解釈した結果に設定します。
  2. [76] 文脈オブジェクトcannot have a username/password/portなら、
    1. [77] ここで停止します。
  3. [78] 文脈オブジェクトURL新しい値について、パスワードの設定をします。

[83] HTMLHyperlinkElementUtils インターフェイスusername IDL属性取得器は、 次のようにしなければなりません >>79

  1. [84] 文脈オブジェクトについてURLの再初期化を行います。
  2. [85] 文脈オブジェクトURLnull なら、
    1. [86] 空文字列を返し、ここで停止します。
  3. [87] 文脈オブジェクトURL利用者名を返します。

[88] 同じく設定器は、 CEReactions と共に、 次のようにしなければなりません >>79

  1. [90] 新しい値を、新しい値を USVString と解釈した結果に設定します。
  2. [89] 文脈オブジェクトについてURLの再初期化を行います。
  3. [91] 文脈オブジェクトURLホストnull か、 文脈オブジェクトURLcannot-be-a-base-URL flagなら、
    1. [92] ここで停止します。
  4. [93] 文脈オブジェクトURL新しい値について、利用者名の設定をします。
  5. [94] 文脈オブジェクトについてhrefを更新します。

[95] HTMLHyperlinkElementUtils インターフェイスpassword IDL属性取得器は、 次のようにしなければなりません >>79

  1. [96] 文脈オブジェクトについてURLの再初期化を行います。
  2. [97] 文脈オブジェクトURLnull なら、
    1. [98] 空文字列を返し、ここで停止します。
  3. [99] 文脈オブジェクトURLパスワードを返します。

[100] 同じく設定器は、CEReactions と共に、 次のようにしなければなりません >>79

  1. [101] 新しい値を、新しい値を USVString と解釈した結果に設定します。
  2. [102] 文脈オブジェクトについてURLの再初期化を行います。
  3. [103] 文脈オブジェクトURLホストnull か、 文脈オブジェクトURLcannot-be-a-base-URL flagなら、
    1. [104] ここで停止します。
  4. [105] 文脈オブジェクトURL新しい値について、パスワードの設定をします。
  5. [106] 文脈オブジェクトについてhrefを更新します。
[80] Location インターフェイスには usernamepassword はありません。

[54] URL記録利用者名利用者名の設定 (set the username) は、次のようにします >>53

  1. [55] URL記録利用者名を、空文字列に設定します。
  2. [56] 利用者名の各符号位置符号位置について、
    1. [57] 符号位置userinfo符号化集合によるUTF-8パーセント符号化を適用した結果を、 URL記録利用者名の末尾に追加します。
[62] 他に、 fetch から呼び出されます。

[58] URL記録パスワードパスワードの設定 (set the password) は、次のようにします >>53

  1. [59] URL記録パスワードを、空文字列に設定します。
  2. [60] パスワードの各符号位置符号位置について、
    1. [61] 符号位置userinfo符号化集合によるUTF-8パーセント符号化を適用した結果を、 URL記録パスワードの末尾に追加します。
[63] 他に、 fetch から呼び出されます。

各 URL scheme における用法

利用者名と合言葉

利用者名 (合言葉も使えるのか不明)

暗号鍵

ハッシュ値

[125] ハッシュ値userinfo として使う例

その他のプロトコル上の識別子

userinfo 符号化集合

仕様書

文字の一覧

文脈

[33] URLの構文解析で使われます。 userinfo が含まれる入力の場合や、 URL利用者名合言葉を設定する時に参照されます。

歴史

[11] Issue 82250 - chromium - HTTP username:password stripped out from links - An open-source browser project to help move the web forward. - Google Project Hosting ( 版) http://code.google.com/p/chromium/issues/detail?id=82250

[12] Masato Kinugawa Security Blog: CVE-2012-0678: Safariのfeed:// URLのUXSS ( ( 版)) http://masatokinugawa.l0.cm/2012/11/safari-feed-url-uxss.html

[13] Factor out set the username and password algorithms for use by XMLHttpRe... · 4e2f350 · whatwg/url ( ( 版)) https://github.com/whatwg/url/commit/4e2f35062170f11924a35f06abb5e2fb014e48c6

[14] Use the set the username/password algorithms · d699900 · whatwg/fetch ( ( 版)) https://github.com/whatwg/fetch/commit/d699900add11588f35a1d6c74987f288f975f103

[15] Throw if URL includes credentials. Fixes #26. Also more HTTPS. · whatwg/fetch@32ab411 ( 版) https://github.com/whatwg/fetch/commit/32ab4119f9aa5d280507d6201b0784cfe5669106

[16] 479038 – Should the suspicious-auth warning apply to all loads? Should URI userinfo be banned? ( 版) https://bugzilla.mozilla.org/show_bug.cgi?id=479038

[17] Internet Explorer does not support user names and passwords in Web site addresses (HTTP or HTTPS URLs) ( 版) https://support.microsoft.com/en-us/kb/834489

[18] Copy username/password for relative URLs · whatwg/url@06b2e68 ( 版) https://github.com/whatwg/url/commit/06b2e6895dff2e6efaeba65f4eb1bc27ecc21581

[19] Encode { and } in username/password/path to fix #16. Also acknowledge… · whatwg/url@c296e2f ( 版) https://github.com/whatwg/url/commit/c296e2f8519a1d6614d664708d368a342682c9a1

[20] Make it non-conforming to place a username and/or password in a URL. … · whatwg/url@e0c721b ( 版) https://github.com/whatwg/url/commit/e0c721b680d0977013ef2a14ba578388c01bd331

[21] Use the username and password encode sets within authority state. Fix… · whatwg/url@7876306 ( 版) https://github.com/whatwg/url/commit/78763066648b921c51b0920493c67fc166c3e6f3

[22] Bug 26340 – Ignoring username and password from the base URL? ( 版) https://www.w3.org/Bugs/Public/show_bug.cgi?id=26340#c2

[23] URL scheme sequelpro:// Usage | Sequel Pro ( 版) http://www.sequelpro.com/docs/URL_Scheme

sequelpro://$SP_PROCESS_ID@chooseItemFromList/item1/item2/…

[24] Encode more code points for usernames and passwords. Fixes #30. · whatwg/url@9ca26e5 ( 版) https://github.com/whatwg/url/commit/9ca26e5b0edc131f9cca81d0fef4ab92815bc289

[25] Use "include credentials" from the URL Standard rather than copying i… · whatwg/fetch@2c68504 ( 版) https://github.com/whatwg/fetch/commit/2c68504a5ea6c6742212a31dc357ceab12862296

[26] GNU Wget 1.16.2 Manual ( 版) http://www.gnu.org/software/wget/manual/wget.html

Some proxy servers require authorization to enable you to use them. The authorization consists of username and password, which must be sent by Wget. As with HTTP authorization, several authentication schemes exist. For proxy authorization only the Basic authentication scheme is currently implemented.

You may specify your username and password either through the proxy URL or through the command-line options. Assuming that the company’s proxy is located at ‘proxy.company.com’ at port 8001, a proxy URL location containing authorization data might look like this:

http://hniksic:mypassword@proxy.company.com:8001/

[28] Fix #44: replace "relative flag" with non-null host check · whatwg/xhr@fabeb1a ( 版) https://github.com/whatwg/xhr/commit/fabeb1a5de040041e213ccd68c63a0d694c2879b

[29] Internet Explorer では Web サイト アドレス (HTTP URL および HTTPS URL) に含まれるユーザー名およびパスワードがサポートされない ( 版) https://support.microsoft.com/ja-jp/kb/834489

Internet Explorer 3.0 ~ 6.0 では HTTP URL および HTTPS URL で次の構文がサポートされています。

http(s)://username:password@server/resource.ext

この URL 構文を使用すると、基本認証方式をサポートする Web サイトにユーザー情報が自動的に送信されます。

この資料の「背景情報」に記載されている問題を抑制するため、Internet Explorer およびエクスプローラーでは、この形式の HTTP URL および HTTPS URL の処理をサポートしないようになりました。エクスプローラーおよび Internet Explorer では、ユーザー情報を含む URL を使用して HTTP サイトまたは HTTPS サイトを開くことはできません。ユーザー情報が HTTP URL または HTTPS URL に含まれている場合、既定で次のタイトルの Web ページが表示されます。

無効な構文エラー

注: この既定の動作の変更は、他のプロトコルには影響を与えません。たとえば、セキュリティ更新プログラム 832894 をインストールした後でも、FTP URL にはユーザー情報を含めることができます。

この既定の動作の変更は、セキュリティ更新プログラム 832894 のリリース以降にリリースされたセキュリティ更新プログラム、Service Pack、および Internet Explorer の各バージョンでも実装されています。

[32] Connection String URI Format — MongoDB Manual 3.2 () https://docs.mongodb.com/manual/reference/connection-string/

The following connects to a replica set with two members, one on db1.example.net and the other on db2.example.net:

mongodb://db1.example.net,db2.example.com

[107] No need for null passwords (annevk著, ) https://github.com/whatwg/url/commit/5e0b05e95a81fdd539c7b1bf97e69b3df701384f

[108] Editorial: stop referring to a password alone as credentials (annevk著, ) https://github.com/whatwg/url/commit/240e61d45023b6742d35ac18f14560fcc2ab4bfe

[109] Align <a>/<area>.password with the URL Standard (annevk著, ) https://github.com/whatwg/html/commit/165aeecfb1818912219afc50dd2dd1c6ec935ae2

[110] Intent to deprecate: Legacy subresource requests. - Google グループ (2014/11/21 ) https://groups.google.com/a/chromium.org/forum/#!topic/net-dev/bAMVnc1Zyvs

I'd like to block two kinds of subresource requests from webby documents:

1. Subresources with an "legacy" scheme (e.g. "ftp://my-awesome-ftp-server.com/yay.tiff")

2. Subresources with credentials (e.g. "http://ima_user:hunter2@example.com/yay.tiff").

[111] A file URL cannot have credentials (annevk著, ) https://github.com/whatwg/url/commit/9b2eb10eb8436adaf6620b1864b25442152f205b

[112] Editorial: use specific names for encode sets (annevk著, ) https://github.com/whatwg/url/commit/1d69a774bab856651e0d792e825a976056aeaf59

[113] URL外形監視をおこなう - Mackerel ヘルプ ( ()) https://mackerel.io/ja/docs/entry/external-monitoring

Basic認証を利用しているURLを監視したい場合は"user:password@監視先URL"としてください

[114] Webhookにアラートを通知する - Mackerel ヘルプ ( ()) https://mackerel.io/ja/docs/entry/howto/alerts/webhook

ベーシック認証を設定しURLに認証情報を含める

https://user:p4ssw0rd@example.com のような形式

[115] BASIC 認証 のかかったサーバへの Web フックを利用したい – Customer Feedback for Backlog ( ()) http://feedback.backlog.jp/forums/140671-backlog-%E3%81%B8%E3%81%AE%E8%A6%81%E6%9C%9B-%E5%95%8F%E9%A1%8C%E3%81%AE%E5%A0%B1%E5%91%8A/suggestions/5486977-basic-%E8%AA%8D%E8%A8%BC-%E3%81%AE%E3%81%8B%E3%81%8B%E3%81%A3%E3%81%9F%E3%82%B5%E3%83%BC%E3%83%90%E3%81%B8%E3%81%AE-web-%E3%83%95%E3%83%83%E3%82%AF%E3%82%92%E5%88%A9%E7%94%A8%E3%81%97%E3%81%9F%E3%81%84

Basic認証のかかったサーバへも、userinfo を URL に含むことによって Web フックを送信できるように対応しました。

[116] Configure webhooks on Azure metric alerts | Microsoft Docs ( (kamathashwin著, )) https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/insights-webhooks-alerts

Password-based authorization - The webhook URI is saved with a username and password, eg. https://userid:password@mysamplealert/webcallback?someparamater=somevalue&foo=bar

[117] HTTP basic auth for webhooks · Issue #1925 · couchbase/sync_gateway ( ()) https://github.com/couchbase/sync_gateway/issues/1925

While it's already possible to include basic auth credentials directly in the webhook URL (e.g. http://username:password@example.com/foobar), the URL and credentials are written to the Sync Gateway log every time a webhook event is issued. This makes it less than ideal because, in general, secrets should not appear in logs.

[118] [JRA-31953] Not being able to create webhooks with basic authentication. - Atlassian JIRA ( ()) https://jira.atlassian.com/browse/JRA-31953

For Atlassian applications, the REST plugin : https://developer.atlassian.com/display/DOCS/REST+and+os_authType allows you to apend the authentication type to the URL. This can be adapted as a workaround. When I add the os_oauthtype to the URL, it works:

http://localhost:10520/bamboo52/rest/api/latest/server/pause?os_authtype=basic&os_username=admin&os_password=admin

Note: While this workaround works, it's not great because applications frequently log URLs (for example, Apache can be configured that way) and this means that the password will be leaked, which is not desirable.

[119] Datadog-Webhooks Integration ( ()) http://docs.datadoghq.com/ja/integrations/webhooks/

webhookの認証を必要とするサービスと連携するには、HTTPのベーシック認証を使い、登録するURLの部分を次のように書き換えて下さい。

https://my.service.com —> https://username:password@my.service.com

[120] Event Webhook - SendGrid Documentation | SendGrid ( (SendGrid著, )) https://sendgrid.com/docs/API_Reference/Webhooks/event.html

We support basic HTTP authentication in our Event Webhook. Those who wish to implement can provide credentials in the post event url field on the app settings page. Below is an example of the post url with authentication included.

http(s)://username:password@domain/foo.php

[121] Webhooks overview | Postmark Developer Documentation ( (Wildbit, LLC著, )) http://developer.postmarkapp.com/developer-webhooks-overview.html

You can configure your webhook URL with basic HTTP authentication by adding the user name and password to the URL https://example.com/webhook in the following format and setting the result as the webhook URL:

https://<username>:<password>@example.com/webhook

[122] Webhook | Typetalk | Nulab Developers ( ()) https://developer.nulab-inc.com/ja/docs/typetalk/webhook

トピック編集ページから、bot (任意) という ID でボットを作成し、Webhook URL を設定してください。Basic 認証もサポートしています。(例: http://user:password@example.com/)

[123] Session URL :: WinSCP ( ()) https://winscp.net/eng/docs/session_url

sftp|ftp|ftps|ftpes|http|https|scp :// [ <username> [ : <password> ] [ ; <fingerprint> ] @ ] <host> [ : <port> ] /

[124] draft-ietf-secsh-scp-sftp-ssh-uri-04 - Uniform Resource Identifier (URI) Scheme for Secure File Transfer Protocol (SFTP) and Secure Shell (SSH) ( ()) https://tools.ietf.org/html/draft-ietf-secsh-scp-sftp-ssh-uri-04

[126] Fixed parse_userinfo breaking with complex passwords by Thomspoon · Pull Request #293 · servo/rust-url () https://github.com/servo/rust-url/pull/293

[127] 504300 - Disallow requests with basic auth credentials in URL - chromium - Monorail () https://bugs.chromium.org/p/chromium/issues/detail?id=504300

[128] 707761 - Name and Password in XMLHttpRequest.open no longer work - chromium - Monorail () https://bugs.chromium.org/p/chromium/issues/detail?id=707761

[129] 708131 - Removal of username/password support in XHR breaks remote control functionality - chromium - Monorail () https://bugs.chromium.org/p/chromium/issues/detail?id=708131

[130] XMLHttpRequest: align username/password test with the standard by annevk · Pull Request #10419 · w3c/web-platform-tests () https://github.com/w3c/web-platform-tests/pull/10419

[131] Restructure URL rendering section and add additional guidance (estark37著, ) https://github.com/whatwg/url/commit/8809598ddfd1d935432c8a0cad53f13d70e24bc6

[132] curl - How To Use (, ) https://curl.haxx.se/docs/manpage.html#--disallow-username-in-url

[133] GNU Wget 1.20 Manual () https://www.gnu.org/software/wget/manual/wget.html#index-URL-syntax

[134] Git - 認証情報の保存 () https://git-scm.com/book/ja/v2/Git-%E3%81%AE%E3%81%95%E3%81%BE%E3%81%96%E3%81%BE%E3%81%AA%E3%83%84%E3%83%BC%E3%83%AB-%E8%AA%8D%E8%A8%BC%E6%83%85%E5%A0%B1%E3%81%AE%E4%BF%9D%E5%AD%98

この例での ~/git.store は以下のようになっています。

https://bob:s3cre7@mygithost

中身は認証情報つきの URL がずらずらと続く形になっています。