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

[21266] Example refactor: Security #5006

Merged
merged 12 commits into from
Jul 12, 2024
Merged

[21266] Example refactor: Security #5006

merged 12 commits into from
Jul 12, 2024

Conversation

Carlosespicur
Copy link
Contributor

@Carlosespicur Carlosespicur commented Jun 28, 2024

security folder created in examples with a modified version of hello_world, supporting security plugins.

Description

Added plugin configuration in xml file to support security plugins. Changed CLI parser to allow selection of publisher interval. README updated.

Namespaces and headers updated in all examples

Contributor Checklist

  • Commit messages follow the project guidelines.
  • The code follows the style guidelines of this project.
  • N/A Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally
  • N/A Any new/modified methods have been properly documented using Doxygen.
  • N/A Any new configuration API has an equivalent XML API (with the corresponding XSD extension)
  • N/A Changes are backport compatible: they do NOT break ABI nor change library core behavior.
  • N/A Changes are API compatible.
  • New feature has been added to the versions.md file (if applicable).
  • N/A New feature has been documented/Current behavior is correctly described in the documentation.
  • N/A Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • The title and description correctly express the PR's purpose.
  • Check contributor checklist is correct.
  • If this is a critical bug fix, backports to the critical-only supported branches have been requested.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

@Carlosespicur Carlosespicur force-pushed the feature/security_example branch 3 times, most recently from 83da20c to fa91cb1 Compare July 2, 2024 05:52
@EduPonz EduPonz added this to the v3.0.0 milestone Jul 3, 2024
Copy link
Member

@Mario-DL Mario-DL left a comment

Choose a reason for hiding this comment

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

Good starting point !
First thing would be rebasing the branch on top of master, solving the conflicts.
Leaving some suggestions to address.

examples/cpp/security/CLIParser.hpp Outdated Show resolved Hide resolved
examples/cpp/security/CLIParser.hpp Show resolved Hide resolved
examples/cpp/security/CMakeLists.txt Outdated Show resolved Hide resolved
examples/cpp/security/PublisherApp.hpp Outdated Show resolved Hide resolved
examples/cpp/security/SubscriberApp.hpp Outdated Show resolved Hide resolved
examples/cpp/security/README.md Outdated Show resolved Hide resolved
examples/cpp/security/SubscriberApp.cpp Outdated Show resolved Hide resolved
examples/cpp/security/hello_world_profile.xml Outdated Show resolved Hide resolved
test/examples/security.compose.yml Outdated Show resolved Hide resolved
versions.md Outdated Show resolved Hide resolved
@Mario-DL Mario-DL changed the title [21266] Add secured hello world example [21266] Add security example Jul 3, 2024
@Mario-DL Mario-DL changed the title [21266] Add security example [21266] Example refactor: Security Jul 3, 2024
@Carlosespicur Carlosespicur force-pushed the feature/security_example branch 3 times, most recently from 321b87a to 4d79da4 Compare July 8, 2024 09:30
Copy link
Member

@Mario-DL Mario-DL left a comment

Choose a reason for hiding this comment

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

We are getting closer !
As we internally commented, I attach some modified files. We should:

  • Remove hello_world_profile.xml and place the two provided profiles there instead.
  • Replace the security.compose.yml with the one provided
  • Update the README.md with the instructions for launching the example i.e defining the CERTS_PATH and FASTDDS_DEFAULT_PROFILES_FILE for each of the shells

Note: test the example in local and double check with wireshark that we see the SEC_PREFIX, SEC_BODY submsgs

files.zip

test/examples/test_security.py Outdated Show resolved Hide resolved
test/examples/test_security.py Outdated Show resolved Hide resolved
examples/cpp/security/main.cpp Outdated Show resolved Hide resolved
Copy link
Member

@Mario-DL Mario-DL left a comment

Choose a reason for hiding this comment

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

Please remove the old DiscoveryServerExample folder in examples/cpp/dds

Copy link
Member

@Mario-DL Mario-DL left a comment

Choose a reason for hiding this comment

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

Please, review all modified .cpp files since there are somre headers that are not needed. There should only be headers macros and header sorted by name changes

Copy link
Member

@Mario-DL Mario-DL left a comment

Choose a reason for hiding this comment

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

Please review the rest of the examples in which any .cpp and .hpp were modified. I left the modifications just for some of them, we should do something similar on the remaining ones.

examples/cpp/security/README.md Outdated Show resolved Hide resolved
examples/cpp/configuration/PublisherApp.cpp Outdated Show resolved Hide resolved
examples/cpp/configuration/PublisherApp.hpp Show resolved Hide resolved
examples/cpp/configuration/PublisherApp.cpp Outdated Show resolved Hide resolved
examples/cpp/configuration/SubscriberApp.cpp Outdated Show resolved Hide resolved
examples/cpp/custom_payload_pool/SubscriberApp.cpp Outdated Show resolved Hide resolved
examples/cpp/custom_payload_pool/SubscriberApp.cpp Outdated Show resolved Hide resolved
examples/cpp/custom_payload_pool/SubscriberApp.hpp Outdated Show resolved Hide resolved
Copy link
Member

