Skip to content

[FIXED] make natsOptions_SetSSLVerificationCallback experimental#860

Merged
levb merged 2 commits into
mainfrom
lev-GH-857-experimental
Mar 14, 2025
Merged

[FIXED] make natsOptions_SetSSLVerificationCallback experimental#860
levb merged 2 commits into
mainfrom
lev-GH-857-experimental

Conversation

@levb

@levb levb commented Mar 12, 2025

Copy link
Copy Markdown
Collaborator

Fixes #857. An alternative to @mtmk's proposal.

This new API introduced in #826 created a build issue, as @ckasabula had warned.

I propose that for now we mark it as EXPERIMENTAL and hide behind a NATS_WITH_EXPERIMENTAL env. variable as this PR implements. This will fix the immediate widespread build issue.

Then I see 2 paths to fix this in a better way.
A) Go back to what @ckasabula originally proposed (+apologies!!!)
B) Leave the code "as is", but replace NATS_HAS_TLS with NATS_NO_TLS since I believe it is purely an internal variable. That would alleviate the issue for all clients compiling the default TLS on. @kozlovic do you think it'd work?

arch:
type: string
default: "64"
benchmark:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Sorry I couldn't stand it and alphabetized the options in this PR. Unrelated.

@codecov

codecov Bot commented Mar 12, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.35%. Comparing base (1553d4a) to head (ac15804).
Report is 51 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #860      +/-   ##
==========================================
+ Coverage   68.71%   70.35%   +1.63%     
==========================================
  Files          39       47       +8     
  Lines       15207    15397     +190     
  Branches     3143     3158      +15     
==========================================
+ Hits        10449    10832     +383     
+ Misses       1700     1527     -173     
+ Partials     3058     3038      -20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@levb
levb marked this pull request as ready for review March 12, 2025 17:22
@levb
levb requested review from kozlovic and mtmk March 12, 2025 17:23
@mtmk

mtmk commented Mar 12, 2025

Copy link
Copy Markdown
Member

Comment thread src/nats.h
Comment thread src/nats.h Outdated
#if defined(NATS_HAS_TLS)
#ifdef NATS_WITH_EXPERIMENTAL

// natsOptions_SetSSLVerificationCallback

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This was in case we ever have more than a handful EXPERIMENTAL APIs, but they prob. wouldn't be grouped together anyway; will remove when I get back soon

Comment thread src/opts.c Outdated
opts->sslCtx->callback = NULL;
}
#ifdef NATS_WITH_EXPERIMENTAL
opts->sslCtx->callback = NULL;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why removing the check for skip?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@kozlovic It was redundant; the function does not use callback when skip is on

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, but silly example, but say user sets the callback first (which sets skip to false internally and sets the callback), then this API is called with skip=false, it would be a no-op, but in this case it will now set skip to false AND delete the callback...

@levb
levb requested a review from kozlovic March 12, 2025 21:10

@kozlovic kozlovic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@mtmk

mtmk commented Mar 12, 2025

Copy link
Copy Markdown
Member

(just testing it with fedora 41. should be done soon...)
edit: done. works as intended.

@mtmk mtmk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

the only complication I can see, will be with vcpkg if we want to also publish the experimental features as well. so to me this is complicating installation a little but since vcpkg and the verification features are pretty new and possibly not being used by many it should be good until 3.11.

@ckasabula

Copy link
Copy Markdown
Contributor

Sorry to hear about the issues this change has caused. Let me know if I can help with the resolution of this for 3.12, e.g. revive the original approach or something else.
Have you considered just reverting it entirely for now?
I agree w/ @mtmk 's comment RE: vcpkg

@levb
levb merged commit 67489c3 into main Mar 14, 2025
@levb
levb deleted the lev-GH-857-experimental branch March 14, 2025 16:44
github-actions Bot pushed a commit that referenced this pull request Mar 14, 2025
levb added a commit to levb/nats.c that referenced this pull request Mar 14, 2025
…s-io#860)

* [FIXED] wrapped natsOptions_SetSSLVerificationCallback in ifdef NATS_WITH_EXPERIMENTAL

* PR feedback
github-actions Bot pushed a commit to levb/nats.c that referenced this pull request Mar 14, 2025
github-actions Bot pushed a commit that referenced this pull request Mar 14, 2025
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.

Need to define NATS_HAS_TLS with latest 3.10.0

4 participants