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

GH952: Refactor DotNetCore args string->ArgumentBuilder #953

Merged
merged 1 commit into from
Jun 6, 2016

Conversation

devlead
Copy link
Member

@devlead devlead commented Jun 3, 2016

This is a proposed fix for #952

Currently the DotNetCore DotNetCoreExecute and DotNetCoreRun uses a quoted single string for args, this breaks in some scenarios also wont allow filtering sensitive data.

This PR

  • Refactors arguments from string to ProcessArgumentBuilder
    • This takes benefit from all ProcessArgumentBuilder extensions available
    • Enables RenderSafe to work for verbose logging
  • Adds CopyTo(ProcessArgumentBuilder target) method to ProcessArgumentBuilder
    • This allows without exposing internals to append the content of one ProcessArgumentBuilder to another
  • Adds an IsEmpty() method to ProcessArgumentBuilder
    • This indicates if ProcessArgumentBuilder has any args / would render empty.

@devlead devlead force-pushed the feature/GH-952 branch 2 times, most recently from d85242b to 4cd7964 Compare June 3, 2016 21:56
/// Copies all the arhuments of the current <see cref="ProcessArgumentBuilder"/> to target <see cref="ProcessArgumentBuilder"/>.
/// </summary>
/// <param name="target">The copy target.</param>
public void CopyTo(ProcessArgumentBuilder target)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it makes more sense exposing the tokens as a IReadOnlyList<IProcessArgument> and add those two methods as extension methods since they only require read access.

Copy link
Member Author

Choose a reason for hiding this comment

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

Couldn't that potentially leak sensitive tokens?

Copy link
Member

Choose a reason for hiding this comment

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

Well, the person who got access to the token could just as well use the Render method, or am I missing something?

@gep13 gep13 changed the title WIP GH952: Refactor DotNetCore args string->ArgumentBuilder [WIP] GH952: Refactor DotNetCore args string->ArgumentBuilder Jun 5, 2016
@devlead devlead force-pushed the feature/GH-952 branch 2 times, most recently from 6244715 to 7ba346b Compare June 6, 2016 14:29
@devlead devlead changed the title [WIP] GH952: Refactor DotNetCore args string->ArgumentBuilder GH952: Refactor DotNetCore args string->ArgumentBuilder Jun 6, 2016
@devlead
Copy link
Member Author

devlead commented Jun 6, 2016

@patriksvensson refactored CopyTo / IsNullOrEmpty to pure extension methods, so think I've addressed your feedback. Also rebased against latest develop.

@@ -380,5 +380,39 @@ public static ProcessArgumentBuilder AppendQuotedSecret(this ProcessArgumentBuil
}
return builder;
}

/// <summary>
/// Indicates whether a <see cref="ProcessArgumentBuilder"/> is null or renders empty.
Copy link
Member

Choose a reason for hiding this comment

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

Should be indicates.

Copy link
Member Author

Choose a reason for hiding this comment

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

Unsure what you mean :)
image

Copy link
Member

Choose a reason for hiding this comment

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

Did I just have a stroke? I could have sworn it said indiates when I read it.

@patriksvensson
Copy link
Member

@devlead Left some minor comments. Looks good to me otherwise.

@devlead
Copy link
Member Author

devlead commented Jun 6, 2016

@patriksvensson think I've addressed your feedback now.

@patriksvensson patriksvensson merged commit f2abeeb into cake-build:develop Jun 6, 2016
@patriksvensson
Copy link
Member

Merged. Awesome work 👍

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.

2 participants