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

Warn about newlines in secrets (3.18) #198

Merged
merged 5 commits into from
Nov 11, 2023
Merged

Warn about newlines in secrets (3.18) #198

merged 5 commits into from
Nov 11, 2023

Conversation

thespad
Copy link
Member

@thespad thespad commented Oct 31, 2023

linuxserver.io


  • I have read the contributing guideline and understand that I have made the correct modifications

Description:

This is an attempt to deal with the dozens of people who create secrets with errant newlines. By default it will remove any newline characters from secrets before assigning to them envs. There is an undocumented bypass for the 3 people who will inevitably have some horrible edge case where they're legitimately using multi-line envs in secrets.

Benefits of this PR and context:

How Has This Been Tested?

Source / References:

@thespad thespad requested a review from a team October 31, 2023 16:56
@thespad thespad self-assigned this Oct 31, 2023
@LinuxServer-CI
Copy link
Collaborator

I am a bot, here are the test results for this PR:
https://ci-tests.linuxserver.io/lspipepr/alpine/3.18-7c68c58f-pkg-7c68c58f-dev-6bb5231d176090383d2dc1de793a71a557c8531d-pr-198/index.html
https://ci-tests.linuxserver.io/lspipepr/alpine/3.18-7c68c58f-pkg-7c68c58f-dev-6bb5231d176090383d2dc1de793a71a557c8531d-pr-198/shellcheck-result.xml

Tag Passed
amd64-3.18-7c68c58f-pkg-7c68c58f-dev-6bb5231d176090383d2dc1de793a71a557c8531d-pr-198
arm64v8-3.18-7c68c58f-pkg-7c68c58f-dev-6bb5231d176090383d2dc1de793a71a557c8531d-pr-198

nemchik
nemchik previously approved these changes Nov 2, 2023
Copy link
Member

@nemchik nemchik left a comment

Choose a reason for hiding this comment

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

this looks fine, but the whole script might be better off rewritten at some point if we keep needing to nest more conditionals and loops like this.

@thespad
Copy link
Member Author

thespad commented Nov 2, 2023

Actually that's a good point, I hadn't noticed that since I made the changes to standardise this over all the bases during the s6v3 migration that there's a redundant if in there, fixed in 7c6601c

@thespad
Copy link
Member Author

thespad commented Nov 2, 2023

And then actually fixed in 1b98fd9

@LinuxServer-CI
Copy link
Collaborator

I am a bot, here are the test results for this PR:
https://ci-tests.linuxserver.io/lspipepr/alpine/3.18-7c68c58f-pkg-7c68c58f-dev-0b27e6497340f0306078a9a7caecd95fd3ef9574-pr-198/index.html
https://ci-tests.linuxserver.io/lspipepr/alpine/3.18-7c68c58f-pkg-7c68c58f-dev-0b27e6497340f0306078a9a7caecd95fd3ef9574-pr-198/shellcheck-result.xml

Tag Passed
amd64-3.18-7c68c58f-pkg-7c68c58f-dev-0b27e6497340f0306078a9a7caecd95fd3ef9574-pr-198
arm64v8-3.18-7c68c58f-pkg-7c68c58f-dev-0b27e6497340f0306078a9a7caecd95fd3ef9574-pr-198

@LinuxServer-CI
Copy link
Collaborator

I am a bot, here are the test results for this PR:
https://ci-tests.linuxserver.io/lspipepr/alpine/3.18-7c68c58f-pkg-7c68c58f-dev-08f4e7af1da0d531aa404535c445f51bbad4fe53-pr-198/index.html
https://ci-tests.linuxserver.io/lspipepr/alpine/3.18-7c68c58f-pkg-7c68c58f-dev-08f4e7af1da0d531aa404535c445f51bbad4fe53-pr-198/shellcheck-result.xml

Tag Passed
amd64-3.18-7c68c58f-pkg-7c68c58f-dev-08f4e7af1da0d531aa404535c445f51bbad4fe53-pr-198
arm64v8-3.18-7c68c58f-pkg-7c68c58f-dev-08f4e7af1da0d531aa404535c445f51bbad4fe53-pr-198

@nemchik
Copy link
Member

nemchik commented Nov 2, 2023

Actually that's a good point, I hadn't noticed that since I made the changes to standardise this over all the bases during the s6v3 migration that there's a redundant if in there, fixed in 7c6601c

