* Added GitHub code scanning

* Update DevSkim path

* Fix URL links to use https
This commit is contained in:
Bernie White 2022-03-08 15:48:48 +10:00 коммит произвёл GitHub
Родитель 9b9c4ee90e
Коммит e07b92cda7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 138 добавлений и 279 удалений

65
.github/workflows/analyze.yaml поставляемый
Просмотреть файл

@ -1,6 +1,14 @@
#
# Repository validation
# Repository analysis
#
# NOTES:
# This worflow uses PSRule, CodeQL, and DevSkim.
# You can read more about these linting tools and configuration options here:
# PSRule - https://aka.ms/ps-rule and https://github.com/Microsoft/PSRule.Rules.MSFT.OSS
# CodeQL - https://codeql.github.com/docs/codeql-overview/about-codeql/
# DevSkim - https://github.com/microsoft/DevSkim-Action and https://github.com/Microsoft/DevSkim
name: Analyze
on:
push:
@ -8,12 +16,12 @@ on:
pull_request:
branches: [ main, 'release/*' ]
schedule:
- cron: '54 20 * * 0' # At 8:54 PM, on Sunday each week
- cron: '54 20 * * 0' # At 08:54 PM, on Sunday each week
workflow_dispatch:
jobs:
analyze:
name: Analyze repository
oss:
name: Analyze with PSRule
runs-on: ubuntu-latest
permissions:
contents: read
@ -23,7 +31,52 @@ jobs:
uses: actions/checkout@v3
- name: Run PSRule analysis
uses: Microsoft/ps-rule@main
uses: Microsoft/ps-rule@v1.12.0
with:
modules: 'PSRule.Rules.MSFT.OSS'
modules: PSRule.Rules.MSFT.OSS
prerelease: true
devskim:
name: Analyze with DevSkim
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run DevSkim scanner
uses: microsoft/DevSkim-Action@v1
with:
directory-to-scan: .
- name: Upload results to security tab
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: devskim-results.sarif
codeql:
name: Analyze with CodeQL
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: 'javascript'
- name: Autobuild
uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

2
.vscode/extensions.json поставляемый
Просмотреть файл

@ -1,5 +1,5 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// See https://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"ms-vscode.vscode-typescript-tslint-plugin",

Просмотреть файл

