Skip to content

Commit 2d203a2

Browse files
committed
component hashes in policy condition
Signed-off-by: Sahiba Mittal <[email protected]>
1 parent 6778394 commit 2d203a2

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

src/i18n/locales/en.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
"component_created": "Component created",
100100
"component_updated": "Component updated",
101101
"component_deleted": "Component deleted",
102+
"component_hash": "Component Hash",
102103
"property_created": "Property created",
103104
"property_deleted": "Property deleted",
104105
"create_project": "Create Project",
@@ -549,6 +550,20 @@
549550
"matches": "matches",
550551
"no_match": "does not match"
551552
},
553+
"hashes" : {
554+
"md5": "MD5",
555+
"sha_1": "SHA-1",
556+
"sha_256": "SHA-256",
557+
"sha_384": "SHA-384",
558+
"sha_512": "SHA-512",
559+
"sha3_256": "SHA3-256",
560+
"sha3_384": "SHA3-384",
561+
"sha3_512": "SHA3-512",
562+
"blake_256": "BLAKE2b-256",
563+
"blake_384": "BLAKE2b-384",
564+
"blake_512": "BLAKE2b-512",
565+
"blake3": "BLAKE3"
566+
},
552567
"policy_violation": {
553568
"fails": "Violation Failures",
554569
"warns": "Violation Warnings",

src/views/policy/PolicyCondition.vue

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@
7373
{value: 'PACKAGE_URL', text: this.$t('message.package_url')},
7474
{value: 'CPE', text: this.$t('message.cpe_full')},
7575
{value: 'SWID_TAGID', text: this.$t('message.swid_tagid')},
76-
{value: 'VERSION', text: this.$t('message.version')}
76+
{value: 'VERSION', text: this.$t('message.version')},
77+
{value: 'COMPONENT_HASH', text: this.$t('message.component_hash')}
7778
],
7879
objectOperators: [
7980
{value: 'IS', text: this.$t('operator.is')},
@@ -91,6 +92,20 @@
9192
{value: 'NUMERIC_GREATER_THAN_OR_EQUAL', text: ''},
9293
{value: 'NUMERIC_LESSER_THAN_OR_EQUAL', text: ''}
9394
],
95+
hashAlgorithms: [
96+
{value: 'MD5', text: this.$t('hashes.md5')},
97+
{value: 'SHA-1', text: this.$t('hashes.sha_1')},
98+
{value: 'SHA-256', text: this.$t('hashes.sha_256')},
99+
{value: 'SHA-384', text: this.$t('hashes.sha_384')},
100+
{value: 'SHA-512', text: this.$t('hashes.sha_512')},
101+
{value: 'SHA3-256', text: this.$t('hashes.sha3_256')},
102+
{value: 'SHA3-384', text: this.$t('hashes.sha3_384')},
103+
{value: 'SHA3-512', text: this.$t('hashes.sha3_512')},
104+
{value: 'BLAKE2b-256', text: this.$t('hashes.blake_256')},
105+
{value: 'BLAKE2b-384', text: this.$t('hashes.blake_384')},
106+
{value: 'BLAKE2b-512', text: this.$t('hashes.blake_512')},
107+
{value: 'BLAKE3', text: this.$t('hashes.blake3')},
108+
],
94109
operators: [],
95110
possibleValues: []
96111
}
@@ -120,6 +135,8 @@
120135
return false;
121136
case 'VERSION':
122137
return false;
138+
case 'COMPONENT_HASH':
139+
return false;
123140
default:
124141
return false;
125142
}
@@ -149,7 +166,7 @@
149166
break;
150167
case 'SEVERITY':
151168
this.operators = this.objectOperators;
152-
this.populateSeverity()
169+
this.populateSeverity();
153170
break;
154171
case 'COORDINATES':
155172
this.operators = this.regexOperators;
@@ -174,6 +191,9 @@
174191
case 'VERSION':
175192
this.operators = this.numericOperators;
176193
break;
194+
case 'COMPONENT_HASH':
195+
this.operators = this.hashAlgorithms;
196+
break;
177197
default:
178198
this.operators = [];
179199
}

0 commit comments

Comments
 (0)