PowerShell icon indicating copy to clipboard operation
PowerShell copied to clipboard

Add support for Cert:\Service certificates

Open jborean93 opened this issue 2 years ago • 19 comments

PR Summary

Add support for managing service certificate stores using the Cert:\Service$serviceName$storeName syntax. This expands on the existing set of locations CurrentUser and LocalMachine and also sets up the code to support future store locations like User.

PR Context

Windows supports certificates to be stored in a service context which can be used by services like NTDS to store a certificate used for LDAPS. Currently the Cert provider only supports the CurrentUser and LocalMachine locations and dotnet does not offer a managed way to open any other locations. This adds the capability to manage stores for another service under Cert:\Service\$serviceName, for example Get-ChildItem -Path Cert:\Service\NTDS\My will enumerate all the certificates in the Personal\My store for the NTDS service.

PR Checklist

jborean93 avatar Mar 07 '23 00:03 jborean93

This still needs tests and some doc updates. I prefer not to work on this unless I know the PowerShell team is at all interested in the changes here. If not I won't spend any more time on it.

jborean93 avatar Mar 07 '23 00:03 jborean93

@jborean93 I've asked the Engines WG to make a call

SteveL-MSFT avatar Mar 07 '23 03:03 SteveL-MSFT

I personally like this and ready to review.

/cc @SteveL-MSFT

iSazonov avatar Mar 07 '23 06:03 iSazonov

I think it's a great enhancement for the certificate provider, and we should take this one.

daxian-dbw avatar Mar 09 '23 18:03 daxian-dbw

Cmdlet-WG will be reviewing this (and others) on Wed

SteveL-MSFT avatar Mar 13 '23 19:03 SteveL-MSFT

Docs PR for this new feature https://github.com/MicrosoftDocs/PowerShell-Docs/pull/9932. This should be ready for a proper review now.

jborean93 avatar Mar 21 '23 04:03 jborean93

@adityapatwardhan I've fixed up the CodeFactor errors.

jborean93 avatar Apr 04 '23 04:04 jborean93

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. Maintainer, please provide feedback and/or mark it as Waiting on Author

ghost avatar Apr 18 '23 14:04 ghost

@jborean93 May I ask why you decided to close this PR? This feels like a good enhancement in my opinion.

daxian-dbw avatar Apr 20 '23 00:04 daxian-dbw

In fact, the Engine WG talked about this PR in the meeting of 3/20/2023, but I forgot to post a comment for the conclusion. I apologize for that. The Engine WG agreed that we should accept this PR.

daxian-dbw avatar Apr 21 '23 00:04 daxian-dbw

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. Maintainer, please provide feedback and/or mark it as Waiting on Author

ghost avatar Apr 28 '23 02:04 ghost

This PR has 329 quantified lines of changes. In general, a change size of upto 200 lines is ideal for the best PR experience!


Quantification details

Label      : Large
Size       : +234 -95
Percentile : 72.9%

Total files changed: 6

Change summary by file extension:
.resx : +1 -1
.cs : +168 -90
.ps1 : +65 -4

Change counts above are quantified counts, based on the PullRequestQuantifier customizations.

Why proper sizing of changes matters

Optimal pull request sizes drive a better predictable PR flow as they strike a balance between between PR complexity and PR review overhead. PRs within the optimal size (typical small, or medium sized PRs) mean:

  • Fast and predictable releases to production:
    • Optimal size changes are more likely to be reviewed faster with fewer iterations.
    • Similarity in low PR complexity drives similar review times.
  • Review quality is likely higher as complexity is lower:
    • Bugs are more likely to be detected.
    • Code inconsistencies are more likely to be detected.
  • Knowledge sharing is improved within the participants:
    • Small portions can be assimilated better.
  • Better engineering practices are exercised:
    • Solving big problems by dividing them in well contained, smaller problems.
    • Exercising separation of concerns within the code changes.

What can I do to optimize my changes

  • Use the PullRequestQuantifier to quantify your PR accurately
    • Create a context profile for your repo using the context generator
    • Exclude files that are not necessary to be reviewed or do not increase the review complexity. Example: Autogenerated code, docs, project IDE setting files, binaries, etc. Check out the Excluded section from your prquantifier.yaml context profile.
    • Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in your prquantifier.yaml context profile.
    • Only use the labels that matter to you, see context specification to customize your prquantifier.yaml context profile.
  • Change your engineering behaviors
    • For PRs that fall outside of the desired spectrum, review the details and check if:
      • Your PR could be split in smaller, self-contained PRs instead
      • Your PR only solves one particular issue. (For example, don't refactor and code new features in the same PR).

How to interpret the change counts in git diff output

  • One line was added: +1 -0
  • One line was deleted: +0 -1
  • One line was modified: +1 -1 (git diff doesn't know about modified, it will interpret that line like one addition plus one deletion)
  • Change percentiles: Change characteristics (addition, deletion, modification) of this PR in relation to all other PRs within the repository.


Was this comment helpful? :thumbsup:  :ok_hand:  :thumbsdown: (Email) Customize PullRequestQuantifier for this repository.

Ping on this one, I've addressed as much as I can on the last review so wanting to try and progress this one some more.

jborean93 avatar Mar 15 '24 01:03 jborean93

can you make this an experimental feature?

I understand the suggestion to designate this as an experimental feature, but I'm not fully convinced of its necessity at this stage. Currently, the new feature operates on an opt-in basis, simply by adding an extra directory entry in the provider path. Introducing it as an experimental feature might inadvertently make it harder for users to discover. Additionally, it could potentially complicate the codebase, requiring various conditional statements to manage support for the feature across different areas it affects.

From a developer's standpoint, I've encountered challenges with implementing experimental features in the past, particularly concerning documentation and testing procedures. It's been a somewhat frustrating experience, as each pull request seems to handle things slightly differently. Perhaps we could spend some time outside of this PR to explore improving the documentation and general workflow when it comes to experimental features. This will help not just myself but developer's and also give maintainers a nice easy way to request new features be implemented as an experimental feature.

jborean93 avatar May 13 '24 19:05 jborean93

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. Maintainer, please provide feedback and/or mark it as Waiting on Author