Commit Graph

2083 Commits

Author SHA1 Message Date
Richard Hughes
7b2d75f94d trivial: Fix a tiny leak when using fwupdmgr 2021-11-02 13:47:56 +00:00
Richard Hughes
6d35c99393 Fix 'trivial: fwupdtool security' to show sane results 2021-11-01 11:46:44 +00:00
Richard Hughes
97785b3f5d trivial: Ignore security attrs without an assigned ID
This should never happen, but...
2021-11-01 10:14:43 +00:00
Richard Hughes
838db7e0fd trivial: Only show the 'Host Security Events' title when required
We actually ignore some of the events.
2021-11-01 10:14:43 +00:00
Richard Hughes
a0cb743700 Show changes in HSI attributes when required
e.g. `fwupdmgr security --force` would display:

    Host Security Events
      2021-10-29 10:51:42:  ✘ Kernel lockdown disabled
      2021-10-29 10:51:42:  ✘ SecureBoot disabled
      2021-10-29 09:32:32:  ✔ IOMMU device protection enabled
      2021-10-29 09:28:52:  ✘ IOMMU device protection disabled
2021-11-01 06:58:44 +00:00
Richard Hughes
3e456a8cbb Only save the HSI attributes to the database if different 2021-11-01 06:58:44 +00:00
Richard Hughes
17b6d79728 Allow getting the old HSI security attrs from the database
Based on a patch by Kate Hsuan <hpa@redhat.com>, many thanks.
2021-11-01 06:58:44 +00:00
Richard Hughes
e4b097c3dd Allow comparing two FuSecurityAttrs for equality
Based on a patch by Kate Hsuan <hpa@redhat.com>, many thanks.
2021-11-01 06:58:44 +00:00
Richard Hughes
06a1eff9b7 trivial: Do not save the created value to the database
This makes it much harder to dedupe later, and we already have a
timestamp key for the database record.
2021-10-29 11:38:21 +01:00
Richard Hughes
a085b4dd68 Add a 'created' property on the HSI security attribute 2021-10-28 17:25:40 +01:00
Richard Hughes
dbdd3740a3 Add support for loading the HSI result from a JSON blob
This is how we save it to the database, and we'll need to load old
records for future functionality.
2021-10-28 15:36:13 +01:00
Richard Hughes
6a2d222eea trivial: Fix a small memory leak at startup 2021-10-27 15:57:53 +01:00
Richard Hughes
9952395779 Support more localized AppStream fields 2021-10-25 15:38:51 +01:00
Richard Hughes
70f9124545 Show translated firmware release notes when provided
Send the users locale to the daemon so that it can be used to prefer
the localized update text over the default en_US version.

    $ LANG=fr_FR.UTF8 fwupdmgr get-details test.cab
    ...
    └─ACME Plan 9:
          Nouvelle version: 0.0.5
          Licence:          Propriétaire
          Urgence:          Faible
          Fournisseur:      ACME Ltd.
          Description:      Cette version stable corrige des bugs.

I decided to send the locale to the daemon rather than change the
`Description` to return GVariant to `a{ss}` as we also probably want
to support things like localized summary and URLs too in the future.
2021-10-24 18:59:15 +01:00
Richard Hughes
28678235cd Move the fuzzing files into the plugin directories
We only had to pile everything into the src/fuzzing/firmware directory
because honggfuzz could not cope with more than one input path.

This way each plugin is self contained and easy to copy.
Also, install the fuzzing builder objects as this fixes the installed
tests when srcdir does not exist.

Based on a patch by Jan Tojnar <jtojnar@gmail.com>, many thanks.
2021-10-22 15:24:05 +01:00
Richard Hughes
04a6877e06 trivial: Move the nonfree SMBIOS dumps to fwupd-test-firmware 2021-10-22 09:55:48 +01:00
Richard Hughes
2d00cda464 Remove PLUGINBUILDDIR and use G_TEST_SRCDIR and G_TEST_BUILDDIR instead
This allows us to override the location we load data files from, which
allows us to do more kinds of installed tests in the future.