@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$schema": "https://json-schema.org/draft-07/schema#",
"oneOf": [
{
"$ref": "#/definitions/rule-v1"
@ -55,9 +55,7 @@
"$ref": "#/definitions/resourceTags"
}
},
"required": [
"name"
]
"required": ["name"]
},
"baseline-v1": {
"type": "object",
@ -69,18 +67,14 @@
"type": "string",
"title": "API Version",
"description": "The API Version for the PSRule resources.",
"enum": [
"github.com/microsoft/PSRule/v1"
]
"enum": ["github.com/microsoft/PSRule/v1"]
},
"kind": {
"type": "string",
"title": "Kind",
"description": "A PSRule Baseline resource.",
"markdownDescription": "A PSRule Baseline resource. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Baseline/)",
"enum": [
"Baseline"
]
"enum": ["Baseline"]
},
"metadata": {
"type": "object",
@ -91,12 +85,7 @@
"$ref": "#/definitions/baselineSpec"
}
},
"required": [
"apiVersion",
"kind",
"metadata",
"spec"
],
"required": ["apiVersion", "kind", "metadata", "spec"],
"additionalProperties": false
},
"baselineSpec": {
@ -175,17 +164,13 @@
"type": "string",
"title": "API Version",
"description": "The API Version for the PSRule resources.",
"enum": [
"github.com/microsoft/PSRule/v1"
]
"enum": ["github.com/microsoft/PSRule/v1"]
},
"kind": {
"type": "string",
"title": "Kind",
"description": "A PSRule ModuleConfig resource.",
"enum": [
"ModuleConfig"
]
"enum": ["ModuleConfig"]
},
"metadata": {
"type": "object",
@ -196,12 +181,7 @@
"$ref": "#/definitions/moduleConfigSpec"
}
},
"required": [
"apiVersion",
"kind",
"metadata",
"spec"
],
"required": ["apiVersion", "kind", "metadata", "spec"],
"additionalProperties": false
},
"moduleConfigSpec": {
@ -237,21 +217,15 @@
"defaultSnippets": [
{
"label": "en-AU",
"bodyText": [
"en-AU"
]
"bodyText": ["en-AU"]
},
{
"label": "en-US",
"bodyText": [
"en-US"
]
"bodyText": ["en-US"]
},
{
"label": "en-GB",
"bodyText": [
"en-GB"
]
"bodyText": ["en-GB"]
}
]
}
@ -409,17 +383,13 @@
"type": "string",
"title": "API Version",
"description": "The API Version for the PSRule resources.",
"enum": [
"github.com/microsoft/PSRule/v1"
]
"enum": ["github.com/microsoft/PSRule/v1"]
},
"kind": {
"type": "string",
"title": "Kind",
"description": "A PSRule Selector resource.",
"enum": [
"Selector"
]
"enum": ["Selector"]
},
"metadata": {
"type": "object",
@ -430,12 +400,7 @@
"$ref": "#/definitions/selectorSpec"
}
},
"required": [
"apiVersion",
"kind",
"metadata",
"spec"
]
"required": ["apiVersion", "kind", "metadata", "spec"]
},
"selectorSpec": {
"type": "object",
@ -451,9 +416,7 @@
"$ref": "#/definitions/selectorExpression"
}
},
"required": [
"if"
],
"required": ["if"],
"additionalProperties": false
},
"suppressionGroup-v1": {
@ -466,17 +429,13 @@
"type": "string",
"title": "API Version",
"description": "The API Version for the PSRule resources.",
"enum": [
"github.com/microsoft/PSRule/v1"
]
"enum": ["github.com/microsoft/PSRule/v1"]
},
"kind": {
"type": "string",
"title": "Kind",
"description": "A PSRule SuppressionGroup resource.",
"enum": [
"SuppressionGroup"
]
"enum": ["SuppressionGroup"]
},
"metadata": {
"type": "object",
@ -487,12 +446,7 @@
"$ref": "#/definitions/suppressionGroupSpec"
}
},
"required": [
"apiVersion",
"kind",
"metadata",
"spec"
]
"required": ["apiVersion", "kind", "metadata", "spec"]
},
"suppressionGroupSpec": {
"type": "object",
@ -513,9 +467,7 @@
"$ref": "#/definitions/selectorExpression"
}
},
"required": [
"if"
],
"required": ["if"],
"additionalProperties": false
},
"rule-v1": {
@ -528,18 +480,14 @@
"type": "string",
"title": "API Version",
"description": "The API Version for the PSRule resources.",
"enum": [
"github.com/microsoft/PSRule/v1"
]
"enum": ["github.com/microsoft/PSRule/v1"]
},
"kind": {
"type": "string",
"title": "Kind",
"description": "A rule resource.",
"markdownDescription": "A rule resource. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Rules/)",
"enum": [
"Rule"
]
"enum": ["Rule"]
},
"metadata": {
"type": "object",
@ -550,12 +498,7 @@
"$ref": "#/definitions/ruleSpec"
}
},
"required": [
"apiVersion",
"kind",
"metadata",
"spec"
]
"required": ["apiVersion", "kind", "metadata", "spec"]
},
"ruleSpec": {
"type": "object",
@ -575,11 +518,7 @@
"title": "Level",
"description": "If the rule fails, how serious is the result. By default this is set to Error.",
"markdownDescription": "If the rule fails, how serious is the result. By default this is set to `Error`. [See help](https://microsoft.github.io/PSRule/v2/authoring/writing-rules/)",
"enum": [
"Error",
"Warning",
"Information"
],
"enum": ["Error", "Warning", "Information"],
"default": "Error"
},
"type": {
@ -601,9 +540,7 @@
"uniqueItems": true
}
},
"required": [
"condition"
],
"required": ["condition"],
"additionalProperties": false
},
"ruleMetadata": {
@ -652,9 +589,7 @@
"$ref": "#/definitions/resourceTags"
}
},
"required": [
"name"
]
"required": ["name"]
},
"selectorExpression": {
"type": "object",
@ -812,9 +747,7 @@
"default": "."
}
},
"required": [
"field"
]
"required": ["field"]
},
"selectorPropertyType": {
"properties": {
@ -826,9 +759,7 @@
"default": "."
}
},
"required": [
"type"
]
"required": ["type"]
},
"selectorPropertyName": {
"properties": {
@ -840,9 +771,7 @@
"default": "."
}
},
"required": [
"name"
]
"required": ["name"]
},
"selectorPropertySource": {
"properties": {
@ -853,9 +782,7 @@
"markdownDescription": "The source of the object currently being processed by the pipeline. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Expressions/#source)"
}
},
"required": [
"source"
]
"required": ["source"]
},
"selectorOperatorAllOf": {
"type": "object",
@ -870,9 +797,7 @@
}
}
},
"required": [
"allOf"
],
"required": ["allOf"],
"additionalProperties": false
},
"selectorOperatorAnyOf": {
@ -888,9 +813,7 @@
}
}
},
"required": [
"anyOf"
],
"required": ["anyOf"],
"additionalProperties": false
},
"selectorOperatorNot": {
@ -904,9 +827,7 @@
"$ref": "#/definitions/selectorExpression"
}
},
"required": [
"not"
]
"required": ["not"]
},
"selectorConditionExists": {
"type": "object",
@ -924,10 +845,7 @@
"markdownDescription": "The path of the field. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Expressions/#field)"
}
},
"required": [
"exists",
"field"
]
"required": ["exists", "field"]
},
"selectorConditionEquals": {
"type": "object",
@ -953,9 +871,7 @@
"default": false
}
},
"required": [
"equals"
],
"required": ["equals"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -986,9 +902,7 @@
"default": false
}
},
"required": [
"notEquals"
],
"required": ["notEquals"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1005,9 +919,7 @@
"markdownDescription": "Must have a non-empty value. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Expressions/#hasvalue)"
}
},
"required": [
"hasValue"
],
"required": ["hasValue"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1024,9 +936,7 @@
"markdownDescription": "Must match the regular expression. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Expressions/#match)"
}
},
"required": [
"match"
],
"required": ["match"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1043,9 +953,7 @@
"markdownDescription": "Must not match the regular expression. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Expressions/#notmatch)"
}
},
"required": [
"notMatch"
],
"required": ["notMatch"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1062,9 +970,7 @@
"markdownDescription": "Must equal one of the specified values. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Expressions/#in)"
}
},
"required": [
"in"
],
"required": ["in"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1081,9 +987,7 @@
"markdownDescription": "Must not equal any of the specified values. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Expressions/#notin)"
}
},
"required": [
"notIn"
],
"required": ["notIn"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1107,9 +1011,7 @@
"default": false
}
},
"required": [
"setOf"
],
"required": ["setOf"],
"oneOf": [
{
"$ref": "#/definitions/selectorProperties"
@ -1140,9 +1042,7 @@
"default": false
}
},
"required": [
"subset"
],
"required": ["subset"],
"oneOf": [
{
"$ref": "#/definitions/selectorProperties"
@ -1160,9 +1060,7 @@
"minimum": 0
}
},
"required": [
"count"
],
"required": ["count"],
"oneOf": [
{
"$ref": "#/definitions/selectorProperties"
@ -1179,9 +1077,7 @@
"markdownDescription": "Must be less then the specified value. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Expressions/#less)"
}
},
"required": [
"less"
],
"required": ["less"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1198,9 +1094,7 @@
"markdownDescription": "Must be less or equal to the specified value. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Expressions/#lessorequals)"
}
},
"required": [
"lessOrEquals"
],
"required": ["lessOrEquals"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1217,9 +1111,7 @@
"markdownDescription": "Must be greater then the specified value. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Expressions/#greater)"
}
},
"required": [
"greater"
],
"required": ["greater"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1236,9 +1128,7 @@
"markdownDescription": "Must be greater or equal to the specified value. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Expressions/#greaterorequals)"
}
},
"required": [
"greaterOrEquals"
],
"required": ["greaterOrEquals"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1269,9 +1159,7 @@
"default": false
}
},
"required": [
"startsWith"
],
"required": ["startsWith"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1302,9 +1190,7 @@
"default": false
}
},
"required": [
"endsWith"
],
"required": ["endsWith"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1335,9 +1221,7 @@
"default": false
}
},
"required": [
"contains"
],
"required": ["contains"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1354,9 +1238,7 @@
"markdownDescription": "Must be a string type. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Expressions/#isstring)"
}
},
"required": [
"isString"
],
"required": ["isString"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1373,9 +1255,7 @@
"markdownDescription": "Must be an array type. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Expressions/#isarray)"
}
},
"required": [
"isArray"
],
"required": ["isArray"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1399,9 +1279,7 @@
"default": false
}
},
"required": [
"isBoolean"
],
"required": ["isBoolean"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1425,9 +1303,7 @@
"default": false
}
},
"required": [
"isDateTime"
],
"required": ["isDateTime"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1451,9 +1327,7 @@
"default": false
}
},
"required": [
"isInteger"
],
"required": ["isInteger"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1477,9 +1351,7 @@
"default": false
}
},
"required": [
"isNumeric"
],
"required": ["isNumeric"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1496,9 +1368,7 @@
"markdownDescription": "Must be a lowercase string. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Expressions/#islower)"
}
},
"required": [
"isLower"
],
"required": ["isLower"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1515,9 +1385,7 @@
"markdownDescription": "Must be an uppercase string. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Expressions/#isupper)"
}
},
"required": [
"isUpper"
],
"required": ["isUpper"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1557,9 +1425,7 @@
"default": false
}
},
"required": [
"hasSchema"
],
"required": ["hasSchema"],
"oneOf": [
{
"$ref": "#/definitions/selectorProperties"
@ -1584,9 +1450,7 @@
"default": false
}
},
"required": [
"version"
],
"required": ["version"],
"oneOf": [
{
"$ref": "#/definitions/selectorProperties"
@ -1610,9 +1474,7 @@
"default": false
}
},
"required": [
"hasDefault"
],
"required": ["hasDefault"],
"oneOf": [
{
"$ref": "#/definitions/selectorProperties"
@ -1641,9 +1503,7 @@
"default": false
}
},
"required": [
"withinPath"
],
"required": ["withinPath"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1672,9 +1532,7 @@
"default": false
}
},
"required": [
"notWithinPath"
],
"required": ["notWithinPath"],
"oneOf": [
{
"$ref": "#/definitions/selectorPropertiesString"
@ -1709,4 +1567,4 @@
]
}
}
}
}

