mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-15 10:09:59 +00:00
Fix running fwupdtool security with a plugin allowlist
A number of plugins make assumptions that ->init() was called, but when an allowlist is used this won't have been called.
This commit is contained in:
parent
b8be6daf1f
commit
fb701a0426
@ -46,7 +46,7 @@ fu_plugin_iommu_add_security_attrs(FuPlugin *plugin, FuSecurityAttrs *attrs)
|
|||||||
fwupd_security_attr_set_plugin(attr, fu_plugin_get_name(plugin));
|
fwupd_security_attr_set_plugin(attr, fu_plugin_get_name(plugin));
|
||||||
fu_security_attrs_append(attrs, attr);
|
fu_security_attrs_append(attrs, attr);
|
||||||
|
|
||||||
if (!priv->has_iommu) {
|
if (priv == NULL || !priv->has_iommu) {
|
||||||
fwupd_security_attr_set_result(attr, FWUPD_SECURITY_ATTR_RESULT_NOT_FOUND);
|
fwupd_security_attr_set_result(attr, FWUPD_SECURITY_ATTR_RESULT_NOT_FOUND);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ fu_plugin_linux_lockdown_add_security_attrs(FuPlugin *plugin, FuSecurityAttrs *a
|
|||||||
fwupd_security_attr_add_flag(attr, FWUPD_SECURITY_ATTR_FLAG_RUNTIME_ISSUE);
|
fwupd_security_attr_add_flag(attr, FWUPD_SECURITY_ATTR_FLAG_RUNTIME_ISSUE);
|
||||||
fu_security_attrs_append(attrs, attr);
|
fu_security_attrs_append(attrs, attr);
|
||||||
|
|
||||||
if (priv->lockdown == FU_PLUGIN_LINUX_LOCKDOWN_UNKNOWN) {
|
if (priv == NULL || priv->lockdown == FU_PLUGIN_LINUX_LOCKDOWN_UNKNOWN) {
|
||||||
fwupd_security_attr_add_flag(attr, FWUPD_SECURITY_ATTR_FLAG_MISSING_DATA);
|
fwupd_security_attr_add_flag(attr, FWUPD_SECURITY_ATTR_FLAG_MISSING_DATA);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ fu_plugin_linux_swap_add_security_attrs(FuPlugin *plugin, FuSecurityAttrs *attrs
|
|||||||
g_autoptr(FwupdSecurityAttr) attr = NULL;
|
g_autoptr(FwupdSecurityAttr) attr = NULL;
|
||||||
g_autoptr(GError) error_local = NULL;
|
g_autoptr(GError) error_local = NULL;
|
||||||
|
|
||||||
if (priv->file == NULL)
|
if (priv == NULL || priv->file == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* create attr */
|
/* create attr */
|
||||||
|
@ -78,6 +78,11 @@ fu_plugin_linux_tainted_add_security_attrs(FuPlugin *plugin, FuSecurityAttrs *at
|
|||||||
fwupd_security_attr_add_flag(attr, FWUPD_SECURITY_ATTR_FLAG_RUNTIME_ISSUE);
|
fwupd_security_attr_add_flag(attr, FWUPD_SECURITY_ATTR_FLAG_RUNTIME_ISSUE);
|
||||||
fu_security_attrs_append(attrs, attr);
|
fu_security_attrs_append(attrs, attr);
|
||||||
|
|
||||||
|
if (priv == NULL) {
|
||||||
|
fwupd_security_attr_add_flag(attr, FWUPD_SECURITY_ATTR_FLAG_MISSING_DATA);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* load file */
|
/* load file */
|
||||||
if (!g_file_load_contents(priv->file, NULL, &buf, &bufsz, NULL, &error_local)) {
|
if (!g_file_load_contents(priv->file, NULL, &buf, &bufsz, NULL, &error_local)) {
|
||||||
g_autofree gchar *fn = g_file_get_path(priv->file);
|
g_autofree gchar *fn = g_file_get_path(priv->file);
|
||||||
|
@ -344,6 +344,11 @@ fu_plugin_add_security_attr_amd_sme_enabled(FuPlugin *plugin, FuSecurityAttrs *a
|
|||||||
fwupd_security_attr_add_guids(attr, fu_device_get_guids(device));
|
fwupd_security_attr_add_guids(attr, fu_device_get_guids(device));
|
||||||
fu_security_attrs_append(attrs, attr);
|
fu_security_attrs_append(attrs, attr);
|
||||||
|
|
||||||
|
if (priv == NULL) {
|
||||||
|
fwupd_security_attr_add_flag(attr, FWUPD_SECURITY_ATTR_FLAG_MISSING_DATA);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* check fields */
|
/* check fields */
|
||||||
if (!priv->amd64_syscfg_supported) {
|
if (!priv->amd64_syscfg_supported) {
|
||||||
fwupd_security_attr_set_result(attr, FWUPD_SECURITY_ATTR_RESULT_NOT_SUPPORTED);
|
fwupd_security_attr_set_result(attr, FWUPD_SECURITY_ATTR_RESULT_NOT_SUPPORTED);
|
||||||
|
@ -179,8 +179,8 @@ fu_plugin_uefi_pk_add_security_attrs(FuPlugin *plugin, FuSecurityAttrs *attrs)
|
|||||||
fwupd_security_attr_add_guids(attr, fu_device_get_guids(msf_device));
|
fwupd_security_attr_add_guids(attr, fu_device_get_guids(msf_device));
|
||||||
fu_security_attrs_append(attrs, attr);
|
fu_security_attrs_append(attrs, attr);
|
||||||
|
|
||||||
/* test key is not secure */
|
/* not enabled or test key is not secure */
|
||||||
if (priv->has_pk_test_key) {
|
if (priv == NULL || priv->has_pk_test_key) {
|
||||||
fwupd_security_attr_set_result(attr, FWUPD_SECURITY_ATTR_RESULT_NOT_VALID);
|
fwupd_security_attr_set_result(attr, FWUPD_SECURITY_ATTR_RESULT_NOT_VALID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user