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

duckscript: use system TLS instead of rustls #113077

Closed
wants to merge 1 commit into from

Conversation

cho-m
Copy link
Member

@cho-m cho-m commented Oct 13, 2022

  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

@cho-m cho-m added the openssl-3-migration Related to switching to an OpenSSL 3 dependency label Oct 13, 2022
@BrewTestBot BrewTestBot added the rust Rust use is a significant feature of the PR or issue label Oct 13, 2022
cd "duckscript_cli" do
system "cargo", "install", *std_cargo_args
end
system "cargo", "install", "--features", "tls-native", *std_cargo_args(path: "duckscript_cli")
Copy link
Member Author

Choose a reason for hiding this comment

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

Still need to make sure of linkage. Open to opinions on whether we should favor the statically linked pure Rust implementation vs dynamically linked system/Homebrew library.

Upstream changed from native OpenSSL to rustls, and then added option afterward https://github.com/sagiegurari/duckscript/blob/master/CHANGELOG.md#v0813-2022-07-21

### v0.8.13 (2022-07-21)

* Enhancement: Runtime - Enable to clone duckscript context #253 (thanks waterlens)
* Enhancement: Support both native TLS via openssl and pure rust TLS #258 (thanks @jirutka)

### v0.8.12 (2022-05-25)

* Enhancement: Add support for stdin input passing to child process in exec, watchdog and spawn commands #247
* Enhancement: Replace native TLS support via openssl with pure rust TLS
* Update dependencies

Copy link
Member Author

Choose a reason for hiding this comment

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

Old linkage #112420:

==> brew linkage --cached duckscript
System libraries:
  /lib/x86_64-linux-gnu/libc.so.6
  /lib/x86_64-linux-gnu/libgcc_s.so.1
  /lib/x86_64-linux-gnu/libm.so.6

New linkage:

==> brew linkage --cached duckscript
System libraries:
  /lib/x86_64-linux-gnu/libc.so.6
  /lib/x86_64-linux-gnu/libgcc_s.so.1
  /lib/x86_64-linux-gnu/libm.so.6
Homebrew libraries:
  /home/linuxbrew/.linuxbrew/opt/openssl@3/lib/libcrypto.so.3 (openssl@3)
  /home/linuxbrew/.linuxbrew/opt/openssl@3/lib/libssl.so.3 (openssl@3)

@cho-m cho-m marked this pull request as ready for review October 13, 2022 23:28
@cho-m cho-m added maintainer feedback Additional maintainers' opinions may be needed do not merge labels Oct 14, 2022
@cho-m
Copy link
Member Author

cho-m commented Oct 14, 2022

@Homebrew/core

I see that some rust formulae have switched to default of rustls (like duckscript and zola) and expect more to follow. For some we won't have a choice, but the ones I listed do allow overriding default.

Wanted to discuss whether we should use rustls or override default to use Homebrew OpenSSL / macOS system libs.

I guess the main consideration would be security. Dynamically linked libraries allow providing security fixes with formulae/system updates. rustls fixes would require upstream creating a new release with updated Cargo.lock including a version of rustls with fix. Though that may be something that upstream is expected to actively support if they plan to use rustls.

@carlocab
Copy link
Member

I'm averse to statically linking crypto libraries. Do you know what Linux distros are doing?

@MikeMcQuaid
Copy link
Member

Yeh, I'm initially "oh let's do what upstream does" but this does not sound like it'll be an easy process for us to detect and push updates for compared to e.g. a new openssl release.

@cho-m
Copy link
Member Author

cho-m commented Oct 14, 2022

Do you know what Linux distros are doing?

There aren't that many examples right now. Alpine's duckscript maintainer wrote the PR to re-add system TLS support (sagiegurari/duckscript#258) and I would assume Debian, Fedora, and others would also prefer dynamic linkage based on general packaging preferences/policy.

Of course this will depend on whether each upstream is willing to support alternative TLS options. For example, volta will be dropping OpenSSL support in next release (volta-cli/volta#1214).


Based on current responses, we could try to prioritize dynamically linked SSL/TLS libraries when available. May need to verify brew linkage output or upstream changelogs/notes to notice if upstream has decided to use rustls.


On side note, there are some other bundled libraries that we may want to check on later per rust formula:

  • openssl-sys can end up bundling OpenSSL if package uses vendored feature. May be possible to override with OPENSSL_NO_VENDOR.
  • libgit2-sys bundles a copy of libgit2 but does detect system copy via pkg-config.
  • libssh2-sys bundles a copy of libssh2. Needs an environment variable override to change behavior.
  • onig_sys bundles a copy of oniguruma. Needs an environment variable override to change behavior.

@BrewTestBot
Copy link
Member

🤖 A scheduled task has triggered a merge.

@cho-m cho-m deleted the duckscript-openssl3 branch October 17, 2022 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintainer feedback Additional maintainers' opinions may be needed openssl-3-migration Related to switching to an OpenSSL 3 dependency rust Rust use is a significant feature of the PR or issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants