Skip to content

Commit

Permalink
Apply OSS guidelines #250 #251 (#260)
Browse files Browse the repository at this point in the history
- Apply OSS guidelines #250 #251
- Update culture handling for Format function #262
  • Loading branch information
BernieWhite authored Feb 6, 2020
1 parent a71c612 commit 9d3749c
Show file tree
Hide file tree
Showing 177 changed files with 754 additions and 316 deletions.
4 changes: 2 additions & 2 deletions .azure-pipelines/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# CI pipeline for PSRule.Rules.Azure

variables:
version: '0.8.0'
version: '0.9.0'
buildConfiguration: 'Release'
disable.coverage.autogenerate: 'true'

Expand Down Expand Up @@ -176,7 +176,7 @@ stages:
action: edit
tag: '$(Build.SourceBranchName)'
releaseNotesSource: inline
releaseNotesInline: 'See [change log](https://github.com/BernieWhite/PSRule.Rules.Azure/blob/master/CHANGELOG.md)'
releaseNotesInline: 'See [change log](https://github.com/Microsoft/PSRule.Rules.Azure/blob/master/CHANGELOG.md)'
assetUploadMode: replace
addChangeLog: false
isPreRelease: $(isPreRelease)
3 changes: 3 additions & 0 deletions .azure-pipelines/pipeline-deps.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

