Repository navigation
Commit f2ffb32
committed
Security: Require
Without `WP_SECRETS_KEY`, the default keyring derived its key from `LOGGED_IN_KEY . LOGGED_IN_SALT`. Rotating the salts, which is routine advice, then locked every stored secret. The salts were also read directly rather than through `wp_salt()`, so an unfilled or translated placeholder from `wp-config-sample.php` could become the key.
This removes the fallback. Without a usable `WP_SECRETS_KEY`, every call that needs the key returns `secret_key_unavailable`. A key is not usable when it is empty or only whitespace, when it is the `wp-config-sample.php` placeholder, or when it equals any of the authentication keys and salts.
Site Health reports a missing or unusable key as recommended and shows a newly generated `define()` line to add. It reads the key's state from the new `WP_Secrets_Config_Key_Provider::get_key_status()` instead of parsing the translated key source.
This also introduces `wp_is_secrets_api_available()`, so a caller can check before moving a credential into the Secrets API. It returns `false` when the `secrets.php` drop-in failed to load, when the default keyring has no usable key, or when the key cannot unwrap the stored root key.
A site that stored secrets under the fallback keeps them. They can be read again once `WP_SECRETS_KEY` is set to a new key, `WP_SECRETS_KEY_PREVIOUS` is set to the old `LOGGED_IN_KEY . LOGGED_IN_SALT`, and the root key is re-wrapped with `WP_Secrets_Key_Manager::rotate_site_key()`.
Follow-up to r64337.
Props ericmann, peterwilsoncc, Clorith, dhrupo, wildworks, johnbillion, jorbin, digitalpritam.
See #66187.
git-svn-id: https://develop.svn.wordpress.org/trunk@65385 602fd350-edb4-49c9-b593-d223f7449a82WP_SECRETS_KEY for the Secrets API.1 parent 0747041 commit f2ffb32
8 files changed
Lines changed: 613 additions & 139 deletions
File tree
- src
- wp-admin/includes
- wp-includes
- secrets
- tests/phpunit
- includes
- tests/secrets
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| |||
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
99 | | - | |
| 101 | + | |
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
| |||
108 | 110 | | |
109 | 111 | | |
110 | 112 | | |
111 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
112 | 117 | | |
113 | 118 | | |
114 | | - | |
| 119 | + | |
115 | 120 | | |
116 | 121 | | |
117 | | - | |
118 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
119 | 152 | | |
120 | 153 | | |
121 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
693 | 693 | | |
694 | 694 | | |
695 | 695 | | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
696 | 767 | | |
697 | 768 | | |
698 | 769 | | |
| |||
0 commit comments