@Mario-DL Mario-DL left a comment

Choose a reason for hiding this comment

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

Leaving another round of suggestions, most of them are nitpicky

examples/cpp/custom_payload_pool/Application.hpp Outdated Show resolved Hide resolved
examples/cpp/content_filter/CLIParser.hpp Outdated Show resolved Hide resolved
examples/cpp/content_filter/CustomContentFilterFactory.hpp Outdated Show resolved Hide resolved
examples/cpp/content_filter/PublisherApp.hpp Outdated Show resolved Hide resolved
examples/cpp/delivery_mechanisms/PubSubApp.cpp Outdated Show resolved Hide resolved
examples/cpp/delivery_mechanisms/PubSubApp.cpp Outdated Show resolved Hide resolved
@Carlosespicur Carlosespicur force-pushed the feature/security_example branch 2 times, most recently from e9ef466 to 0076d34 Compare July 11, 2024 13:45
Copy link
Member

@Mario-DL Mario-DL left a comment

Choose a reason for hiding this comment

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

Three suggestions only

examples/CMakeLists.txt Outdated Show resolved Hide resolved
examples/cpp/hello_world/Application.cpp Outdated Show resolved Hide resolved
Copy link
Member

@Mario-DL Mario-DL left a comment

Choose a reason for hiding this comment

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

Pls, rebase on top of master to avoid conflicts.
We also need to figure out a way in the CMakeLists.txt here to add the security test only if SECURITY is ON

examples/cpp/dds/CMakeLists.txt Outdated Show resolved Hide resolved
@Mario-DL
Copy link
Member

Mario-DL commented Jul 11, 2024

As an idea for addressing my former comment would be adding list(FILTER examples_python_tests EXCLUDE REGEX "*security*") if security is OFF

Signed-off-by: Carlosespicur <carlosespicur@proton.me>
Signed-off-by: Carlosespicur <carlosespicur@proton.me>
Signed-off-by: Carlosespicur <carlosespicur@proton.me>
Signed-off-by: Carlosespicur <carlosespicur@proton.me>
Signed-off-by: Carlosespicur <carlosespicur@proton.me>
Signed-off-by: Carlosespicur <carlosespicur@proton.me>
Signed-off-by: Carlosespicur <carlosespicur@proton.me>
Signed-off-by: Carlosespicur <carlosespicur@proton.me>
Signed-off-by: Carlosespicur <carlosespicur@proton.me>
Signed-off-by: Carlosespicur <carlosespicur@proton.me>
…MakeLists

Signed-off-by: Carlosespicur <carlosespicur@proton.me>
Copy link
Member

@Mario-DL Mario-DL left a comment

Choose a reason for hiding this comment

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

Good job here !
Lets ask for ci run

LGTM with Green CI
Linter pending

After github ci we should check in local that building without security and launching the example tests, correctly performs.

@Mario-DL Mario-DL self-requested a review July 11, 2024 15:10
@github-actions github-actions bot added the ci-pending PR which CI is running label Jul 11, 2024
Copy link
Member

@Mario-DL Mario-DL left a comment

Choose a reason for hiding this comment

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

3 small changes that should make the test and uncrustify pass.
The write() method returns a retcode that is 0 on success.

I am going to check in local that test.security is not run neither built if we compile with SECURITY=OFF and EXAMPLE_TESTS=ON

examples/cpp/security/PublisherApp.cpp Outdated Show resolved Hide resolved
examples/cpp/configuration/Application.hpp Outdated Show resolved Hide resolved
examples/cpp/configuration/PublisherApp.hpp Outdated Show resolved Hide resolved
test/examples/CMakeLists.txt Outdated Show resolved Hide resolved
…sts.txt

Signed-off-by: Carlosespicur <carlosespicur@proton.me>
Copy link
Member

@Mario-DL Mario-DL left a comment

Choose a reason for hiding this comment

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

LGTM with green CI !

Tested also that test.security is not run neither built if we compile with SECURITY=OFF, EXAMPLE_TESTS=ON and COMPILE_EXAMPLES=ON

@Mario-DL Mario-DL self-requested a review July 12, 2024 07:16
@Mario-DL Mario-DL added ready-to-merge Ready to be merged. CI and changes have been reviewed and approved. and removed ci-pending PR which CI is running labels Jul 12, 2024
Copy link
Member

@Mario-DL Mario-DL left a comment

Choose a reason for hiding this comment

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

LGTM

@EduPonz EduPonz merged commit 4e8dd38 into master Jul 12, 2024
15 of 17 checks passed
@EduPonz EduPonz deleted the feature/security_example branch July 12, 2024 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Ready to be merged. CI and changes have been reviewed and approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants