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

ValidationScript might cause false positives if client script uses variables with the same name #99

Open
EdmundoMartinez opened this issue Jan 31, 2018 · 1 comment

Comments

@EdmundoMartinez
Copy link
Member

When a client script uses a variable with the same name used in a ValidationScript that references other parameters by name, the validation can cause a false positive, because PowerShell will see the client's script variable in the validation script.

An example of this is when calling Update-ApplicationFlightSubmission sending required parameters and specifying the "-Force" switch without specifying the SubmissionId parameter, but the client script defines a $SubmissionId variable:

$submissionId = "123456..";
Update-ApplicationFlightSubmission -Force;

At this moment, the validation script for Update-ApplicationFlightSubmission will fail because it expects NOT to see a variable called $submissionId, which is now visible since the client script defined it.

This is fixed by moving the validation from the Validation Script to the function body for any ValidationScript that references other parameters.

This is confirmed to happen in Update-ApplicationFlightSubmission, but this should be changed in any ValidationScript code.

@danbelcher-MSFT
Copy link
Contributor

We should implement the fix by separating the two parameters into different parameter sets.

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

No branches or pull requests

2 participants