Skip to content

builder-flatpak-utils: Switch flatpak_cp_a to f-based operations - #771

Open
bbhtt wants to merge 2 commits into
mainfrom
bbhtt/flatpak_cp_aat
Open

bbhtt wants to merge 2 commits into
mainfrom
bbhtt/flatpak_cp_aat

Conversation

@bbhtt

@bbhtt bbhtt commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

This additionally drops the MOVE and NO_CHOWN cp flags since they were either not used anywhere or were the default being used.

@bbhtt
bbhtt marked this pull request as draft August 30, 2026 04:25
@bbhtt
bbhtt force-pushed the bbhtt/flatpak_cp_aat branch from c5b1921 to 3425ceb Compare October 4, 2026 04:09
@bbhtt
bbhtt marked this pull request as ready for review October 4, 2026 04:10
@TingPing

TingPing commented Oct 5, 2026

Copy link
Copy Markdown
Member

Your commit contains no information of why this is done. I honestly don't see the value.

Anyway I pushed a test case that this breaks.

@bbhtt

bbhtt commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

This was part of the path traversal issues that keeps cropping up here and there and was pending investigation. There's some stuff in the draft advisories and we've been trying to switch to fd based operations to eliminate certain new issues.

This function is originally from the Flatpak codebase who also switched to fd based variant recently in response to security issues.

@bbhtt
bbhtt force-pushed the bbhtt/flatpak_cp_aat branch from de1f1ba to f9c655a Compare October 11, 2026 03:35
bbhtt and others added 2 commits October 11, 2026 09:06
This use fds / fd-based APIs instead of paths / GFile based APIs
to avoid potential TOCTTOU and path traversal issues. The function
originally comes from Flatpak which also now uses a similar fd-based
operation [1] [2].

This drops the MOVE and NO_CHOWN cp flags since they were either not
used anywhere or were the default being used.

[1]: flatpak/flatpak@c34e4cf
[2]: flatpak/flatpak@6e94393
@bbhtt
bbhtt force-pushed the bbhtt/flatpak_cp_aat branch from f9c655a to 46091a9 Compare October 11, 2026 03:37
@bbhtt
bbhtt requested a review from TingPing October 11, 2026 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants