Add a check that recommends the WordPress 7.2 Secrets API for all stored credentials
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start by reading the Plugin Check rules that inspect calls such as update_option() and register_setting(), then check how existing security warnings are registered and tested. The issue specifies credential patterns, APIs to detect, and false-positive cases, but the detection scope spans option names, stored values, custom transformations, fallback handling, and cross-call suppression. Done means the warning identifies credential storage outside the Secrets API while honoring the listed exceptions.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
WordPress 7.2 adds a core Secrets API (Trac #66187, committed in r64337) that gives plugins a standard way to store credentials encrypted at rest. Today plugins store API keys, tokens and passwords with update_option(), either in plain text or encrypted, encoded or hashed with their own implementation. Plain text is readable in database dumps, backups and SQL-read vulnerabilities. Custom encryption varies widely in quality, often keeps the key next to the data, and can't benefit from key rotation or external storage providers.
I'd like to propose a Plugin Check rule that reports any credential storage not done through the Secrets API, whether plain text or custom encryption, and asks plugin authors to switch, so that plugins converge on one audited approach.
cc @ericmann as the author of the Secrets API, for input on the recommended usage and messaging.
Proposal: https://make.wordpress.org/core/2026/08/25/proposal-a-secrets-api-for-wordpress-7-2/
Proposed check
- Name:
credential_storage(open to suggestions) - Category:
security(possibly alsoplugin_repo) - Type: WARNING
It should be a warning rather than an error because plugins still need a fallback for sites running WordPress < 7.2 and sites without WP_SECRETS_KEY defined.
What to detect
Flag calls to update_option(), add_option(), update_site_option(), add_site_option() and register_setting() where the option name (or a known array key in the stored value) matches a credential pattern, for example:
*api_key*,*apikey*,*api_secret**secret*,*client_secret**token*,*access_token*,*refresh_token**password*,*passwd*,*pwd**private_key*,*license_key*(maybe)
This applies regardless of whether the value is stored as-is or first passed through custom encryption, encoding or hashing (e.g. openssl_encrypt(), sodium_crypto_*(), base64_encode(), wp_hash_password()).
Suggested message
The option "%s" appears to store a credential outside the Secrets API. Since WordPress 7.2, use wp_set_secret() / wp_get_secret() so the value is encrypted at rest with core's key management and rotation, instead of plain text or custom encryption. Feature-detect with function_exists( 'wp_set_secret' ) and keep your current storage only as a fallback for older WordPress versions.
Reducing false positives
- Skip the warning if the plugin stores the same credential through
wp_set_secret()orwp_import_option_as_secret()and only uses the option as a fallback. - Ignore obvious non-secret names such as
*_token_expires,*_api_key_setor*_key_valid. - If a plugin's
Requires at leastis 7.2 or higher, the message could drop the fallback advice.
- Ngôn ngữ chính
- PHP
- Star
- 365
- Fork
- 135
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 20
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của WordPress/plugin-check
-
False positive trademarked_term warning for "wc" inside the word "Flowchart"Có thể đã có người làm @anandrajaram21 đã nhận 3 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
WordPress/plugin-check#1556 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add opt-in .distignore exclusions for local and CI scansCó thể đã có người làm @jakaria-istauk đã nhận 1 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
WordPress/plugin-check#1559 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
WordPress/plugin-check#1557 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
WordPress/plugin-check#1555 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
PHPErrorReportingSniff flags debug constants used as values in const declarationsCó thể đã có người làm @elphizu đã nhận 7 ngày trước. Đang mở
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 35/100
WordPress/plugin-check#1553 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của WordPress/plugin-check
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ExpressionEngine/ExpressionEngine#5493 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
"Attempt to read property 'username' on null" error after a user is deletedCó thể đã có người làm @dicksonlaw583 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
omeka/plugin-SimplePages#49 ·
-
Bug Status: Needs Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
quantum-php/project#222 ·
-
support
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày