Skip to content

fix: tedge mqtt panics on invalid MQTT topics#3396

Merged
didier-wenzek merged 1 commit intothin-edge:mainfrom
didier-wenzek:fix/tedge-mqtt-sub-panic
Feb 12, 2025
Merged

fix: tedge mqtt panics on invalid MQTT topics#3396
didier-wenzek merged 1 commit intothin-edge:mainfrom
didier-wenzek:fix/tedge-mqtt-sub-panic

Conversation

@didier-wenzek
Copy link
Copy Markdown
Contributor

Proposed changes

  • check topic filter passed to tedge mqtt sub
  • check topic passed to tedge mqtt pub

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (general improvements like code refactoring that doesn't explicitly fix a bug or add any new functionality)
  • Documentation Update (if none of the other choices apply)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Paste Link to the issue

#3395

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA (in all commits with git commit -s)
  • I ran cargo fmt as mentioned in CODING_GUIDELINES
  • I used cargo clippy as mentioned in CODING_GUIDELINES
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

@didier-wenzek didier-wenzek added bug Something isn't working theme:cli Theme: cli related topics labels Feb 12, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 12, 2025

Codecov Report

Attention: Patch coverage is 0% with 17 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/core/tedge/src/cli/mqtt/subscribe.rs 0.00% 11 Missing ⚠️
crates/core/tedge/src/cli/mqtt/publish.rs 0.00% 3 Missing and 1 partial ⚠️
crates/core/tedge/src/cli/mqtt/cli.rs 0.00% 2 Missing ⚠️
Additional details and impacted files

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 12, 2025

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
584 0 3 584 100 1h33m53.557841s

Sub {
/// Topic to subscribe to
topic: String,
#[arg(value_parser = TopicFilter::new)]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
#[arg(value_parser = TopicFilter::new)]
#[arg(value_parser = SimpleTopicFilter::new)]

Without that, I didn't really get how the implicit conversion from TopicFilter into SimpleTopicFilter was happening.

Copy link
Copy Markdown
Contributor Author

@didier-wenzek didier-wenzek Feb 12, 2025

Choose a reason for hiding this comment

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

Yup ... leading to tons of failing tests. => fixed.

What's weird is that this compile fine.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What's weird is that this compile fine.

Yeah, I was also surprised by that.

Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
Copy link
Copy Markdown
Contributor

@albinsuresh albinsuresh left a comment

Choose a reason for hiding this comment

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

LGTM

@didier-wenzek didier-wenzek added this pull request to the merge queue Feb 12, 2025
Merged via the queue into thin-edge:main with commit 8017f74 Feb 12, 2025
33 checks passed
@didier-wenzek didier-wenzek deleted the fix/tedge-mqtt-sub-panic branch February 12, 2025 17:55
@reubenmiller reubenmiller changed the title fix: tegde mqtt panics on invalid MQTT topics fix: tedge mqtt panics on invalid MQTT topics Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working theme:cli Theme: cli related topics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants