Skip to content

Rename _danger-local-https to _manual-tls#763

Merged
spacebear21 merged 1 commit intopayjoin:masterfrom
0xZaddyy:change-danger
Aug 21, 2025
Merged

Rename _danger-local-https to _manual-tls#763
spacebear21 merged 1 commit intopayjoin:masterfrom
0xZaddyy:change-danger

Conversation

@0xZaddyy
Copy link
Contributor

@0xZaddyy 0xZaddyy commented Jun 12, 2025

This PR updates the feature flag name _danger-local-https to _manual-tls for improved clarity and consistency.

What’s Changed

  • Renamed all occurrences of _danger-local-https to _manual-tls across the codebase.
  • Updated all feature references in code, documentation, and tests

closes #729

@benalleng
Copy link
Collaborator

Taking a look! Let me know if you need any help with making sure rust_fmt is running correctly as I see a lot of formatting changes.

@zealsham
Copy link
Collaborator

Looking good , Did you run the code formating on rust nightly build, that should help with the many unrelated code changes

@0xZaddyy
Copy link
Contributor Author

Looking good , Did you run the code formating on rust nightly build, that should help with the many unrelated code changes

i think the mistake i made was running cargo fmt

Copy link
Collaborator

@benalleng benalleng left a comment

Choose a reason for hiding this comment

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

Good start! We obviously need to get our formatting worked out but as well just so you are reminded it looks like the test-utils still is looking for the _danger-local-https flag. https://github.com/0xZaddyy/rust-payjoin/blob/935bfbc505d3ee14ccf5eb8fb8cd03ae3178a532/payjoin-test-utils/Cargo.toml#L20-L21

Comment on lines +156 to +160
#[cfg(feature = "_manual-tls")]
let tls_acceptor = Self::init_tls_acceptor()?;
while let Ok((stream, _)) = listener.accept().await {
let app = app.clone();
#[cfg(feature = "_danger-local-https")]
#[cfg(feature = "_manual-tls")]
let tls_acceptor = tls_acceptor.clone();
tokio::spawn(async move {
#[cfg(feature = "_danger-local-https")]
#[cfg(feature = "_manual-tls")]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I'd like to explore moving the init_tls_acceptor() to the e2e tests and add these flags as a feature locked option. This would help to further reduce the amount of feature flagged logic in the source code.

@0xZaddyy 0xZaddyy force-pushed the change-danger branch 7 times, most recently from 0655d03 to eb7cfa6 Compare July 16, 2025 05:32
Copy link
Collaborator

@arminsabouri arminsabouri left a comment

Choose a reason for hiding this comment

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

Besides the fmt changes and the applying the unrelated files this looks good.
One more thing: do you mind formatting your commits using the following guide:
https://cbea.ms/git-commit/

For your current commits please squash them once we figure out the fmt changes and reword to "Rename _danger-local-https to _manual-tls"
You'll notice that I dropped the "and simplify TLS handling". If you do simplify tls handling please do it in a seperate commit. Commits should do just one thing well. That helps us write our release notes, reduces review burden and allows us to revert specific changes if we need to. Thank you!

Comment on lines +57 to +73
InternalMultipartyError::IdenticalProposals(e) => {
write!(f, "More than one identical participant: {e}")
}
InternalMultipartyError::ProposalVersionNotSupported(v) => {
write!(f, "Proposal version not supported: {v}")
}
InternalMultipartyError::OptimisticMergeNotSupported => {
write!(f, "Optimistic merge not supported")
}
InternalMultipartyError::BitcoinExtractTxError(e) => {
write!(f, "Bitcoin extract tx error: {e:?}")
}
InternalMultipartyError::InputMissingWitnessOrScriptSig => {
write!(f, "Input in Finalized Proposal is missing witness or script_sig")
}
InternalMultipartyError::FailedToCombinePsbts(e) => {
write!(f, "Failed to combine psbts: {e:?}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like some unrelated formatting changes were applied.

@@ -0,0 +1,35 @@
use std::fmt::{self, Display};
Copy link
Collaborator

Choose a reason for hiding this comment

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

This file was removed in favor of session.rs. Looks like you need to rebase against master.

@0xZaddyy 0xZaddyy changed the title Rename _danger-local-https to _manual-tls & Refactor TLS Certificate Handling Rename _danger-local-https to _manual-tls Jul 16, 2025
@0xZaddyy 0xZaddyy force-pushed the change-danger branch 6 times, most recently from fbf5d4a to 2ec825d Compare July 31, 2025 23:43
@0xZaddyy 0xZaddyy marked this pull request as ready for review July 31, 2025 23:44
@coveralls
Copy link
Collaborator

coveralls commented Jul 31, 2025

Pull Request Test Coverage Report for Build 17130350626

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 86.529%

Totals Coverage Status
Change from base Build 17129145427: 0.0%
Covered Lines: 7862
Relevant Lines: 9086

💛 - Coveralls

@0xZaddyy 0xZaddyy force-pushed the change-danger branch 2 times, most recently from 9f7308c to 57f3292 Compare August 1, 2025 12:50
Copy link
Collaborator

@nothingmuch nothingmuch left a comment

Choose a reason for hiding this comment

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

ACK, but this PR can be trivial if rebased on #913 which introduces certificate fields to the app config & cli params

i think we can also consider making this manual_tls not _manual_tls, supporting this as feature in payjoin-cli for people who want to run v1 receivers manually provided certificates (--certificate-key seems generally useful, but not sure what value --root-certificate or more generally self signed certificaes have outside of testing). @DanGould thoughts?

Comment on lines +59 to +58
#[cfg(feature = "_manual-tls")]
fn http_agent(cert: Option<Vec<u8>>) -> Result<reqwest::Client> {
match cert {
Some(cert_der) => build_http_agent_with_cert(&cert_der),
None =>
if let Ok(base64_cert) = std::env::var("MANUAL_TLS_CERT") {
let cert_der = base64::decode(base64_cert)?;
build_http_agent_with_cert(&cert_der)
} else {
Err(anyhow::anyhow!("No certificate provided for manual TLS mode"))
},
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think the #913 approach is a bit cleaner since http_agent just accepts the config regardless of feature flags, so if you agree i would prefer if this PR was rebased on top of it, at which point it should be a trivial change that just renames the feature flag and does not introduce new logic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright sounds good :)
I’ll drop the new logic and just go with the feature flag rename so it aligns with #913

@0xZaddyy 0xZaddyy force-pushed the change-danger branch 2 times, most recently from 04b0aa5 to d79884f Compare August 3, 2025 18:15
@0xZaddyy 0xZaddyy force-pushed the change-danger branch 2 times, most recently from a31ab51 to 2f58524 Compare August 3, 2025 18:28
@0xZaddyy 0xZaddyy requested a review from nothingmuch August 3, 2025 18:28
@spacebear21
Copy link
Collaborator

@0xZaddyy looks like there have been significant conflicts since #913 got merged, could you rebase this PR?

@0xZaddyy
Copy link
Contributor Author

@0xZaddyy looks like there have been significant conflicts since #913 got merged, could you rebase this PR?

sure will get this fixed now

This change updates the feature flag `_danger-local-https` to `_manual-tls`
to better reflect the actual behavior and reduce misleading implications
about its risk level. The new name clarifies that TLS certificates are only
accepted manually and not validated by default.
@0xZaddyy
Copy link
Contributor Author

@spacebear21 all set
it’s fixed!

@spacebear21
Copy link
Collaborator

ACK, the CI failure is unrelated and getting fixed in #986 . Thanks @0xZaddyy

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.

Change _danger-local-https to _manual-tls

7 participants