Skip to content

Should native command errors have the executable path or invocation as the TargetObject instead of the name? #15992

Closed

Description

@rjmholt

Summary of the new feature / enhancement

In #15897 we added in the executable name as the ErrorRecord TargetObject at the last minute.

But when we write the error, we also have:

  • The whole process object of the executable
  • The start info object
  • And on that, the executable path and arguments

Would it be better/more helpful to make any of those the TargetObject?

Proposed technical implementation details (optional)

No response

Activity

  1. added
    Issue-Enhancement
    Needs-Triage
    on Aug 24, 2021
  2. vexx32 commented on Aug 24, 2021

    @vexx32
    Collaborator

    I think we brought this up in an engine working group meeting when we were discussing Keith Hill (@rkeithhill)'s PR a handful of weeks ago.

    From memory, the main points raised were:

    • Extra information would be good, but we'd need to be careful that we aren't leaking secrets/sensitive input in this way (e.g., from command line args)
    • The process ID probably isn't going to be of great use since this exception is thrown after the executable exits.

    Keith might have more complete notes, I think he was taking notes then.


    I think it's probably reasonably safe to have the process object itself be the target object? I don't think any really sensitive information would be left on the process object unless you can access the startinfo from there.

  3. rkeithhill commented on Aug 24, 2021

    @rkeithhill
    Collaborator

    We discussed adding the arguments and/or command line as another property on the exception - in addition to Path, ProcessId and ExitCode. But we decided that was dangerous because it might show api keys/tokens. I vote for just including the full path to the executable.

  4. rkeithhill commented on Aug 24, 2021

    @rkeithhill
    Collaborator

    unless you can access the startinfo from there.

    You can:

    PS> $p.StartInfo.Arguments
    -apiToken 123456789abcdef
    
  5. rjmholt commented on Aug 25, 2021

    @rjmholt
    CollaboratorAuthor

    I think we brought this up in an engine working group meeting when we were discussing Keith Hill (@rkeithhill)'s PR a handful of weeks ago.

    Yeah, we decided on what should be on the actual exception. I just wanted to see what the ideal TargetObject for the error record should be, in terms of information, consistency and discoverability.

  6. added
    WG-Engine
    and removed
    Needs-Triage
    on Aug 30, 2021
  7. added a commit that references this issue on Sep 15, 2021
    0a06a1c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-EnhancementResolution-FixedWG-Engine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions