Skip to content

Commit 6033bcf

Browse files
authored
Add integration with YAML files and sublime-rules (#2)
1 parent 7ce305f commit 6033bcf

File tree

11 files changed

+720
-474
lines changed

11 files changed

+720
-474
lines changed

.vscode/launch.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
{
2-
"version": "0.2.0",
3-
"configurations": [
4-
{
5-
"type": "extensionHost",
6-
"request": "launch",
7-
"name": "Launch Client",
8-
"runtimeExecutable": "${execPath}",
9-
"args": [
10-
"--extensionDevelopmentPath=${workspaceFolder}"
11-
],
12-
"outFiles": ["${workspaceFolder}/out/**/*.js"],
13-
"preLaunchTask": "watch"
14-
}
15-
]
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "extensionHost",
6+
"request": "launch",
7+
"name": "Launch Client",
8+
"runtimeExecutable": "${execPath}",
9+
"args": [
10+
"--extensionDevelopmentPath=${workspaceFolder}"
11+
],
12+
"outFiles": ["${workspaceFolder}/out/**/*.js"],
13+
"preLaunchTask": "watch"
14+
}
15+
]
1616
}

.vscode/settings.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
{
2-
"editor.insertSpaces": false,
3-
"typescript.tsc.autoDetect": "off",
4-
"typescript.preferences.quoteStyle": "single",
5-
"editor.codeActionsOnSave": {
6-
"source.fixAll.eslint": true
7-
}
1+
{
2+
"editor.insertSpaces": false,
3+
"typescript.tsc.autoDetect": "off",
4+
"typescript.preferences.quoteStyle": "single",
5+
"editor.codeActionsOnSave": {
6+
"source.fixAll.eslint": true
7+
}
88
}

.vscode/tasks.json

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
{
2-
"version": "2.0.0",
3-
"tasks": [
4-
{
5-
"type": "npm",
6-
"script": "compile",
7-
"group": "build",
8-
"presentation": {
9-
"panel": "dedicated",
10-
"reveal": "never"
11-
},
12-
"problemMatcher": [
13-
"$tsc"
14-
]
15-
},
16-
{
17-
"type": "npm",
18-
"script": "watch",
19-
"label": "watch",
20-
"isBackground": true,
21-
"group": {
22-
"kind": "build",
23-
"isDefault": true
24-
},
25-
"presentation": {
26-
"panel": "dedicated",
27-
"reveal": "never"
28-
},
29-
"problemMatcher": {
30-
"base": "$tsc-watch",
31-
"background": {
32-
"activeOnStart": true,
33-
"beginsPattern": ".*",
34-
"endsPattern": ".*watching for changes.*"
35-
}
36-
}
37-
}
38-
]
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "npm",
6+
"script": "compile",
7+
"group": "build",
8+
"presentation": {
9+
"panel": "dedicated",
10+
"reveal": "never"
11+
},
12+
"problemMatcher": [
13+
"$tsc"
14+
]
15+
},
16+
{
17+
"type": "npm",
18+
"script": "watch",
19+
"label": "watch",
20+
"isBackground": true,
21+
"group": {
22+
"kind": "build",
23+
"isDefault": true
24+
},
25+
"presentation": {
26+
"panel": "dedicated",
27+
"reveal": "never"
28+
},
29+
"problemMatcher": {
30+
"base": "$tsc-watch",
31+
"background": {
32+
"activeOnStart": true,
33+
"beginsPattern": ".*",
34+
"endsPattern": ".*watching for changes.*"
35+
}
36+
}
37+
}
38+
]
3939
}

.vscodeignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
!package-lock.json
1010
!tsconfig.json
1111