I think most of it could be made into a function and then just the top line find command could exec the function. with that find we're also confirming the existence of the files that we're nesting in some if checks currently to reconfirm? (which seems a bit redundant)

@thespad
Copy link
Member Author

thespad commented Nov 3, 2023

No, we're confirming that the file that the FILE__ env points to exists, it's not a redundant check.

@thespad thespad changed the title Default to sanitizing newlines in secrets Default to sanitizing newlines in secrets (3.18) Nov 10, 2023
@LinuxServer-CI
Copy link
Collaborator

I am a bot, here are the test results for this PR:
https://ci-tests.linuxserver.io/lspipepr/alpine/3.18-7c68c58f-pkg-7c68c58f-dev-f8ae20f8478f27f4b0f87788f41225890007eda0-pr-198/index.html
https://ci-tests.linuxserver.io/lspipepr/alpine/3.18-7c68c58f-pkg-7c68c58f-dev-f8ae20f8478f27f4b0f87788f41225890007eda0-pr-198/shellcheck-result.xml

Tag Passed
amd64-3.18-7c68c58f-pkg-7c68c58f-dev-f8ae20f8478f27f4b0f87788f41225890007eda0-pr-198
arm64v8-3.18-7c68c58f-pkg-7c68c58f-dev-f8ae20f8478f27f4b0f87788f41225890007eda0-pr-198

@LinuxServer-CI
Copy link
Collaborator

I am a bot, here are the test results for this PR:
https://ci-tests.linuxserver.io/lspipepr/alpine/3.18-7c68c58f-pkg-7c68c58f-dev-03eac68a16a1aa03bad0044ee539618f852a9477-pr-198/index.html
https://ci-tests.linuxserver.io/lspipepr/alpine/3.18-7c68c58f-pkg-7c68c58f-dev-03eac68a16a1aa03bad0044ee539618f852a9477-pr-198/shellcheck-result.xml

Tag Passed
amd64-3.18-7c68c58f-pkg-7c68c58f-dev-03eac68a16a1aa03bad0044ee539618f852a9477-pr-198
arm64v8-3.18-7c68c58f-pkg-7c68c58f-dev-03eac68a16a1aa03bad0044ee539618f852a9477-pr-198

@thespad thespad dismissed nemchik’s stale review November 11, 2023 15:01

PR scope change

@thespad thespad requested a review from a team November 11, 2023 15:01
@thespad thespad changed the title Default to sanitizing newlines in secrets (3.18) Warn about newlines in secrets (3.18) Nov 11, 2023
@LinuxServer-CI
Copy link
Collaborator

I am a bot, here are the test results for this PR:
https://ci-tests.linuxserver.io/lspipepr/alpine/3.18-458ab886-pkg-458ab886-dev-0d1196029a9d272ee05f842f969095eafd5ceb0c-pr-198/index.html
https://ci-tests.linuxserver.io/lspipepr/alpine/3.18-458ab886-pkg-458ab886-dev-0d1196029a9d272ee05f842f969095eafd5ceb0c-pr-198/shellcheck-result.xml

Tag Passed
amd64-3.18-458ab886-pkg-458ab886-dev-0d1196029a9d272ee05f842f969095eafd5ceb0c-pr-198
arm64v8-3.18-458ab886-pkg-458ab886-dev-0d1196029a9d272ee05f842f969095eafd5ceb0c-pr-198

@LinuxServer-CI
Copy link
Collaborator

I am a bot, here are the test results for this PR:
https://ci-tests.linuxserver.io/lspipepr/alpine/3.18-458ab886-pkg-458ab886-dev-dda485e94cb2360be9735d76bbee988c57b5e022-pr-198/index.html
https://ci-tests.linuxserver.io/lspipepr/alpine/3.18-458ab886-pkg-458ab886-dev-dda485e94cb2360be9735d76bbee988c57b5e022-pr-198/shellcheck-result.xml

Tag Passed
amd64-3.18-458ab886-pkg-458ab886-dev-dda485e94cb2360be9735d76bbee988c57b5e022-pr-198
arm64v8-3.18-458ab886-pkg-458ab886-dev-dda485e94cb2360be9735d76bbee988c57b5e022-pr-198

@thespad thespad merged commit 2b1fc3f into master Nov 11, 2023
2 checks passed
@thespad thespad deleted the 3.18-secrets branch November 11, 2023 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants