Commit Graph

643 Commits

Author SHA1 Message Date
Richard Hughes
0415db6f67 Revert "trivial: Use files() rather than current_source_dir()"
This reverts commit b581fa5670 as it breaks
`ninja dist` with `-Dgresource_quirks=enabled`.
2022-09-25 10:31:14 +01:00
Richard Hughes
b581fa5670 trivial: Use files() rather than current_source_dir() 2022-09-24 09:12:14 -05:00
Mario Limonciello
7be0c033a9 trivial: skip self tests for fwupd_client_remotes_func if G_DBUS_ERROR_NAME_HAS_NO_OWNER
Fixes: #5073
2022-09-23 07:52:39 -05:00
Richard Hughes
c73a55faa1 Remove a potential foot-gun when saving config values
If a specific plugin calls fu_plugin_set_secure_config_value() and then
fu_plugin_set_config_value() then we'll save the file with the world-readable
permissions.

Set a plugin flag to say that 'this plugin is storing sensitive details' which
allows us to use the same entrypoint and also fix up any files at startup that
do not have the correct permissions.
2022-09-22 14:47:12 +01:00
Richard Hughes
6bb1b1c81f trivial: Fix a BIOS setting self test value
PVS: The 'ret' variable is assigned but is not used by the end of the function.
2022-09-09 19:23:29 +01:00
Richard Hughes
08a9f02912 Use the correct JSON type for fwupd_bios_setting_from_json()
PVS: Converting type 'gint64' to type 'gboolean' can lead to a loss of high-order bits.
2022-09-09 19:23:29 +01:00
Richard Hughes
b3ead97f46 trivial: Fix a -Wdeprecated-declarations issue
G_APPLICATION_FLAGS_NONE was deprecated, but we don't actually need the single
instance functionality, so just use a non-deprecated flag instead.

This fixes Debian CI.
2022-09-06 18:06:55 +01:00
Mario Limonciello
25789ef2e7 trivial: fwupd-client: prefix some windows error messages 2022-08-30 12:06:16 -05:00
Richard Hughes
c4bdc3ae30 trivial: Fix one -Wunused-variable warning 2022-08-25 11:55:03 +01:00
Richard Hughes
6710f360ec trivial: Fix search-replace typo 2022-08-25 10:09:58 +01:00
Richard Hughes
f970b3de23 Do not show HSI events where we changed the spec result value 2022-08-24 13:49:19 +01:00
Mario Limonciello
9549970285 trivial: bios-settings: shuffle the json output order
We want the name and description to be the first few keys
2022-08-24 07:20:01 -05:00
Mario Limonciello
b7b0ce533d trivial: Unify ambiguity between bios-attrs and bios-settings
These are currently used interchangeably since there was indecisiveness
which to use as the feature was being developed.

As outward facing it will be named with "settings", change all uses
in the code to match this.
2022-08-24 07:20:01 -05:00
Richard Hughes
8b63023aaf Only show *changed* events in the fwupdmgr security output
We do not want to show added or removed HSI tests in this UI.
2022-08-24 13:19:17 +01:00
Mario Limonciello
826983b8a7 Add support to set BIOS settings using a JSON payload
The JSON payload is ideally generated from `fwupdmgr get-bios-settings --json`
with all attributes expected to be included as additional arguments.
2022-08-24 09:51:46 +01:00
Mario Limonciello
2536bf462c Allow running get-bios-settings without root or PK
The only information that is secret is the `current_value`.
Augment the d-bus call to determine whether the caller needs this
information.

* If `fwupdmgr` is launched as root it will be provided.
* If `fwupdmgr` is launched with `--authenticate` it will be requested
  and PK will be engaged.
2022-08-11 09:52:26 -05:00
Mario Limonciello
fa661c595d trivial: map common positive or negative keys to possible enumeration values
Dell and Lenovo use Enable or Enabled and Disable or Disabled which is confusing
to an end user.

Set up some heuristics to map positive values and negative values when passed
into the client.
2022-08-10 10:37:27 -05:00
Mario Limonciello
23b7495cbd trivial: add missing read_only BIOS attribute to GVariant
This fixes read_only attributes being advertised to clients as writable.
2022-08-05 14:08:55 -05:00
Richard Hughes
0beed2f138 Store the current BIOS value in a security attribute
We can't very-well ask the user to 'change it back' if we do not tell
them what it is set to already.
2022-08-01 15:45:43 +01:00
Richard Hughes
934002553a Allow loading BIOS attributes for host emulation 2022-08-01 13:32:12 +01:00
Richard Hughes
77006b75eb Set the target value on the security attribute
Semantically it is the desire of the security attribute, not the bios
attribute, i.e. you could imagine that a specific attribute would have
to be *foo or bar or baz* for HSI-1 and *only foo* for HSI-2

Also make it easier to add possible BIOS attribute target values in
plugin code.
2022-08-01 07:12:18 +01:00
Mario Limonciello
331d7bbd40 trivial: FwupdSecurityAttr: fix a symbol name 2022-07-29 12:41:59 -05:00
Mario Limonciello
8de9027ab4 trivial: remove unnecessary assertion for FwupdBiosAttr 2022-07-29 12:41:58 -05:00
Mario Limonciello
aa1e321f6e Add support for including a FwupdBiosAttr ID in FwupdSecurityAttr
This can allow clients to let users correct problems found on their
systems.
2022-07-29 11:31:50 -05:00
Mario Limonciello
7660222240 Add a unique identifier to all BIOSAttr objects
This identifier can be used by plugins or the daemon to disambiguate
behavior between two different drivers.

