4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[Heroku] Herokuがpassword変えてって言ってたので対応したら、API keyが無効になった

Last updated at Posted at 2022-05-04

概要

Heroku security notification - resetting user account passwords on May 4, 2022と書かれたメールが届いたので、対応しましたよ。

ところがその対応によりHeorkuのAPI keyが無効になる問題が起きたので、追対応しました、というお話です。

私はプライベートでしか使っていないのですが、まさか業務で本番環境で使っていたりしたらかなりヤバイ話なので、誰かの役に立てればと思います。。。: (´ºωº`):

メール本文

日本時間で、2022/05/04 9:11 にメールが届いていた。

image.png

As part of our efforts to enhance our security and in response to an incident published on status.heroku.com, we wanted to inform you that we will begin resetting user account passwords on May 4, 2022. We recommend that you reset your user account password in advance here and follow the best practices below:

Minimum of 16 characters
Minimum complexity of 3 out of 4: Uppercase, Lowercase, Numeric, Symbol
Don't just add a letter or a 1 digit number to the existing password while changing
Passwords may not be duplicated across accounts
If you do not reset your password and your user account password is reset by Heroku on May 4, 2022, your existing password will no longer work. To log in to Heroku, you must reset your password by accessing the Heroku login page and clicking the "Forgot your password?" link . Please be aware that you may be required to reset your passwords again in the future.

NOTE: A password reset will also invalidate your API access tokens. As a result, any automations you’ve built to integrate with the Heroku Platform API that use these tokens may result in 403 forbidden errors . To avoid downtime you will need to re-enable direct authorizations by following the instructions here and update your integrations to use your newly generated token.

As an added precaution, we strongly recommend enabling Multi-Factor Authentication (MFA) by following the guidance in the MFA article in the Heroku Dev Center. To ensure you have a backup to your primary MFA verification method, we also suggest setting up recovery codes.

We sincerely regret any inconvenience you may have experienced because of this issue and appreciate your trust in us as we continue to make your success our top priority. Please continue to visit status.heroku.com for the latest updates.

If you used your previous password on any other sites, we highly recommend you also change your password on those sites. If you have any questions or require assistance, please open a case with Heroku Support. A reminder message will be sent on May 4, 2022.

Thank you,

Salesforce

経緯

実は先日、Herokuから認証情報が洩れてGithubでなんか悪用されてる的な情報が、HerokuとGithubから届いておりました。

Herokuのエンジニアの方々が色々調査をされたようなのですが、その流れで本日、上記の通り「前もってパスワード変えてくれると嬉しいです」というメールが届きました。

該当箇所はここ↓

we wanted to inform you that we will begin resetting user account passwords on May 4, 2022. We recommend that you reset your user account password in advance here and follow the best practices below:

(以下、直訳)
私たちは、2022年5月4日にあなたのアカウントのパスワードを変更するつもりだと連絡したいと思っていました。
以下に示すベストプラクティスに従って、前もってパスワードを変えることをお勧めします。

影響

パスワードを変えてみたところ、コマンドからの heroku login ができなくなってました/(^o^)\

$ heroku login -i
heroku: Enter your login credentials
Email [hoge@hogemail.com]:                                
Password: **********************
 ›   Error: Your account has MFA enabled; API requests using basic authentication with email and password are not supported. Please generate an authorization token for API access. 
 ›
 ›   Error ID: vaas_enrolled

対策1

以下の記事に従って、パスワードの代わりにAPI keyを入力してみる。(失敗するので、急いでいる人は対策2へ進んでください。)

API keyは以下のように確認できる。

2022-05-05_00h35_17.png
2022-05-05_00h35_26.png
2022-05-05_00h35_38.png
2022-05-05_00h35_49.png

Herokuにログインした後、①、②の順にクリックして、下へスクロール、そして③Revealをくりっくすれば、④の位置にAPI keyが表示されます。

これをPasswordの代わりに入力してログインしようとすると...

$ heroku login -i
heroku: Enter your login credentials
Email [hoge@hogemail.com]: 
Password: ************************************
 ›   Error: Invalid credentials provided.
 ›
 ›   Error ID: unauthorized

だめかー(´;ω;`)ブワッ

対策2

実は、パスワードを変えるとAPI keyが無効化されるみたいな話はメールに書いてありました。

NOTE: A password reset will also invalidate your API access tokens. As a result, any automations you’ve built to integrate with the Heroku Platform API that use these tokens may result in 403 forbidden errors . To avoid downtime you will need to re-enable direct authorizations by following the instructions here and update your integrations to use your newly generated token.

素直にAPI keyを再発行します。

2022-05-05_00h43_45.png
2022-05-05_00h44_10.png

⑤、⑥の順にクリック。

⑥のとき「API key作り直すと、危ないよ」というメッセージが出るけど、既にAPI key死んでるから(´^ω^`)

ここで作り直したAPI keyを入力したら、ログインできました( ˙꒳˙ \三/ ˙꒳˙)/

$ heroku login -i
heroku: Enter your login credentials
Email [hoge@hogemail.com]: 
Password: ************************************
Logged in as hoge@hogemail.com

あとがき

対応依頼が来たら、全文隅まで読んでから対応開始(`・ω・´)

ちなみにこのAPI key、CircleCIの自動デプロイで使っていたので、CircleCIに登録していた環境変数も新しいAPI keyに書き換えておきました。
(ただし、CIの動作は未確認です)

4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?