fix: remove trailing whitespace from secrets read from secrets file #1209

Open
charludo wants to merge 1 commit from charludo/continuwuity:ch/fix/newline-secrets into main
First-time contributor

After trying to debug my coturn setup for more hours than I care to admit yesterday evening, it turns out that the issue is that continuwuity reads the turn_secret from turn_secret_file, and then uses the file's entire contents as the secret.
Even using the exact same secrets file in coturn (through agenix, in my case) this leads to problems because both continuwuity and coturn happily start and use the key, but coturn strips the newline, and then the key supposedly shared between the two does not match.

While I could see the argument that this is user error, I don't agree with it; it's unexpected behavior to have to explicitly remove newlines from the secret.

This PR adds that trimming.

After trying to debug my coturn setup for more hours than I care to admit yesterday evening, it turns out that the issue is that continuwuity reads the `turn_secret` from `turn_secret_file`, and then uses the file's entire contents as the secret. Even using the exact same secrets file in coturn (through `agenix`, in my case) this leads to problems because both continuwuity and coturn happily start and use the key, but coturn strips the newline, and then the key supposedly shared between the two does not match. While I could see the argument that this is user error, I don't agree with it; it's unexpected behavior to have to explicitly remove newlines from the secret. This PR adds that trimming.
fix: remove trailing whitespace from secrets read from secrets file
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 2m49s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 12m24s
05bfa1a7c2
nex approved these changes 2025-12-02 11:29:01 +00:00
nex left a comment
Owner

LGTM, stripping trailing whitespace is usually an expected behaviour anyway

LGTM, stripping trailing whitespace is usually an expected behaviour anyway
Jade approved these changes 2025-12-03 01:44:17 +00:00
Jade left a comment
Owner

LGTM, probably something to note in the changelog as it's technically breaking.

LGTM, probably something to note in the changelog as it's technically breaking.
Author
First-time contributor

@Jade wrote in #1209 (comment):

LGTM, probably something to note in the changelog as it's technically breaking.

Sorry, I'm new here - do I need to do anything to make that happen, or is it just a label on the PR or something?

@Jade wrote in https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1209#issuecomment-21988: > LGTM, probably something to note in the changelog as it's technically breaking. Sorry, I'm new here - do I need to do anything to make that happen, or is it just a label on the PR or something?
Owner

Nope, we just have to come back to this when we're writing stuff up

Nope, we just have to come back to this when we're writing stuff up
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 2m49s
Required
Details
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 12m24s
Required
Details
This pull request is blocked because it's outdated.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u ch/fix/newline-secrets:charludo-ch/fix/newline-secrets
git switch charludo-ch/fix/newline-secrets
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
continuwuation/continuwuity!1209
No description provided.