admin管理员组文章数量:1323744
I created a plugin, and used the add_admin_menu() to add some page for users to put their Api keys and secret word. My page content is just a form to collect those data the users puts in, now my question is apart from sending data to database as to always retrieve them there, is there another place i can store those keys and secret word?
I created a plugin, and used the add_admin_menu() to add some page for users to put their Api keys and secret word. My page content is just a form to collect those data the users puts in, now my question is apart from sending data to database as to always retrieve them there, is there another place i can store those keys and secret word?
Share Improve this question asked Sep 15, 2020 at 11:39 chrischris 34 bronze badges1 Answer
Reset to default 0Not really, if you want it to be updatable via a form then the only alternatives are these which I do not recommend:
- Files, very bad for security, easily stolen
- Object Cache, while rarely done and esoteric by most peoples standards, if you have an object cache installed such as memcached or redis, and an object drop-in, you could use this. However, this is somewhat ephemeral, and not fully persistent, as well as requiring the installation of server software. This also runs the risk of the user using a caching plugin that caches to the disk, posing a security risk
- Secure vaults, requires the set up and configuration of additional software on the server, e.g. https://www.vaultproject.io/, as well as a client library. Additionally you might need to store authentication details which lands you back where you started. Few users will be able to use this
I would store it in the database. If the app key and secret are stolen they can be revoked, and a new key/secret saved.
For completeness, there are 2 other alternatives that cannot be updated or set via the browser, both require server level access however to change and set, providing greater security:
wp-config.php
constants, e.g.define( 'CHRIS_PLUGIN_APP_KEY','XXXXXX' );
, this has greater security but can be difficult for users to set- Environment variables, define them at the system level not the WordPress level,
$_ENV['CHRIS_APP_KEY']
, this is potentially the most secure option
Neither of those options can be changed from WordPress however.
Warning: Some people might take this as a cue to try and modify wp-config.php
in code, this is extremely bad practice and can easily kill a website, a lot of hosts prevent modifications to that file, and users can place wp-config.php
in strange places or do odd things with it.
本文标签: databaseAny other way of storing plugin admin data setting
版权声明:本文标题:database - Any other way of storing plugin admin data setting 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742118238a2421570.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论