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

fix: handle peer names with special chars #2169

Merged
merged 1 commit into from
Apr 8, 2023

Conversation

jkitman
Copy link
Contributor

@jkitman jkitman commented Apr 7, 2023

Fixes #2074

@SumantxD took a shot at fixing it, using your string replacement code

@jkitman jkitman marked this pull request as ready for review April 7, 2023 15:29
@jkitman jkitman requested a review from a team as a code owner April 7, 2023 15:29
@codecov
Copy link

codecov bot commented Apr 7, 2023

Codecov Report

Patch coverage: 77.77% and project coverage change: 0.01 🎉

Comparison is base (19887e1) 60.24% compared to head (c5c40c5) 60.26%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2169       /-   ##
==========================================
  Coverage   60.24%   60.26%    0.01%     
==========================================
  Files         152      152              
  Lines       30900    30898       -2     
==========================================
  Hits        18617    18621        4     
  Misses      12283    12277       -6     
Impacted Files Coverage Δ
fedimint-bin-tests/src/federation.rs 0.00% <0.00%> (ø)
fedimint-server/src/config/api.rs 92.29% <ø> ( 0.12%) ⬆️
fedimint-server/src/config/io.rs 66.66% <ø> ( 0.68%) ⬆️
fedimint-testing/src/bin/fixtures.rs 0.24% <0.00%> (ø)
fedimint-server/src/config/mod.rs 78.70% <100.00%> ( 0.03%) ⬆️
fedimint-server/src/net/connect.rs 93.87% <100.00%> ( 0.19%) ⬆️

... and 8 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@m1sterc001guy
Copy link
Contributor

Are peer names used anywhere else besides the TLS cert? Only worry with silently replacing the bad characters with _ is if the user actually needs to use the peer name somewhere else, but now it's not what they expect.

@@ -185,7 185,7 @@ pub async fn run_dkg(root_task_group: &TaskGroup, servers: usize) -> anyhow::Res
async fn create_tls(id: usize, sender: Sender<String>) -> anyhow::Result<()> {
// set env vars
let bin_dir = env::var("FM_BIN_DIR")?;
let server_name = format!("Server-{id}");
let server_name = format!("Server {id}!");
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should just

 info!(peer-id=peer_id, out-dir=out_dir", "creating TLS certs created for peer in {out_dir}");

kind of thing, instead of interpolating strings for logging.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't this being used as a cmd line arg, not logging?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand that nit either, looks good to me, just test code running the dkg.

@jkitman
Copy link
Contributor Author

jkitman commented Apr 7, 2023

Are peer names used anywhere else besides the TLS cert?

They are only replaced when used as a cert, otherwise they will be kept original everywhere else. We just use the peer name in the TLS cert arbitrarily, it could be anything.

@jkitman jkitman enabled auto-merge (squash) April 7, 2023 17:42
Copy link
Contributor

@elsirion elsirion left a comment

Choose a reason for hiding this comment

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

We pin certs to peers, so actually don't care about domain names, otherwise we'd need to be careful with collisions here.

@jkitman jkitman merged commit e00b674 into fedimint:master Apr 8, 2023
@jkitman
Copy link
Contributor Author

jkitman commented Apr 9, 2023

otherwise we'd need to be careful with collisions here

@elsirion Certs are pinned to the P2P endpoint in config gen, shouldn't that be enough?

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.

Replace invalid chars in peer_name with '_'
4 participants