Skip to content

Commit e4c9726

Browse files
committed
Add a few more plugins that blocks XML-RPC
1 parent b68e345 commit e4c9726

1 file changed

Lines changed: 43 additions & 5 deletions

File tree

wp_api/src/login.rs

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::{
22
JsonValue, login::url_discovery::is_local_dev_environment_url, parsed_url::ParsedUrl,
3-
uuid::WpUuid,
3+
plugins::PluginSlug, uuid::WpUuid,
44
};
55
use serde::{Deserialize, Serialize};
66
use std::{collections::HashMap, str, sync::Arc};
@@ -207,8 +207,10 @@ impl WpApiDetails {
207207
pub struct KnownAuthenticationBlockingPlugin {
208208
/// The name of the plugin.
209209
pub name: String,
210+
/// The plugin's slug. For example: "wordfence/wordfence"
211+
pub slug: PluginSlug,
210212
/// The plugin's REST API namespace.
211-
pub namespace: String,
213+
pub namespace: Option<String>,
212214
/// A URL to the plugin's support page, where users can find help.
213215
pub support_url: String,
214216
}
@@ -218,34 +220,70 @@ impl KnownAuthenticationBlockingPlugin {
218220
vec![
219221
Self {
220222
name: "Wordfence".to_string(),
221-
namespace: "wordfence/v1".to_string(),
223+
slug: PluginSlug::from("wordfence/wordfence"),
224+
namespace: Some("wordfence/v1".to_string()),
222225
// TODO: Ensure this is correct with the WordFence folks
223226
support_url: "https://www.wordfence.com/support/".to_string(),
224227
},
225228
Self {
226229
name: "Hostinger Tools".to_string(),
227-
namespace: "hostinger-tools-plugin/v1".to_string(),
230+
slug: PluginSlug::from("hostinger-tools/hostinger-tools"),
231+
namespace: Some("hostinger-tools-plugin/v1".to_string()),
228232
// TODO: Ensure this is correct with the Hostinger folks
229233
support_url: "https://wordpress.org/support/plugin/hostinger/".to_string(),
230234
},
231235
Self {
232236
name: "FluentAuth".to_string(),
233-
namespace: "fluent-auth".to_string(),
237+
slug: PluginSlug::from("fluent-security/fluent-security"),
238+
namespace: Some("fluent-auth".to_string()),
234239
// TODO: Ensure this is correct with the FluentAuth folks
235240
support_url: "https://wordpress.org/support/plugin/fluent-security/".to_string(),
236241
},
242+
Self {
243+
name: "Disable XML-RPC".to_string(),
244+
slug: PluginSlug::from("disable-xml-rpc/disable-xml-rpc"),
245+
namespace: None,
246+
support_url: "https://wordpress.org/plugins/disable-xml-rpc/".to_string(),
247+
},
248+
Self {
249+
name: "Disable XML-RPC-API".to_string(),
250+
slug: PluginSlug::from("disable-xml-rpc-api/disable-xml-rpc-api"),
251+
namespace: None,
252+
support_url: "https://wordpress.org/plugins/disable-xml-rpc-api/".to_string(),
253+
},
254+
Self {
255+
name: "Loginizer".to_string(),
256+
slug: PluginSlug::from("loginizer/loginizer"),
257+
namespace: None,
258+
support_url: "https://wordpress.org/support/plugin/loginizer/".to_string(),
259+
},
260+
Self {
261+
name: "Really Simple Security".to_string(),
262+
slug: PluginSlug::from("really-simple-ssl/rlrsssl-really-simple-ssl"),
263+
namespace: None,
264+
support_url: "https://wordpress.org/support/plugin/really-simple-ssl/".to_string(),
265+
},
237266
]
238267
}
239268

240269
fn application_passwords() -> Vec<Self> {
270+
let names = ["Wordfence", "Hostinger Tools", "FluentAuth"];
241271
Self::all()
272+
.into_iter()
273+
.filter(|plugin| names.contains(&plugin.name.as_str()))
274+
.collect()
242275
}
243276

244277
fn xmlrpc() -> Vec<Self> {
245278
Self::all()
246279
}
247280
}
248281

282+
#[uniffi::export]
283+
fn xmlrpc_blocking_plugins() -> Vec<KnownAuthenticationBlockingPlugin> {
284+
KnownAuthenticationBlockingPlugin::xmlrpc()
285+
}
286+
249287
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
250288
#[serde(untagged)]
251289
pub enum WpRestApiAuthenticationScheme {

0 commit comments

Comments
 (0)