12-
!syntaxes/mesageQueryLanguage.tmLanguage.json
12+
!schemas/*.json
13+
!syntaxes/*.json
1314
!icon.png
1415
!language-configuration.json
1516

package.json

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
],
3333
"main": "./out/main.js",
3434
"activationEvents": [
35-
"onLanguage:messageQueryLanguage"
35+
"onLanguage:messageQueryLanguage",
36+
"onLanguage:yaml"
3637
],
3738
"contributes": {
3839
"languages": [
@@ -51,8 +52,37 @@
5152
"grammars": [
5253
{
5354
"language": "messageQueryLanguage",
54-
"scopeName": "source.messageQueryLanguage",
55+
"scopeName": "source.mql",
5556
"path": "./syntaxes/messageQueryLanguage.tmLanguage.json"
57+
},
58+
{
59+
"path": "./syntaxes/messageQueryLanguage-injection.json",
60+
"scopeName": "source.mql.injection",
61+
"injectTo": [
62+
"source.yaml"
63+
],
64+
"embeddedLanguages": {
65+
"source.mql": "messageQueryLanguage"
66+
},
67+
"tokenTypes": {
68+
"source.mql": "other"
69+
}
70+
}
71+
],
72+
"yamlValidation": [
73+
{
74+
"fileMatch": [
75+
"detection-rules/**/*.yml",
76+
"discovery-rules/**/*.yml"
77+
],
78+
"url": "./schemas/sublimeRule.json"
79+
},
80+
{
81+
"fileMatch": [
82+
"signals/**/*.yml",
83+
"insights/**/*.yml"
84+
],
85+
"url": "./schemas/sublimeQuery.json"
5686
}
5787
],
5888
"configuration": {
@@ -134,4 +164,4 @@
134164
"vscode-languageclient": "^8.1.0",
135165
"ws": "^8.13.0"
136166
}
137-
}
167+
}

schemas/sublimeQuery.json

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"title": "Sublime Security MQL Query",
3+
"properties": {
4+
"authors": {
5+
"items": {
6+
"properties": {
7+
"name": {
8+
"type": "string"
9+
},
10+
"twitter": {
11+
"type": "string"
12+
}
13+
},
14+
"type": "object"
15+
},
16+
"type": "array"
17+
},
18+
"description": {
19+
"type": "string"
20+
},
21+
"false_positives": {
22+
"items": {
23+
"type": "string"
24+
},
25+
"type": "array"
26+
},
27+
"label": {
28+
"nullable": true,
29+
"type": "string"
30+
},
31+
"maturity": {
32+
"nullable": true,
33+
"type": "string"
34+
},
35+
"name": {
36+
"type": "string"
37+
},
38+
"references": {
39+
"items": {
40+
"type": "string"
41+
},
42+
"type": "array"
43+
},
44+
"severity": {
45+
"nullable": true,
46+
"type": "string"
47+
},
48+
"source": {
49+
"type": "string"
50+
},
51+
"tags": {
52+
"items": {
53+
"type": "string"
54+
},
55+
"type": "array"
56+
},
57+
"type": {
58+
"default": "query",
59+
"enum": [
60+
"query"
61+
],
62+
"type": "string"
63+
},
64+
"user_provided_tags": {
65+
"items": {
66+
"type": "string"
67+
},
68+
"type": "array"
69+
}
70+
},
71+
"required": [
72+
"name",
73+
"source",
74+
"type"
75+
],
76+
"type": "object"
77+
}

schemas/sublimeRule.json

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"title": "Sublime Security MQL Rule",
3+
"properties": {
4+
"action_ids": {
5+
"items": {
6+
"type": "string"
7+
},
8+
"type": "array"
9+
},
10+
"active": {
11+
"type": "boolean"
12+
},
13+
"authors": {
14+
"items": {
15+
"properties": {
16+
"name": {
17+
"type": "string"
18+
},
19+
"twitter": {
20+
"type": "string"
21+
}
22+
},
23+
"type": "object"
24+
},
25+
"type": "array"
26+
},
27+
"description": {
28+
"type": "string"
29+
},
30+
"false_positives": {
31+
"items": {
32+
"type": "string"
33+
},
34+
"type": "array"
35+
},
36+
"label": {
37+
"nullable": true,
38+
"type": "string"
39+
},
40+
"maturity": {
41+
"nullable": true,
42+
"type": "string"
43+
},
44+
"name": {
45+
"type": "string"
46+
},
47+
"references": {
48+
"items": {
49+
"type": "string"
50+
},
51+
"type": "array"
52+
},
53+
"severity": {
54+
"nullable": true,
55+
"type": "string"
56+
},
57+
"source": {
58+
"type": "string"
59+
},
60+
"tags": {
61+
"items": {
62+
"type": "string"
63+
},
64+
"type": "array"
65+
},
66+
"type": {
67+
"default": "rule",
68+
"enum": [
69+
"rule"
70+
],
71+
"type": "string"
72+
},
73+
"user_provided_tags": {
74+
"items": {
75+
"type": "string"
76+
},
77+
"type": "array"
78+
}
79+
},
80+
"required": [
81+
"name",
82+
"source",
83+
"type"
84+
],
85+
"type": "object"
86+
}

0 commit comments

Comments
 (0)