bpmnlint-plugin-camunda-compat 2.4.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js
CHANGED
@@ -14,6 +14,7 @@ const camundaCloud10Rules = withConfig({
|
|
14
14
|
'no-candidate-users': 'error',
|
15
15
|
'no-expression': 'error',
|
16
16
|
'no-multiple-none-start-events': 'error',
|
17
|
+
'no-propagate-all-parent-variables': 'error',
|
17
18
|
'no-task-schedule': 'error',
|
18
19
|
'no-template': 'error',
|
19
20
|
'no-zeebe-properties': 'error',
|
@@ -32,7 +33,8 @@ const camundaCloud12Rules = withConfig(camundaCloud11Rules, { version: '1.2' });
|
|
32
33
|
const camundaCloud13Rules = withConfig(camundaCloud12Rules, { version: '1.3' });
|
33
34
|
|
34
35
|
const camundaCloud80Rules = withConfig({
|
35
|
-
...omit(camundaCloud13Rules, 'no-template')
|
36
|
+
...omit(camundaCloud13Rules, 'no-template'),
|
37
|
+
'secrets': 'error'
|
36
38
|
}, { version: '8.0' });
|
37
39
|
|
38
40
|
const camundaCloud81Rules = withConfig({
|
@@ -43,6 +45,7 @@ const camundaCloud81Rules = withConfig({
|
|
43
45
|
const camundaCloud82Rules = withConfig({
|
44
46
|
...omit(camundaCloud81Rules, [
|
45
47
|
'no-candidate-users',
|
48
|
+
'no-propagate-all-parent-variables',
|
46
49
|
'no-task-schedule'
|
47
50
|
]),
|
48
51
|
'escalation-boundary-event-attached-to-ref': 'error',
|
@@ -89,10 +92,12 @@ const rules = {
|
|
89
92
|
'no-candidate-users': './rules/camunda-cloud/no-candidate-users',
|
90
93
|
'no-expression': './rules/camunda-cloud/no-expression',
|
91
94
|
'no-multiple-none-start-events': './rules/camunda-cloud/no-multiple-none-start-events',
|
95
|
+
'no-propagate-all-parent-variables': './rules/camunda-cloud/no-propagate-all-parent-variables',
|
92
96
|
'no-signal-event-sub-process': './rules/camunda-cloud/no-signal-event-sub-process',
|
93
97
|
'no-task-schedule': './rules/camunda-cloud/no-task-schedule',
|
94
98
|
'no-template': './rules/camunda-cloud/no-template',
|
95
99
|
'no-zeebe-properties': './rules/camunda-cloud/no-zeebe-properties',
|
100
|
+
'secrets': './rules/camunda-cloud/secrets',
|
96
101
|
'sequence-flow-condition': './rules/camunda-cloud/sequence-flow-condition',
|
97
102
|
'signal-reference': './rules/camunda-cloud/signal-reference',
|
98
103
|
'start-form': './rules/camunda-cloud/start-form',
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "bpmnlint-plugin-camunda-compat",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.5.1",
|
4
4
|
"description": "A bpmnlint plug-in for Camunda Platform compatibility",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
@@ -33,7 +33,7 @@
|
|
33
33
|
"modeler-moddle": "^0.1.0",
|
34
34
|
"sinon": "^14.0.0",
|
35
35
|
"sinon-chai": "^3.7.0",
|
36
|
-
"zeebe-bpmn-moddle": "^0.
|
36
|
+
"zeebe-bpmn-moddle": "^1.0.0"
|
37
37
|
},
|
38
38
|
"dependencies": {
|
39
39
|
"@bpmn-io/feel-lint": "^0.1.1",
|
@@ -0,0 +1,45 @@
|
|
1
|
+
const { is } = require('bpmnlint-utils');
|
2
|
+
|
3
|
+
const {
|
4
|
+
findExtensionElement,
|
5
|
+
hasProperties
|
6
|
+
} = require('../utils/element');
|
7
|
+
|
8
|
+
const { reportErrors } = require('../utils/reporter');
|
9
|
+
|
10
|
+
const { skipInNonExecutableProcess } = require('../utils/rule');
|
11
|
+
|
12
|
+
module.exports = skipInNonExecutableProcess(function() {
|
13
|
+
function check(node, reporter) {
|
14
|
+
if (!is(node, 'bpmn:CallActivity')) {
|
15
|
+
return;
|
16
|
+
}
|
17
|
+
|
18
|
+
const calledElement = findExtensionElement(node, 'zeebe:CalledElement');
|
19
|
+
|
20
|
+
if (!calledElement) {
|
21
|
+
return;
|
22
|
+
}
|
23
|
+
|
24
|
+
const errors = hasProperties(calledElement, {
|
25
|
+
propagateAllParentVariables: {
|
26
|
+
allowed: function(value) {
|
27
|
+
|
28
|
+
// `propergateAllParentVariables` is not recognized by Camunda 8.1 and older
|
29
|
+
// setting it to `true` is therefore allowed for all versions
|
30
|
+
// setting it to `false` is only allowed for Camunda 8.2 and newer
|
31
|
+
return value;
|
32
|
+
},
|
33
|
+
allowedVersion: '8.2'
|
34
|
+
}
|
35
|
+
}, node);
|
36
|
+
|
37
|
+
if (errors && errors.length) {
|
38
|
+
reportErrors(node, reporter, errors);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
return {
|
43
|
+
check
|
44
|
+
};
|
45
|
+
});
|
@@ -0,0 +1,115 @@
|
|
1
|
+
const { isString } = require('min-dash');
|
2
|
+
|
3
|
+
const { is } = require('bpmnlint-utils');
|
4
|
+
|
5
|
+
const { getPath } = require('@bpmn-io/moddle-utils');
|
6
|
+
|
7
|
+
const {
|
8
|
+
findExtensionElement,
|
9
|
+
getEventDefinition
|
10
|
+
} = require('../utils/element');
|
11
|
+
|
12
|
+
const { ERROR_TYPES } = require('../utils/error-types');
|
13
|
+
|
14
|
+
const { reportErrors } = require('../utils/reporter');
|
15
|
+
|
16
|
+
const { skipInNonExecutableProcess } = require('../utils/rule');
|
17
|
+
|
18
|
+
module.exports = skipInNonExecutableProcess(function() {
|
19
|
+
function check(node, reporter) {
|
20
|
+
const errors = [
|
21
|
+
validateIoMapping,
|
22
|
+
validateProperties,
|
23
|
+
validateSubscription
|
24
|
+
].reduce((errors, validationFunction) => {
|
25
|
+
return [
|
26
|
+
...errors,
|
27
|
+
...validationFunction(node)
|
28
|
+
];
|
29
|
+
}, []);
|
30
|
+
|
31
|
+
if (errors.length) {
|
32
|
+
reportErrors(node, reporter, errors);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
return {
|
37
|
+
check
|
38
|
+
};
|
39
|
+
});
|
40
|
+
|
41
|
+
function validateIoMapping(node) {
|
42
|
+
const ioMapping = findExtensionElement(node, 'zeebe:IoMapping');
|
43
|
+
|
44
|
+
if (!ioMapping) {
|
45
|
+
return [];
|
46
|
+
}
|
47
|
+
|
48
|
+
return ioMapping.get('inputParameters')
|
49
|
+
.filter(inputParameter => !isValidSecret(inputParameter.get('source')))
|
50
|
+
.map(inputParameter => getReport('source', inputParameter, node));
|
51
|
+
}
|
52
|
+
|
53
|
+
function validateProperties(node) {
|
54
|
+
const properties = findExtensionElement(node, 'zeebe:Properties');
|
55
|
+
|
56
|
+
if (!properties) {
|
57
|
+
return [];
|
58
|
+
}
|
59
|
+
|
60
|
+
return (properties.get('properties'))
|
61
|
+
.filter(property => !isValidSecret(property.get('value')))
|
62
|
+
.map(property => getReport('value', property, node));
|
63
|
+
}
|
64
|
+
|
65
|
+
function validateSubscription(node) {
|
66
|
+
let message;
|
67
|
+
|
68
|
+
if (is(node, 'bpmn:ReceiveTask')) {
|
69
|
+
message = node.get('messageRef');
|
70
|
+
} else {
|
71
|
+
const messageEventDefinition = getEventDefinition(node, 'bpmn:MessageEventDefinition');
|
72
|
+
|
73
|
+
if (!messageEventDefinition) {
|
74
|
+
return [];
|
75
|
+
}
|
76
|
+
|
77
|
+
message = messageEventDefinition.get('messageRef');
|
78
|
+
}
|
79
|
+
|
80
|
+
if (!message) {
|
81
|
+
return [];
|
82
|
+
}
|
83
|
+
|
84
|
+
const subscription = findExtensionElement(message, 'zeebe:Subscription');
|
85
|
+
|
86
|
+
if (!subscription) {
|
87
|
+
return [];
|
88
|
+
}
|
89
|
+
|
90
|
+
const correlationKey = subscription.get('correlationKey');
|
91
|
+
|
92
|
+
return isValidSecret(correlationKey)
|
93
|
+
? []
|
94
|
+
: [ getReport('correlationKey', subscription, node) ];
|
95
|
+
}
|
96
|
+
|
97
|
+
function getReport(propertyName, node, parentNode) {
|
98
|
+
return {
|
99
|
+
message: `Property <${ propertyName }> is not a valid secret`,
|
100
|
+
path: [ ...getPath(node, parentNode), propertyName ],
|
101
|
+
data: {
|
102
|
+
type: ERROR_TYPES.SECRET_EXPRESSION_INVALID,
|
103
|
+
node,
|
104
|
+
parentNode: parentNode,
|
105
|
+
property: propertyName
|
106
|
+
}
|
107
|
+
};
|
108
|
+
}
|
109
|
+
|
110
|
+
function isValidSecret(value) {
|
111
|
+
return !value
|
112
|
+
|| !isString(value)
|
113
|
+
|| !value.includes('secrets.')
|
114
|
+
|| /{{secrets\.[a-zA-Z0-9_]+}}/.test(value);
|
115
|
+
}
|
@@ -17,5 +17,6 @@ module.exports.ERROR_TYPES = Object.freeze({
|
|
17
17
|
PROPERTY_TYPE_NOT_ALLOWED: 'camunda.propertyTypeNotAllowed',
|
18
18
|
PROPERTY_VALUE_DUPLICATED: 'camunda.propertyValueDuplicated',
|
19
19
|
PROPERTY_VALUE_NOT_ALLOWED: 'camunda.propertyValueNotAllowed',
|
20
|
-
PROPERTY_VALUE_REQUIRED: 'camunda.propertyValueRequired'
|
20
|
+
PROPERTY_VALUE_REQUIRED: 'camunda.propertyValueRequired',
|
21
|
+
SECRET_EXPRESSION_INVALID: 'camunda.secretExpressionInvalid'
|
21
22
|
});
|