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

Placeholder input validation #287

Closed
wants to merge 5 commits into from
Closed

Conversation

xlcheng1
Copy link
Contributor

Motivation

  • If customers accidentally use a placeholder value (or value that cannot be expanded by wordexp) for certain parameters in config file, device client will have a segmentation fault because of ExtractExpandedPath() function.

Modifications

Change summary

  • Added checks when parsing config file
  • Added a placeholderInput test

Revision diff summary

If there is more than one revision, please explain what has been changed since the last revision.

Testing

Is your change tested? If not, please justify the reason.
Please list your testing steps and test results.

  • CI test run result:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@@ -1047,22 +1040,6 @@ bool PlainConfig::FleetProvisioning::Validate() const
return false;
}

if (csrFile.has_value() && !csrFile->empty())
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this part removed?

@@ -1239,24 +1216,6 @@ bool PlainConfig::PubSub::Validate() const
{
return true;
}
if (!publishTopic.has_value() || publishTopic->empty())
Copy link
Contributor

Choose a reason for hiding this comment

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

Also why is this part removed?

@@ -354,10 +354,6 @@ bool PlainConfig::Validate() const
LOGM_ERROR(Config::TAG, "*** %s: Certificate is missing ***", DeviceClient::DC_FATAL_ERROR);
return false;
}
else if (!FileUtils::IsValidFilePath(cert->c_str()))
Copy link
Contributor

Choose a reason for hiding this comment

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

I am a little bit confused on this, don't we still need to have this if we pass in params via CLI?

@@ -1047,22 +1040,6 @@ bool PlainConfig::FleetProvisioning::Validate() const
return false;
}

if (csrFile.has_value() && !csrFile->empty())
{
if (!FileUtils::IsValidFilePath(csrFile->c_str()))
Copy link
Contributor

Choose a reason for hiding this comment

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

here as well

@xlcheng1
Copy link
Contributor Author

closing this pr because PR #288 is providing better approach solving the issue.

@xlcheng1 xlcheng1 closed this Jul 13, 2022
@HarshGandhi-AWS HarshGandhi-AWS deleted the placeholderInputValidation branch April 20, 2023 22:13
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.

3 participants