Repository navigation
Various fixes part 2 - #6724
Merged
Merged
Various fixes part 2#6724
Conversation
alexlarsson
reviewed
Aug 4, 2026
alexlarsson
reviewed
Aug 4, 2026
alexlarsson
approved these changes
Aug 4, 2026
alexlarsson
left a comment
Member
There was a problem hiding this comment.
Some minor comment, but lgtm
In case something takes over the process, not having any supplementary groups limits the damage that can be done.
The Deploy authorization handler decides between app-install (requires admin auth) and app-update (no auth needed) by checking whether the ref is currently installed. The deploy handler then independently checks the deployed state to decide whether to install or update. Record the authorization decision on the invocation and verify in the deploy handler that the operation matches what was authorized.
handle_remove_local_ref validates the remote name but passes the ref string directly to flatpak_dir_remove_ref without validation. Since the polkit action for this method is modify-repo (allow_active=yes), any active session user can delete arbitrary ostree refs in the system repo without authentication. All legitimate callers of RemoveLocalRef pass standard flatpak refs (app/runtime). Non-standard refs like appstream/, appstream2/, and ostree-metadata are managed through their own dedicated D-Bus methods (DeployAppstream, UpdateRemote, ConfigureRemote) and never go through RemoveLocalRef. Validate the ref with flatpak_decomposed_new_from_ref() to restrict removal to valid flatpak refs.
flatpak_oci_registry_mirror_blob uses self->token (destination registry) instead of source_registry->token when downloading from the source. All other parameters on the same call correctly use source_registry. In practice the destination is always a local on-disk registry with no token set, so this results in missing authentication when pulling from authenticated source registries rather than a credential leak.
The appdata XML parser uses g_assert() to validate parser state in several places. Since the XML comes from the app's deploy directory and is controlled by the package author, malformed XML triggers abort(). Replace all g_assert() calls with graceful handling: early returns when there is no current component, NULL checks for content_rating, and state resets for accumulated text and lang.
The metadata, appstream, icon_64, and icon_128 fields are conditionally initialized in flatpak_bundle_ref_new() depending on which keys exist in the bundle metadata. The finalize function used g_bytes_unref() which is not NULL-safe on older GLib versions.
The close function would bail out on the first child stream close failure, skipping the remaining children. Close all children and propagate the first error.
flatpak_permission_adds_permissions() had two bugs in its sorted-array merge walk for comparing conditional permissions: The function returned FALSE when a new conditional was not present in the old set, which is the opposite of correct — a new conditional means the permission can be granted under conditions it previously could not. The loop also relied on reading a NULL sentinel past the end of the GPtrArray, which is not NULL-terminated, causing an out-of-bounds read. Replace with proper bounds-checked iteration that correctly detects new conditionals as permission additions.
flatpak_docker_reference_parse() asserts that the regex always matches, but inputs containing newlines cause the match to fail since the regex is not compiled with G_REGEX_DOTALL. Return an error instead.
Instead of just blindly accepting any characters to make up the docker registry domain, reject invalid domains (including ones which contain e.g. '@', '#', and '?').
swick
force-pushed
the
wip/various-fixes-novuln-part2
branch
from
August 4, 2026 11:25
ff1c283 to
9bf7681
Compare
The subtraction-based comparison overflows when priority values are far apart, which is undefined behavior in C.
Every other access to index->manifests in the codebase checks for NULL before dereferencing, but flatpak_image_collection_new did not. Add the same guard to avoid a NULL pointer dereference if the OCI index has no manifests array.
The commit metadata and ref validation checks in validate_commit_metadata() and flatpak_dir_deploy() used G_IO_ERROR which gets downgraded to a generic G_DBUS_ERROR_FAILED when crossing the system helper D-Bus boundary. Use FLATPAK_ERROR_PERMISSION_DENIED so the error is preserved across D-Bus.
A component without an <id> element causes a NULL dereference when parsing appdata.
swick
force-pushed
the
wip/various-fixes-novuln-part2
branch
from
August 4, 2026 11:30
9bf7681 to
dc75767
Compare
Collaborator
Author
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All of those issues fell out of an LLM. I analyzed each issue, discarded a bunch, and either worked on, or at least verified the fixes.