Also, move the global data/tests content into the place that it is used
as it was getting impossible to manage.
2021-10-21 18:36:22 +01:00
Richard Hughes
3fc635e144 Remove honggfuzz support
This has not worked well in some time, and nobody noticed. The
alternative Google clusterfuzz support is better in every way and gets
run as part of CI.
2021-10-19 19:20:05 +01:00
Richard Hughes
1b1009cf5f Avoid modifying remotes when possible
Found in the NixOS downstream patches, thanks @maxine.
2021-10-19 17:21:57 +01:00
Richard Hughes
15bf534e3f Set the verfmt of the returned device when the daemon device is unset
This regressed in 1.5.5 when we migrated FWUPD_DEVICE_FLAG_MD_SET_VERFMT
into FU_DEVICE_INTERNAL_FLAG_MD_SET_VERFMT and forgot to copy the system
device internal flags.
2021-10-18 06:57:09 +01:00
Richard Hughes
fcb5257e16 Allow OnlyTrusted=false in the non-polkit case 2021-10-17 14:29:58 +01:00
Richard Hughes
98855ab712 Allow using a filename when using set-approved-firmware
See https://gitlab.com/fwupd/lvfs-website/-/merge_requests/924 for more
discussion.
2021-10-15 16:29:00 +01:00
Richard Hughes
bd43647554 Add fu_usb_device_new_with_context() helpers
This means the context is set at construction time, which is much less
fragile than setting the context manually.
2021-10-15 15:59:34 +01:00
Richard Hughes
644ac0ea05 Only installing firmwares with signatures by default
99.9999% of users are consuming firmware updates from the LVFS or
another trusted remote. It's far too easy to get a user to enter the
password to install an untrusted firmware, where the security
consequences are pretty dire.

Provide an escape-hatch for firmware engineers, but it does mean
editing a file in /etc as root. This seems like an acceptable level of
inconvenience.
2021-10-15 15:54:44 +01:00
Richard Hughes
74a2a47f7f Add two report keys affecting report credibility 2021-10-15 13:55:25 +01:00
Richard Hughes
2d5c5b868e Add the missing PolicyKit actions for (un)trusted downgrade
If we want to tighten the allowed actions, we need the actions to be
symmetric.
2021-10-15 13:54:29 +01:00
Richard Hughes
86b27b9505 Mark as SUPPORTED even if on AC power
This makes the 'Downloaded new metadata: N local devices supported'
message correct when refreshing on battery power.
2021-10-12 17:59:27 +01:00
Richard Hughes
4389f9f913 trivial: Show newlines in the warning box
This means we split up the paragraphs into sections as designed.
2021-10-09 08:09:38 +01:00
Richard Hughes
d3706e0e0b Show the user a warning if updating may affect full-disk-encryption
Additionally, if the client does not set the feature flag `fde-warning`,
add an extra paragraph into the update description.

Fixes https://github.com/fwupd/fwupd/issues/3829
2021-10-09 08:09:38 +01:00
Richard Hughes
3f82205062 Support loading remotes from /var/lib/fwupd/remotes.d
This allows us to add remotes on /etc immutable systems.
2021-10-08 17:22:24 +01:00
Richard Hughes
1669f532be trivial: Move the metadata directory
This moves the cached metadata location from /var/lib/fwupd/remotes.d
to /var/lib/fwupd/metadata

The former was a bad name as it wasn't a list of remotes, and .d is the
suffix for directories the user can install files into, rather than for
binary content managed entirely by the daemon.
2021-10-08 17:22:24 +01:00
Richard Hughes
20a1b12afe trivial: Ensure paths in /var exist before starting the daemon
On an immutable system these might have been factory reset to empty.
2021-10-08 17:22:24 +01:00
Richard Hughes
d081db775a Allow specifying 'fwupdmgr device-test foo --json'
This outputs a superset of the existing device-test JSON schema, and is
designed to be read my a machine, not a human.
2021-10-08 17:22:06 +01:00
Richard Hughes
6d121d0163 trivial: Do not show progressbars when running with --json 2021-10-08 17:22:06 +01:00
Richard Hughes
37855a3f5d trivial: Match up the translator comments with the source strings
Doing clang-format on the codebase broke a few of these.
2021-10-06 16:07:43 +01:00
Gaël PORTAY
5c2c9c4672 fu-engine: Fix typo in the efi-firmware-volume ID
The commit 488f2e1f37 has moved some
parsers and has created a typo in the efi-firmware-volume ID.
2021-09-30 07:45:28 -05:00
Richard Hughes
86d92f2c93 trivial: Fix translator comment 2021-09-25 19:48:47 +01:00
Richard Hughes
478e44bc19 trivial: Do not use g_assert() in self test code
Note that g_assert() should not be used in unit tests, since it is a
no-op when compiling with G_DISABLE_ASSERT. Use g_assert() in production
code, and g_assert_true() in unit tests.