#
# Install dependencies for integration with Azure DevOps
#
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# https://help.github.com/articles/about-codeowners/
* @BernieWhite
* @microsoft/psrule-rules-azure
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
- [ ] Unit tests created/ updated
- [ ] Rule documentation created/ updated
- [ ] Link to a filed issue
- [ ] [Change log](https://github.com/BernieWhite/PSRule.Rules.Azure/blob/master/CHANGELOG.md) has been updated with change under unreleased section
- [ ] [Change log](https://github.com/Microsoft/PSRule.Rules.Azure/blob/master/CHANGELOG.md) has been updated with change under unreleased section
- **Other code changes**
- [ ] Unit tests created/ updated
- [ ] Link to a filed issue
- [ ] [Change log](https://github.com/BernieWhite/PSRule.Rules.Azure/blob/master/CHANGELOG.md) has been updated with change under unreleased section
- [ ] [Change log](https://github.com/Microsoft/PSRule.Rules.Azure/blob/master/CHANGELOG.md) has been updated with change under unreleased section
54 changes: 54 additions & 0 deletions .ps-rule/OpenSource.Rule.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

# Synopsis: Check for recommended community files
Rule 'OpenSource.Community' -Type 'System.IO.DirectoryInfo' {
$requiredFiles = @(
'CHANGELOG.md'
'LICENSE'
'CODE_OF_CONDUCT.md'
'CONTRIBUTING.md'
'SECURITY.md'
'README.md'
'.github/CODEOWNERS'
'.github/PULL_REQUEST_TEMPLATE.md'
)
Test-Path -Path $TargetObject.FullName;
for ($i = 0; $i -lt $requiredFiles.Length; $i++) {
$filePath = Join-Path -Path $TargetObject.FullName -ChildPath $requiredFiles[$i];
$Assert.Create((Test-Path -Path $filePath -PathType Leaf), "$($requiredFiles[$i]) does not exist");
}
}

# Synopsis: Check for license in code files
Rule 'OpenSource.License' -Type 'System.IO.FileInfo' -If { $TargetObject.Extension -in '.cs', '.ps1', '.psd1', '.psm1' } {
$commentPrefix = "`# ";
if ($TargetObject.Extension -eq '.cs') {
$commentPrefix = '// '
}
$header = GetLicenseHeader -CommentPrefix $commentPrefix;
$content = Get-Content -Path $TargetObject.FullName -Raw;
$content.StartsWith($header);
}

function global:GetLicenseHeader {
[CmdletBinding()]
[OutputType([String])]
param (
[Parameter(Mandatory = $True)]
[String]$CommentPrefix
)
process {
$text = @(
'Copyright (c) Microsoft Corporation.'
'Licensed under the MIT License.'
)
$builder = [System.Text.StringBuilder]::new();
foreach ($line in $text) {
$Null = $builder.Append($CommentPrefix);
$Null = $builder.Append($line);
$Null = $builder.Append([System.Environment]::NewLine);
}
return $builder.ToString();
}
}
2 changes: 2 additions & 0 deletions .ps-rule/Rule.Rule.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

# Synopsis: Use short rule names
Rule 'Rule.Name' -Type 'PSRule.Rules.Rule' {
Expand Down
348 changes: 175 additions & 173 deletions CHANGELOG.md

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Microsoft Open Source Code of Conduct

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).

Resources:

- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
- Contact [[email protected]](mailto:[email protected]) with questions or concerns
54 changes: 54 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Contributing

This project welcomes contributions and suggestions. Most contributions require you to
agree to a Contributor License Agreement (CLA) declaring that you have the right to,
and actually do, grant us the rights to use your contribution. For details, visit
https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need
to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the
instructions provided by the bot. You will only need to do this once across all repositories using our CLA.

## Code of Conduct

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

## How to contribute

- File or vote up issues
- Improve documentation
- Fix bugs or add features

### Intro to Git and GitHub

When contributing to documentation or code changes, you'll need to have a GitHub account and a basic understanding of Git.
Check out the links below to get started.

- Make sure you have a [GitHub account][github-signup].
- GitHub Help:
- [Git and GitHub learning resources][learn-git].
- [GitHub Flow Guide][github-flow].
- [Fork a repo][github-fork].
- [About Pull Requests][github-pr].

## Contributing to issues

- Check if the issue you are going to file already exists in our GitHub [issues](https://github.com/Microsoft/PSRule.Rules.Azure/issues).
- If you do not see your problem captured, please file a new issue and follow the provided template.
- If the an open issue exists for the problem you are experiencing, vote up the issue or add a comment.

## Contributing to code

- Before writing a fix or feature enhancement, ensure that an issue is logged.
- Be prepared to discuss a feature and take feedback.
- Include unit tests and updates documentation to complement the change.

[learn-git]: https://help.github.com/en/articles/git-and-github-learning-resources
[github-flow]: https://guides.github.com/introduction/flow/
[github-signup]: https://github.com/signup/free
[github-fork]: https://help.github.com/en/github/getting-started-with-github/fork-a-repo
[github-pr]: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests
[github-pr-create]: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork
[build]: docs/scenarios/install-instructions.md#building-from-source
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Bernard White
Copyright (c) Microsoft Corporation.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Features of PSRule for Azure include:

This project is to be considered a **proof-of-concept** and **not a supported product**.

For issues with rules and documentation please check our GitHub [issues](https://github.com/BernieWhite/PSRule.Rules.Azure/issues) page.
For issues with rules and documentation please check our GitHub [issues](https://github.com/Microsoft/PSRule.Rules.Azure/issues) page.
If you do not see your problem captured, please file a new issue and follow the provided template.

If you have any problems with the [PSRule][engine] engine, please check the project GitHub [issues](https://github.com/Microsoft/PSRule/issues) page instead.
Expand Down Expand Up @@ -186,6 +186,17 @@ For a list of module changes please see the [change log](CHANGELOG.md).
> Pre-release versions should be considered experimental.
> Modules and change log details for pre-releases will be removed as standard releases are made available.
## Contributing

This project welcomes contributions and suggestions.
If you are ready to contribute, please visit the [contribution guide](CONTRIBUTING.md).

## Code of Conduct

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

## Maintainers

- [Bernie White](https://github.com/BernieWhite)
Expand Down
5 changes: 4 additions & 1 deletion RuleHelp.Doc.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

#
# Generate rule help
#
Expand All @@ -16,7 +19,7 @@ Document 'RuleHelp' {
}

if (!$annotations.Contains('online version')) {
$annotations['online version'] = "https://github.com/BernieWhite/PSRule.Rules.Azure/blob/master/docs/rules/en/$($rule.Name).md";
$annotations['online version'] = "https://github.com/Microsoft/PSRule.Rules.Azure/blob/master/docs/rules/en/$($rule.Name).md";
}

Metadata $annotations;
Expand Down
2 changes: 2 additions & 0 deletions RuleToc.Doc.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

Document 'module' {
Title 'Module rule reference'
Expand Down
43 changes: 43 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Security policy

<!-- BEGIN MICROSOFT SECURITY.MD V0.0.3 BLOCK -->

## Security

Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).

If you believe you have found a security vulnerability in any Microsoft-owned repository that meets Microsoft's [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)) of a security vulnerability, please report it to us as described below.

## Reporting Security Issues

**Please do not report security vulnerabilities through public GitHub issues.**

Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).

If you prefer to submit without logging in, send email to [[email protected]](mailto:[email protected]). If possible, encrypt your message with our PGP key; please download it from the the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).

You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).

Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:

* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue

This information will help us triage your report more quickly.

If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.

## Preferred Languages

We prefer all communications to be in English.

## Policy

Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).

<!-- END MICROSOFT SECURITY.MD BLOCK -->
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: PSRule.Rules.Azure-help.xml
Module Name: PSRule.Rules.Azure
online version: https://github.com/BernieWhite/PSRule.Rules.Azure/blob/master/docs/commands/PSRule.Rules.Azure/en-US/Export-AzRuleData.md
online version: https://github.com/Microsoft/PSRule.Rules.Azure/blob/master/docs/commands/PSRule.Rules.Azure/en-US/Export-AzRuleData.md
schema: 2.0.0
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: PSRule.Rules.Azure-help.xml
Module Name: PSRule.Rules.Azure
online version: https://github.com/BernieWhite/PSRule.Rules.Azure/blob/master/docs/commands/PSRule.Rules.Azure/en-US/Export-AzTemplateRuleData.md
online version: https://github.com/Microsoft/PSRule.Rules.Azure/blob/master/docs/commands/PSRule.Rules.Azure/en-US/Export-AzTemplateRuleData.md
schema: 2.0.0
---

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/en/Azure.ACR.AdminUser.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
severity: Critical
category: Security configuration
resource: Container Registry
online version: https://github.com/BernieWhite/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.ACR.AdminUser.md
online version: https://github.com/Microsoft/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.ACR.AdminUser.md
ms-content-id: bbf194a7-6ca3-4b1d-9170-6217eb26620d
---

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/en/Azure.ACR.MinSku.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
severity: Important
category: Performance
resource: Container Registry
online version: https://github.com/BernieWhite/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.ACR.MinSku.md
online version: https://github.com/Microsoft/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.ACR.MinSku.md
ms-content-id: a70d16d4-3717-4eef-b588-8a0204860d6e
---

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/en/Azure.AKS.MinNodeCount.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
severity: Important
category: Reliability
resource: Azure Kubernetes Service
online version: https://github.com/BernieWhite/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.AKS.MinNodeCount.md
online version: https://github.com/Microsoft/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.AKS.MinNodeCount.md
ms-content-id: 320afea5-5c19-45ad-b9a5-c1a63ae6e114
---

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/en/Azure.AKS.NetworkPolicy.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
severity: Important
category: Security configuration
resource: Azure Kubernetes Service
online version: https://github.com/BernieWhite/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.AKS.NetworkPolicy.md
online version: https://github.com/Microsoft/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.AKS.NetworkPolicy.md
---

# AKS clusters use Azure Network Policies
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/en/Azure.AKS.PodSecurityPolicy.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
severity: Important
category: Security configuration
resource: Azure Kubernetes Service
online version: https://github.com/BernieWhite/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.AKS.PodSecurityPolicy.md
online version: https://github.com/Microsoft/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.AKS.PodSecurityPolicy.md
---

# AKS cluster use Pod Security Policies
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/en/Azure.AKS.PoolScaleSet.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
severity: Important
category: Scalability
resource: Azure Kubernetes Service
online version: https://github.com/BernieWhite/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.AKS.PoolScaleSet.md
online version: https://github.com/Microsoft/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.AKS.PoolScaleSet.md
---

# AKS clusters use VM scale sets
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/en/Azure.AKS.PoolVersion.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
severity: Important
category: Operations management
resource: Azure Kubernetes Service
online version: https://github.com/BernieWhite/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.AKS.PoolVersion.md
online version: https://github.com/Microsoft/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.AKS.PoolVersion.md
---

# Upgrade AKS node pool version
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/en/Azure.AKS.UseRBAC.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
severity: Important
category: Security configuration
resource: Azure Kubernetes Service
online version: https://github.com/BernieWhite/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.AKS.UseRBAC.md
online version: https://github.com/Microsoft/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.AKS.UseRBAC.md
ms-content-id: 61ff3a23-9bfd-4e91-8959-798b43237775
---

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/en/Azure.AKS.Version.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
severity: Important
category: Operations management
resource: Azure Kubernetes Service
online version: https://github.com/BernieWhite/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.AKS.Version.md
online version: https://github.com/Microsoft/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.AKS.Version.md
ms-content-id: b0bd4e66-af2f-4d0a-82ae-e4738418bb7e
---

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/en/Azure.APIM.EncryptValues.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
severity: Important
category: Security configuration
resource: API Management
online version: https://github.com/BernieWhite/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.APIM.EncryptValues.md
online version: https://github.com/Microsoft/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.APIM.EncryptValues.md
---

# Use encrypted named values
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/en/Azure.APIM.HTTPBackend.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
severity: Critical
category: Security configuration
resource: API Management
online version: https://github.com/BernieWhite/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.APIM.HTTPBackend.md
online version: https://github.com/Microsoft/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.APIM.HTTPBackend.md
---

# Use HTTPS backend connections
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/en/Azure.APIM.HTTPEndpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
severity: Important
category: Security configuration
resource: API Management
online version: https://github.com/BernieWhite/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.APIM.HTTPEndpoint.md
online version: https://github.com/Microsoft/PSRule.Rules.Azure/blob/master/docs/rules/en/Azure.APIM.HTTPEndpoint.md
---

# Publish APIs through HTTPS connections
Expand Down
Loading

0 comments on commit 9d3749c

Please sign in to comment.