Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport 0.14.1 #2389

Merged
merged 9 commits into from
Feb 13, 2025
Merged

Backport 0.14.1 #2389

merged 9 commits into from
Feb 13, 2025

Conversation

legoktm
Copy link
Member

@legoktm legoktm commented Feb 13, 2025

Status

Ready for review

Description

Cherry-pick commits from 0.14.1 release to main. Note that some commits have multiple cherry-pick tags because they were first cherry-picked to the release branch and then back to main 🙃 .

One extra commit to bump the date for the rc changelog entry to make lintian happy.

Test Plan

  • Visual review
  • CI passes

legoktm and others added 8 commits February 13, 2025 14:15
The SDK joins paths in two cases:

== download_reply ==

A malicious server could override the filename given in the
content-disposition header to trigger an arbitrary file write into e.g.
~/.config/autostart.

The fix is to do what download_submission does, and use the
pre-sanitized filename. We shouldn't even use the content-disposition
header at all, so it's removed from StreamedResponse.

== download_submission ==

In this case no path traversal was possible, since we correctly use
submission.filename, which is already validated when it is first fetched
from the server.

However, we can apply an extra level of hardening by checking for path
traversal before we write anything.

Fixes <freedomofpress/securedrop-security#108>.

(cherry picked from commit 45d86bc4cdcbe6e625b27ac0c15d24f42fbd6c47)
(cherry picked from commit 120bac1)
Prevent directory traversal attacks by no longer relying on
compromized-vm-provided name. This parameter should instead be
obtained by the environment variable $QREXEC_REMOTE_DOMAIN.

(cherry picked from commit 9f1580cdde24365084aafffedf367c32d867df8b)
(cherry picked from commit 3012bf7)
Validation is no longer necessary, since QREXEC_REMOTE_DOMAIN is
provided by dom0 (as opposed to an attacker) and the VM name
already includes validations which prevent "/" in the name.

(cherry picked from commit 48382568798070c484cbcb82637f8bb42300e976)
(cherry picked from commit a4d28c0)
(cherry picked from commit ec5ca97e45e911e3ff867c01fedc94c16bd487f3)
(cherry picked from commit 7ab0ad8)
This is a compromise: We have to at least consult the server-provided
filename no matter what, because that's how we reconcile our local
ordering with the server's authoritative ordering within the source
conversation.  At that point, we might as well just use it, subject to
the same validation enforced for metadata syncs in
storage.sanitize_submissions_or_replies().

(cherry picked from commit 6014eece28f04092d7bcf32ebd620e9f394f07f9)
(cherry picked from commit 0d521f5)
(cherry picked from commit 884ee7fe6a1c6d94bc203576ce68bdd434d2aafa)
(cherry picked from commit e1c6e75)
(cherry picked from commit b3ced68)
(cherry picked from commit 564be9e)
@legoktm legoktm requested a review from a team as a code owner February 13, 2025 19:20
@rocodes rocodes self-assigned this Feb 13, 2025
Copy link
Contributor

@rocodes rocodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • CI
  • Visual review / backport contains only relevant commits

@rocodes rocodes added this pull request to the merge queue Feb 13, 2025
Merged via the queue into main with commit 676032c Feb 13, 2025
58 checks passed
@rocodes rocodes deleted the backport-0.14.1 branch February 13, 2025 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants