diff --git a/.github/workflows/expectations.yml b/.github/workflows/expectations.yml index 750e067..4bf6ac8 100644 --- a/.github/workflows/expectations.yml +++ b/.github/workflows/expectations.yml @@ -5,7 +5,7 @@ name: Commenting on: schedule: - - cron: 0/10 * * * * + - cron: 0/30 * * * * permissions: contents: read pull-requests: write diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml new file mode 100644 index 0000000..e3b4e06 --- /dev/null +++ b/.markdownlint-cli2.yaml @@ -0,0 +1,33 @@ +# Rule definitions live in .markdownlint.json + +# Include a custom rule package +# customRules: +# - markdownlint-rule-titlecase + +# Fix any fixable errors +fix: true + +# Define a custom front matter pattern +# frontMatter: (^---\s*$[^]*?^---\s*$)(\r\n|\r|\n|$) + +# Define glob expressions to use (only valid at root) +# globs: +# - "!*bout.md" + +# Define glob expressions to ignore +ignores: + - breadcrumb + +# Use a plugin to recognize math +# markdownItPlugins: +# - - "@iktakahiro/markdown-it-katex" + +# Disable inline config comments +noInlineConfig: false + +# Disable progress on stdout (only valid at root) +noProgress: true + +# Use a specific formatter (only valid at root) +# outputFormatters: +# - [markdownlint-cli2-formatter-default] diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..cc5c8d2 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,132 @@ +{ + "blanks-around-fences": true, + "blanks-around-headers": true, + "blanks-around-lists": true, + "code-block-style": { + "style": "fenced" + }, + "code-fence-style": { + "style": "backtick" + }, + "commands-show-output": true, + "docsmd.alert": true, + "docsmd.codesnippet": true, + "docsmd.column": true, + "docsmd.image": true, + "docsmd.moniker": true, + "docsmd.no-loc": true, + "docsmd.row": true, + "docsmd.securelinks": true, + "docsmd.syntax": true, + "docsmd.video": true, + "docsmd.xref": true, + "docsmd.zone": true, + "emphasis-style": { + "style": "underscore" + }, + "fenced-code-language": false, + "first-line-h1": { + "front_matter_title": "" + }, + "header-increment": true, + "header-start-left": true, + "header-style": { + "style": "atx" + }, + "hr-style": { + "style": "---" + }, + "line-length": { + "code_block_line_length": 90, + "code_blocks": true, + "heading_line_length": 100, + "headings": true, + "line_length": 100, + "stern": true, + "tables": false + }, + "list-indent": true, + "list-marker-space": true, + "no-alt-text": true, + "no-bare-urls": true, + "no-blanks-blockquote": true, + "no-duplicate-header": { + "siblings_only": true + }, + "no-emphasis-as-header": true, + "no-empty-links": true, + "no-hard-tabs": true, + "no-inline-html": { + "allowed_elements": [ + "a", + "br", + "code", + "kbd", + "li", + "properties", + "sup", + "tags", + "ul" + ] + }, + "no-missing-space-atx": true, + "no-missing-space-closed-atx": true, + "no-multiple-blanks": true, + "no-multiple-space-atx": true, + "no-multiple-space-blockquote": true, + "no-multiple-space-closed-atx": true, + "no-reversed-links": true, + "no-space-in-code": true, + "no-space-in-emphasis": true, + "no-space-in-links": true, + "no-trailing-punctuation": { + "punctuation": ".,;:!。,;:!?" + }, + "no-trailing-spaces": { + "br_spaces": 2, + "strict": true + }, + "ol-prefix": { + "style": "one" + }, + "proper-names": { + "code_blocks": false, + "names": [ + "PowerShell", + "IntelliSense", + "Authenticode", + "CentOS", + "Contoso", + "CoreOS", + "Debian", + "Ubuntu", + "openSUSE", + "RHEL", + "JavaScript", + ".NET", + "NuGet", + "VS Code", + "Newtonsoft" + ] + }, + "required-headers": false, + "single-h1": { + "front_matter_title": "", + "level": 1 + }, + "single-trailing-newline": true, + "strong-style": { + "style": "asterisk" + }, + "ul-indent": { + "indent": 2, + "start_indented": false + }, + "ul-start-left": true, + "ul-style": { + "style": "dash" + }, + "link-fragments": true, + "reference-links-images": true, + "link-image-reference-definitions": true +} diff --git a/reference/docs-conceptual/PSScriptAnalyzer/Rules/.markdownlint.json b/reference/docs-conceptual/PSScriptAnalyzer/Rules/.markdownlint.json new file mode 100644 index 0000000..39a15cd --- /dev/null +++ b/reference/docs-conceptual/PSScriptAnalyzer/Rules/.markdownlint.json @@ -0,0 +1,4 @@ +{ + "extends": "../../../../.markdownlint.json", + "no-emphasis-as-heading": false +} diff --git a/reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidUsingBrokenHashAlgorithms.md b/reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidUsingBrokenHashAlgorithms.md new file mode 100644 index 0000000..83b7592 --- /dev/null +++ b/reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidUsingBrokenHashAlgorithms.md @@ -0,0 +1,48 @@ +--- +description: Avoid using broken hash algorithms +ms.custom: PSSA v1.21.0 +ms.date: 05/31/2022 +ms.topic: reference +title: AvoidUsingBrokenHashAlgorithms +--- +# AvoidUsingBrokenHashAlgorithms + +**Severity Level: Warning** + +## Description + +Avoid using the broken algorithms MD5 or SHA-1. + +## How + +Replace broken algorithms with secure alternatives. MD5 and SHA-1 should be replaced with SHA256, +SHA384, SHA512, or other safer algorithms when possible, with MD5 and SHA-1 only being utilized by +necessity for backwards compatibility. + +## Example 1 + +### Wrong + +```powershell +Get-FileHash foo.txt -Algorithm MD5 +``` + +### Correct + +```powershell +Get-FileHash foo.txt -Algorithm SHA256 +``` + +## Example 2 + +### Wrong + +```powershell +Get-FileHash foo.txt -Algorithm SHA1 +``` + +### Correct + +```powershell +Get-FileHash foo.txt +``` diff --git a/reference/docs-conceptual/PSScriptAnalyzer/Rules/README.md b/reference/docs-conceptual/PSScriptAnalyzer/Rules/README.md index ee86175..528d5ad 100644 --- a/reference/docs-conceptual/PSScriptAnalyzer/Rules/README.md +++ b/reference/docs-conceptual/PSScriptAnalyzer/Rules/README.md @@ -26,6 +26,7 @@ The PSScriptAnalyzer contains the following rule definitions. | [AvoidSemicolonsAsLineTerminators](./AvoidSemicolonsAsLineTerminators.md) | Warning | No | | | [AvoidShouldContinueWithoutForce](./AvoidShouldContinueWithoutForce.md) | Warning | Yes | | | [AvoidTrailingWhitespace](./AvoidTrailingWhitespace.md) | Warning | Yes | | +| [AvoidUsingBrokenHashAlgorithms](./AvoidUsingBrokenHashAlgorithms.md) | Warning | Yes | | | [AvoidUsingCmdletAliases](./AvoidUsingCmdletAliases.md) | Warning | Yes | Yes2 | | [AvoidUsingComputerNameHardcoded](./AvoidUsingComputerNameHardcoded.md) | Error | Yes | | | [AvoidUsingConvertToSecureStringWithPlainText](./AvoidUsingConvertToSecureStringWithPlainText.md) | Error | Yes | | diff --git a/reference/docs-conceptual/toc.yml b/reference/docs-conceptual/toc.yml index a3c26b6..f6aee6e 100644 --- a/reference/docs-conceptual/toc.yml +++ b/reference/docs-conceptual/toc.yml @@ -71,6 +71,8 @@ items: href: PSScriptAnalyzer/Rules/AvoidShouldContinueWithoutForce.md - name: AvoidTrailingWhitespace href: PSScriptAnalyzer/Rules/AvoidTrailingWhitespace.md + - name: AvoidUsingBrokenHashAlgorithms + href: PSScriptAnalyzer/Rules/AvoidUsingBrokenHashAlgorithms.md - name: AvoidUsingCmdletAliases href: PSScriptAnalyzer/Rules/AvoidUsingCmdletAliases.md - name: AvoidUsingComputerNameHardcoded diff --git a/reference/ps-modules/Microsoft.PowerShell.Crescendo/About/.markdownlint.json b/reference/ps-modules/Microsoft.PowerShell.Crescendo/About/.markdownlint.json new file mode 100644 index 0000000..a7af527 --- /dev/null +++ b/reference/ps-modules/Microsoft.PowerShell.Crescendo/About/.markdownlint.json @@ -0,0 +1,12 @@ +{ + "extends": "../../../../.markdownlint.json", + "line-length": { + "code_block_line_length": 74, + "code_blocks": true, + "heading_line_length": 79, + "headings": true, + "line_length": 79, + "stern": true, + "tables": false + } +} diff --git a/reference/ps-modules/Microsoft.PowerShell.Crescendo/About/about_Crescendo.md b/reference/ps-modules/Microsoft.PowerShell.Crescendo/About/about_Crescendo.md index 9e060f7..30711b3 100644 --- a/reference/ps-modules/Microsoft.PowerShell.Crescendo/About/about_Crescendo.md +++ b/reference/ps-modules/Microsoft.PowerShell.Crescendo/About/about_Crescendo.md @@ -1,7 +1,7 @@ --- description: Describes the purpose of the Crescendo module. Locale: en-US -ms.date: 01/21/2022 +ms.date: 08/18/2022 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.crescendo/about/about_Microsoft.PowerShell.Crescendo?view=ps-modules.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Microsoft.PowerShell.Crescendo @@ -10,26 +10,26 @@ title: about_Microsoft.PowerShell.Crescendo ## about_Microsoft.PowerShell.Crescendo -## SHORT DESCRIPTION +## Short description The PowerShell Crescendo module provides a novel way to create proxy functions for native commands via `JSON` configuration files. -## LONG DESCRIPTION +## Long description PowerShell is capable of invoking native applications like any shell. However, it would improve the experience if the native command could participate in the PowerShell pipeline and take advantage of the parameter behaviors that are part of PowerShell. -The PowerShell Crescendo module provides a way to more easily take advantage of -the PowerShell pipeline by invoking the native executable, facilitating -parameter handling, and converting text output into objects. +The PowerShell Crescendo module provides a way to take advantage of the +PowerShell pipeline by invoking the native executable, facilitating parameter +handling, and converting text output into objects. ## JSON Configuration The PowerShell Crescendo module provides a way to create a small bit of JSON -that is used to create a function that calls the native command. +that's used to create a function that calls the native command. An annotated schema is provided as part of the module that can improve the authoring process. @@ -41,9 +41,9 @@ commands in the same way you do with cmdlets. ## Output Handling -It is also possible to provide a script block that can be used to convert the -output from the native command into objects. If the native command emits `json` -or `xml` it is as simple as: +It's also possible to create a script block that can be used to convert the +output from the native command into objects. If the native command emits JSON +or XML it can be as simple as: ```json "OutputHandler": [ @@ -54,12 +54,12 @@ or `xml` it is as simple as: However, script blocks of arbitrary complexity may also be used. -## EXAMPLES +## Examples -A number of samples are provided as part of the module, you can see these in -the Samples directory in the module base directory. +Several samples are provided as part of the module. You can find these in the +`Samples` directory of the module base directory. -A very simple example is as follows to wrap the unix `/bin/ls` command: +The following JSON is a minimal example that wraps the unix `/bin/ls` command: ```json { @@ -68,32 +68,42 @@ A very simple example is as follows to wrap the unix `/bin/ls` command: "Noun":"FileList", "OriginalName": "/bin/ls", "Parameters": [ - {"Name": "Path","OriginalName": "", "OriginalPosition": 1, "Position": 0, "DefaultValue": "." }, - {"Name": "Detail","OriginalName": "-l","ParameterType": "switch"} + { + "Name": "Path", + "OriginalName": "", + "OriginalPosition": 1, + "Position": 0, + "DefaultValue": "." + }, + { + "Name": "Detail", + "OriginalName": "-l", + "ParameterType": "switch" + } ] } ``` The name of the proxy function is `Get-FileList` and has two parameters: -- Path +- **Path** - Which is Position 0, and has a default value of "." -- Detail +- **Detail** - Which is a switch parameter and adds `-l` to the native command parameters A couple of things to note about the Path parameter - The `OriginalPosition` is set to 1 and the `OriginalName` is set to an empty - string. This is because some native commands have a parameter which is _not_ - named and must be the last parameter when executed. All parameters will be - ordered by the value of `OriginalPosition` (the default is 0) and when the - native command is called, those parameters (and their values) will be put in - that order. + string. This is because some native commands have a parameter that is _not_ + named and must be the last parameter when executed. All parameters get + ordered by the value of `OriginalPosition` (the default is 0). When the + native command is called, those parameters (and their values) are put in that + order. In this example, there is no output handler defined, so the text output of the -command will be returned to the pipeline. +command is returned to the pipeline. -A more complicated example which wraps the linux `apt` command follows: +The following is a more complicated example that wraps the linux `apt` command: ```json { @@ -117,10 +127,10 @@ A more complicated example which wraps the linux `apt` command follows: In this case, the output handler converts the text output to a `pscustomobject` to enable using other PowerShell cmdlets. When run, this provides an object -which encapsulates the `apt` output +that encapsulates the `apt` output ```powershell -PS> get-installedpackage | ?{ $_.name -match "libc"} +PS> Get-InstalledPackage | Where-Object { $_.name -match "libc"} Name Version Architecture State ---- ------- ------------ ----- @@ -130,7 +140,7 @@ libcap-ng0 0.7.9-2.1build1 amd64 {installed, local} libcom-err2 1.45.5-2ubuntu1 amd64 {installed, local} libcrypt1 1:4.4.10-10ubuntu4 amd64 {installed, local} -PS> get-installedpackage | Group-Object Architecture +PS> Get-InstalledPackage | Group-Object Architecture Count Name Group ----- ---- ----- @@ -138,16 +148,10 @@ Count Name Group 82 amd64 {@{Name=apt; Version=2.0.2ubuntu0.1; Architecture=amd64; State=System.String[]}, @{Name=base-files… ``` -## TROUBLESHOOTING NOTE +## See also -The PowerShell Crescendo module is still very early in the development process, -so we expect changes to be made. - -One issue is that the output handler is currently a string, so constructing the -script block may be complex; semi-colons will be required to separate -statements. This may be addressed in a later version. - -## SEE ALSO +The PowerShell Crescendo module is still in the development process, so we +expect changes to be made. The GitHub repository may be found at: [https://github.com/PowerShell/Crescendo](https://github.com/PowerShell/Crescendo). @@ -155,9 +159,11 @@ The GitHub repository may be found at: PowerShell Blog posts that present the rational and approaches for native command wrapping can be found here: +**Native commands in PowerShell a new approach** + - [Part 1](https://devblogs.microsoft.com/powershell/native-commands-in-powershell-a-new-approach/) -- [Part 2](https://devblogs.microsoft.com/powershell/native-commands-in-powershell-a-new-approach-part-2)) +- [Part 2](https://devblogs.microsoft.com/powershell/native-commands-in-powershell-a-new-approach-part-2) -## KEYWORDS +## Keywords Native Command diff --git a/reference/ps-modules/Microsoft.PowerShell.Crescendo/Export-CrescendoModule.md b/reference/ps-modules/Microsoft.PowerShell.Crescendo/Export-CrescendoModule.md index 416bb7b..997fd72 100644 --- a/reference/ps-modules/Microsoft.PowerShell.Crescendo/Export-CrescendoModule.md +++ b/reference/ps-modules/Microsoft.PowerShell.Crescendo/Export-CrescendoModule.md @@ -43,7 +43,7 @@ Export-CrescendoModule netsh netsh*.json -force ### -ConfigurationFile -This is a list of JSON files which represent the proxies for the module +This is a list of JSON files that represent the proxies for the module. ```yaml Type: System.String[] @@ -59,9 +59,8 @@ Accept wildcard characters: True ### -Force -By default, if `Export-CrescendoModule` finds an already created module, it will not overwrite the -existing file. Use the **Force** parameter to overwrite the existing file, or remove it prior to -running `Export-CrescendoModule`. +By default, if `Export-CrescendoModule` does not overwrite an existing module. Use the **Force** +parameter to overwrite the existing file, or remove it before running `Export-CrescendoModule`. ```yaml Type: System.Management.Automation.SwitchParameter @@ -109,7 +108,7 @@ Accept wildcard characters: False ### -WhatIf -Shows what would happen if the cmdlet runs. The cmdlet is not run. +Shows what would happen if the cmdlet runs. The cmdlet isn't run. ```yaml Type: System.Management.Automation.SwitchParameter @@ -144,6 +143,13 @@ individual function. Finally, all proxies are used to create an `Export-ModuleMe invocation, so when the resultant module is imported, the module has all the command proxies available. +`Export-CrescendoModule` adds the **CrescendoBuilt** tag to the module manifest. You can use this +tag to find modules in the PowerShell Gallery that were created using Crescendo. For more +information, see: + +- [Gallery Search Syntax](/powershell/scripting/gallery/how-to/finding-packages/search-syntax) +- [Find-Module](/powershell/module/powershellget/find-module) + ## RELATED LINKS [Import-CommandConfiguration](Import-CommandConfiguration.md) diff --git a/reference/ps-modules/PlatyPS/About/.markdownlint.json b/reference/ps-modules/PlatyPS/About/.markdownlint.json new file mode 100644 index 0000000..a7af527 --- /dev/null +++ b/reference/ps-modules/PlatyPS/About/.markdownlint.json @@ -0,0 +1,12 @@ +{ + "extends": "../../../../.markdownlint.json", + "line-length": { + "code_block_line_length": 74, + "code_blocks": true, + "heading_line_length": 79, + "headings": true, + "line_length": 79, + "stern": true, + "tables": false + } +}