Merge pull request #394 from microsoft/iac-p0/yaml-document-foundation · microsoft/codeql@32daba3 · GitHub
Skip to content

Commit 32daba3

Browse files
authored
Merge pull request #394 from microsoft/iac-p0/yaml-document-foundation
Add reusable YAML document classification foundation
2 parents 1211b9d + 6f9cd09 commit 32daba3

11 files changed

Lines changed: 166 additions & 0 deletions

File tree

Lines changed: 86 additions & 0 deletions
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
supportedYamlDocument
2+
| azure-pipelines.yaml:1:1:8:25 | Azure DevOps Pipeline | ado-pipeline |
3+
| cloudformation.yaml:1:1:6:29 | CloudFormation Document | cloudformation |
4+
| compose.yaml:1:1:4:24 | version: "3.9" | compose |
5+
| deployment.yaml:1:1:8:29 | HelmChart Document | kubernetes-helm |
6+
| openapi.yaml:1:1:12:26 | OpenApi Document | openapi |
7+
allYamlDocuments
8+
| arm-template.yaml:1:1:5:24 | $schema ... .json#" |
9+
| azure-pipelines.yaml:1:1:8:25 | Azure DevOps Pipeline |
10+
| cloudformation.yaml:1:1:6:29 | CloudFormation Document |
11+
| compose.yaml:1:1:4:24 | version: "3.9" |
12+
| deployment.yaml:1:1:8:29 | HelmChart Document |
13+
| openapi.json:1:1:8:1 | OpenApi Document |
14+
| openapi.yaml:1:1:12:26 | OpenApi Document |
15+
| unrelated.yaml:1:1:4:8 | descrip ... ocument |
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
private import iac
2+
private import codeql.iac.YamlDocumentClassification
3+
4+
query predicate supportedYamlDocument(
5+
YamlDocumentClassification::YamlSyntaxDocument doc, YamlDocumentClassification::DocumentKind kind
6+
) {
7+
YamlDocumentClassification::isSupportedYamlDocument(doc, kind)
8+
}
9+
10+
query predicate allYamlDocuments(YamlDocument doc) { any() }
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
$schema: "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#"
2+
contentVersion: "1.0.0.0"
3+
resources:
4+
- type: Microsoft.Storage/storageAccounts
5+
name: samplestorage
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
trigger:
2+
- main
3+
4+
pool:
5+
vmImage: ubuntu-latest
6+
7+
steps:
8+
- script: echo "hello"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
AWSTemplateFormatVersion: "2010-09-09"
2+
Resources:
3+
Bucket:
4+
Type: AWS::S3::Bucket
5+
Properties:
6+
AccessControl: Private
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
version: "3.9"
2+
services:
3+
web:
4+
image: nginx:latest
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: sample
5+
spec:
6+
containers:
7+
- name: app
8+
image: example/app:1.0
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"openapi": "3.0.0",
3+
"info": {
4+
"title": "Sample API",
5+
"version": "1.0"
6+
},
7+
"paths": {}
8+
}
Lines changed: 12 additions & 0 deletions

0 commit comments

Comments
 (0)