Set it up so that plugins don't NEED to use it, but optionally can
find attributes by either name or ID
2022-07-29 11:31:50 -05:00
Mario Limonciello
5ded4f44fe Add support for reading and writing firmware attributes
This support is comprehensive:
 * Client library support
 * Daemon support
 * plugin support
 * Client tool support (with new commands)
2022-07-28 17:30:57 -05:00
Mario Limonciello
17c636686d trivial: libfwupd: move some duplicated code to fwupd-common
Several of the string/integer/time functions are duplicated in multiple
source files for no discernable reason.  Move them into fwupd-common
as private symbols instead.
2022-07-26 20:11:23 +01:00
Richard Hughes
74e9b04b39 trivial: Return a more invalid value if FWUPD_IS_DEVICE() fails
We don't want to return something that's actually the initial value.
2022-07-21 21:27:24 +01:00
Richard Hughes
ac3f7f5521 trivial: Add some checks when adding children and setting the parent 2022-07-21 21:27:24 +01:00
Richard Hughes
62fc515714 Allow loading in emulated host profiles for debugging
This allows us to load sets of different host security attributes
for testing the various front end tools we have now. e.g.

    sudo FWUPD_HOST_EMULATE=thinkpad-p1-iommu.json.gz fwupd

or, using a non-compressed absolute path:

    sudo FWUPD_HOST_EMULATE=/tmp/test/thinkpad-p1-iommu.json fwupd

Data can be created with `./contrib/generate-emulation.py file.json`
and then can be manually modified if required. Running the script on
a file that already exists will just strip out any unneeded data, as
well as piping content into it using stdin.

As a precaution, the org.fwupd.hsi.HostEmulation attribute is added
so we do not ask the user to upload the HSI report. It also allows
the LVFS to ignore any HSI reports with this attribute for clients
that upload HSI reports regardless.

See https://github.com/fwupd/fwupd/discussions/4832
2022-07-18 16:27:59 +01:00
Richard Hughes
7566e56fb5 Add fwupd_device_from_json() for future use 2022-07-18 16:27:59 +01:00
Richard Hughes
62a62f8f0f trivial: Clarify the FwupdRelease::checksum is for the container
In one place we were accidentally setting the contents checksum,
because the LVFS was setting the artifact type of 'binary' for metainfo
export -- which was never going to match on the LVFS.
2022-07-18 16:12:43 +01:00
Richard Hughes
9b9799f9c6 Use the correct protocol member when converting to JSON 2022-07-16 21:43:01 +01:00
Richard Hughes
a5749f4d23 Set the HSI levels in a central place
This means we don't need to worry about changing multiple
implementations if the HSI levels change for a specific ID.

It also means we can fake HSI results in the future without having
to also store the 'correct' level in the input file.
2022-07-15 20:21:22 +01:00
Richard Hughes
7b1204bce0 trivial: Fix outputting the new security attr flags to JSON 2022-07-14 15:43:19 +01:00
Richard Hughes
26e5ecb567 trivial: Add fwupd_security_attr_remove_flag() for future use 2022-07-14 14:48:51 +01:00
Richard Hughes
ae0c3fe38a Add 'action' resolution flags to each FwupdSecurityAttr
We tried to solve this by matching the org.fwupd.hsi AppStream ID, but
in some cases the resolution depends on what actually failed.

Add "the action the user is supposed to do" as flags so that the
front-end can translate this in the appropriate way, for instance,
using a different string for log events and HSI dialogs.
2022-07-14 14:47:44 +01:00
Richard Hughes
1ef23d1006 Add some FwupdSecurityAttr API for future use 2022-07-09 20:58:19 +01:00
Richard Hughes
60a34af164 Upload the report data using the SHA256 hash, falling back to SHA1
The LVFS can match either value.
2022-07-09 14:56:28 +01:00
Richard Hughes
1e6d75a47e Add the HostVendor to the D-Bus interface
This allows us to show it in the same places as the host product.
2022-07-06 16:10:43 +01:00
Richard Hughes
5cf63a0741 trivial: Add some more coverage tests for FwupdRelease 2022-07-01 13:57:18 +01:00
Richard Hughes
5971783634 trivial: Add a missing FwupdDeviceFlags string converter 2022-07-01 13:57:18 +01:00
Richard Hughes
6243e9f62a Add some coverage tests for FwupdRemote 2022-07-01 13:57:18 +01:00
Richard Hughes
358b1e0229 trivial: Add some more tests for FwupdPlugin 2022-07-01 11:25:26 +01:00
Richard Hughes
b1a31dbfae Include the plugin name in the FwupdSecurityAttr GVariant 2022-07-01 10:55:56 +01:00
Richard Hughes
92107e55cd trivial: Allow the device-id property to be set on a FwupdRequest 2022-07-01 10:55:56 +01:00
Richard Hughes
2dc029aa6a Fix setting the device ID on the FwupdRequest 2022-07-01 10:55:56 +01:00
Richard Hughes
b2284bf99e Increase the coverage of the self tests 2022-07-01 10:55:56 +01:00
Gaël PORTAY
299b42fe96 trivial: Make meson.build indentation consistent 2022-06-21 03:27:38 -04:00
Gaël PORTAY
9b969de718 Save serial number and instance-ids when trusted
See commit e3016602f8.
2022-06-20 12:57:40 -04:00