See https://github.com/fwupd/fwupd/issues/3790
2021-09-24 22:20:21 +01:00
Daniel Campello
3d7d49c1e1 trivial: do not fallback on missing GUID lookup 2021-09-24 11:07:43 -05:00
Richard Hughes
3a86c7e386 elantp: Use the recently added FuCfuOffer and FuCfuPayload
This increases the amount of parsing we do ahead-of-time.
2021-09-24 08:40:42 +01:00
michaelcheng04
10549674b1 Add a plugin to flash Elan fingerprint reader hardware 2021-09-23 10:41:00 +01:00
Mario Limonciello
6ebccf1e1e Remove support for --ignore-power by frontends
This functionality broke a number of releases ago as part of
implementing device inhibition and was just noticed now.

Instead of fixing it, the preference seems to be to remove the
functionality as it exists today as inhibitions can happen for
a number of reasons.

To still allow people to override these power warnings (such as during
development) add a new daemon configuration item that can be used.

Fixes: #3778
2021-09-21 13:13:52 -05:00
Richard Hughes
06710d7911 Report progress correctly when using fwupdtool
Some methods like fu_engine_firmware_dump() take a FuProgress and do
not use engine signals.
2021-09-21 16:20:20 +01:00
Richard Hughes
450e8e1c17 Add FuCfuPayload and FuCfuOffer
We can use these in the future elantp plugin, and I'm sure we'll need
them again in the future for an *actual* CFU plugin.
2021-09-20 14:43:34 +01:00
Richard Hughes
1ff96eb4b3 Restore the ABI for fu_device_detach() and provide new symbols
Quite a few plugins are using a FuDeviceLocker to detach then attach in
the error path, and finding them isn't easy as we explicitly cast to a
FuDeviceLockerFunc.

For sanity, just provide both symbols so we can do the right thing in
both cases. It seems like a sensible thing to allow.

Fixes https://github.com/fwupd/fwupd/issues/3771
2021-09-17 16:35:21 +01:00
Richard Hughes
9d37e447a1 Convert the device test script to a fwupdmgr subcommand
This allows us to do a few things:

 * Remove the runtime dep on Python 3, which is tricky for ChromeOS
 * Test composite devices more efficiently, only writing once per test
 * Automatically upload signed reports for successful device tests.
2021-09-16 15:01:36 +01:00
Mario Limonciello
7258f972ac trivial: fu-tool: for get-plugins load engine with HWINFO
Checking whether some plugins are enabled or not will require smbios
to be available.  Information may be wrongly displayed unless this
has been checked.
2021-09-16 06:44:27 -05:00
Richard Hughes
28494902f5 trivial: Remove the double warning when reinstalling composite firmware
Typo? Merge artifact? Who knows.
2021-09-16 09:15:35 +01:00
Simon Ho
5e67108ab8
plugins: add new plugin for Synaptics CAPE devices (#3746)
CAPE family is Audio DSP for a board range of applications in IOT, PC
and mobile can be interfaced via I2C, UART or USB interface. This patch
is only for CX31993 and CX31988 chips, there is not immediate plans is
to add support to other CAPE devices.

CX31993 have two separate firmware .hid file for for each partition. It
need to convert two .hid files into a .fw file for fwupd tool to
consume.

Currently, this patch is only support for EPOS headsets with basic
firmware update feature. Either new code singing or manifest.xml are
unsupported yet.

The code has been tested with CX31993 EVK board.

A test firmware file is put at 'src/fuzzing/firmware/synaptics-cape.fw'

synaptics-cape: Port to new FuProgress API and style fixups

synaptics-cape: Fix compile errors and add missing test fw file

Signed-off-by: Simon Ho <simon.ho@synaptics.com>

synaptics-cape: Fix fuzzer test

Signed-off-by: Simon Ho <simon.ho@synaptics.com>

synaptics-cape: Fix progress bar number

Signed-off-by: Simon Ho <simon.ho@synaptics.com>

synaptics-cape: Mark the fuzzing target

trivial: Use a stable GLib branch for fuzzing

synaptics-cape: Fix progress bar number

Signed-off-by: Simon Ho <simon.ho@synaptics.com>

synaptics-cape: Fix readme

synaptics-cape: Style fixups

synaptics-cape: Fix progress bar percentage

synaptics-cape: Style fixups
2021-09-15 03:42:07 +08:00
Richard Hughes
9ed7eac949 trivial: Add translations for more device categories 2021-09-13 15:08:32 +01:00