Просмотреть файл

@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$schema": "https://json-schema.org/draft-07/schema#",
"title": "PSRule options",
"description": "A schema for PSRule YAML options files.",
"$ref": "#/definitions/options",
@ -116,10 +116,7 @@
"title": "Language mode",
"description": "The PowerShell language mode to use for rule execution. The default is FullLanguage.",
"markdownDescription": "The PowerShell language mode to use for rule execution. The default is `FullLanguage`. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#executionlanguagemode)",
"enum": [
"FullLanguage",
"ConstrainedLanguage"
],
"enum": ["FullLanguage", "ConstrainedLanguage"],
"default": "FullLanguage"
},
"inconclusiveWarning": {
@ -288,12 +285,7 @@
"title": "Report fail to stream",
"description": "Log fail outcomes for each rule to a specific informational stream. The default is None.",
"markdownDescription": "Log fail outcomes for each rule to a specific informational stream. The default is `None`. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#loggingrulefail)",
"enum": [
"None",
"Error",
"Warning",
"Information"
],
"enum": ["None", "Error", "Warning", "Information"],
"default": "None"
},
"rulePass": {
@ -301,12 +293,7 @@
"title": "Report pass to stream",
"description": "Log pass outcomes for each rule to a specific informational stream. The default is None.",
"markdownDescription": "Log pass outcomes for each rule to a specific informational stream. The default is `None`. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#loggingrulepass)",
"enum": [
"None",
"Error",
"Warning",
"Information"
],
"enum": ["None", "Error", "Warning", "Information"],
"default": "None"
}
},
@ -351,9 +338,7 @@
}
},
"additionalProperties": false,
"required": [
"targetName"
]
"required": ["targetName"]
}
]
}
@ -368,10 +353,7 @@
"title": "Result type",
"description": "Determine if detailed or summary results are generated. The default is Detail.",
"markdownDescription": "Determine if detailed or summary results are generated. The default is `Detail`. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#outputas)",
"enum": [
"Detail",
"Summary"
],
"enum": ["Detail", "Summary"],
"default": "Detail"
},
"banner": {
@ -411,21 +393,15 @@
"defaultSnippets": [
{
"label": "en-AU",
"bodyText": [
"en-AU"
]
"bodyText": ["en-AU"]
},
{
"label": "en-US",
"bodyText": [
"en-US"
]
"bodyText": ["en-US"]
},
{
"label": "en-GB",
"bodyText": [
"en-GB"
]
"bodyText": ["en-GB"]
}
]
},
@ -434,14 +410,7 @@
"title": "Encoding",
"description": "The encoding to use when writing results to file. The default is Default, UTF-8 without BOM.",
"markdownDescription": "The encoding to use when writing results to file. The default is `Default`, UTF-8 without BOM. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#outputencoding)",
"enum": [
"Default",
"UTF8",
"UTF7",
"Unicode",
"UTF32",
"ASCII"
],
"enum": ["Default", "UTF8", "UTF7", "Unicode", "UTF32", "ASCII"],
"default": "Default"
},
"footer": {
@ -451,12 +420,7 @@
"oneOf": [
{
"type": "string",
"enum": [
"None",
"RuleCount",
"RunInfo",
"Default"
]
"enum": ["None", "RuleCount", "RunInfo", "Default"]
},
{
"type": "integer"
@ -469,16 +433,7 @@
"title": "Output format",
"description": "The output format to use when returning results. The default is None.",
"markdownDescription": "The output format to use when returning results. The default is `None`. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#outputformat)",
"enum": [
"None",
"Yaml",
"Json",
"Markdown",
"NUnit3",
"Csv",
"Wide",
"Sarif"
],
"enum": ["None", "Yaml", "Json", "Markdown", "NUnit3", "Csv", "Wide", "Sarif"],
"default": "None"
},
"outcome": {
@ -486,14 +441,7 @@
"title": "Output outcome",
"description": "The outcome of rule results to return. The default is Processed.",
"markdownDescription": "The outcome of rule results to return. The default is `Processed`. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#outputoutcome)",
"enum": [
"None",
"Fail",
"Pass",
"Error",
"Processed",
"All"
],
"enum": ["None", "Fail", "Pass", "Error", "Processed", "All"],
"default": "Processed"
},
"path": {

Просмотреть файл

@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$schema": "https://json-schema.org/draft-07/schema#",
"title": "PSRule resources",
"description": "A schema for PSRule resources.",
"type": "array",