|
74 | 74 | {value: 'CPE', text: this.$t('message.cpe_full')}, |
75 | 75 | {value: 'SWID_TAGID', text: this.$t('message.swid_tagid')}, |
76 | 76 | {value: 'VERSION', text: this.$t('message.version')}, |
| 77 | + {value: 'COMPONENT_HASH', text: this.$t('message.component_hash')}, |
77 | 78 | {value: 'CWE', text: this.$t('message.cwe_full')} |
78 | 79 | ], |
79 | 80 | objectOperators: [ |
|
92 | 93 | {value: 'NUMERIC_GREATER_THAN_OR_EQUAL', text: '≥'}, |
93 | 94 | {value: 'NUMERIC_LESSER_THAN_OR_EQUAL', text: '≤'} |
94 | 95 | ], |
| 96 | + hashAlgorithms: [ |
| 97 | + {value: 'MD5', text: this.$t('hashes.md5')}, |
| 98 | + {value: 'SHA-1', text: this.$t('hashes.sha_1')}, |
| 99 | + {value: 'SHA-256', text: this.$t('hashes.sha_256')}, |
| 100 | + {value: 'SHA-384', text: this.$t('hashes.sha_384')}, |
| 101 | + {value: 'SHA-512', text: this.$t('hashes.sha_512')}, |
| 102 | + {value: 'SHA3-256', text: this.$t('hashes.sha3_256')}, |
| 103 | + {value: 'SHA3-384', text: this.$t('hashes.sha3_384')}, |
| 104 | + {value: 'SHA3-512', text: this.$t('hashes.sha3_512')}, |
| 105 | + {value: 'BLAKE2b-256', text: this.$t('hashes.blake_256')}, |
| 106 | + {value: 'BLAKE2b-384', text: this.$t('hashes.blake_384')}, |
| 107 | + {value: 'BLAKE2b-512', text: this.$t('hashes.blake_512')}, |
| 108 | + {value: 'BLAKE3', text: this.$t('hashes.blake3')} |
| 109 | + ], |
95 | 110 | listOperators: [ |
96 | 111 | {value: 'CONTAINS_ANY', text: this.$t('operator.contains_any')}, |
97 | 112 | {value: 'CONTAINS_ALL', text: this.$t('operator.contains_all')} |
|
125 | 140 | return false; |
126 | 141 | case 'VERSION': |
127 | 142 | return false; |
| 143 | + case 'COMPONENT_HASH': |
| 144 | + return false; |
128 | 145 | case 'CWE': |
129 | 146 | return false; |
130 | 147 | default: |
|
156 | 173 | break; |
157 | 174 | case 'SEVERITY': |
158 | 175 | this.operators = this.objectOperators; |
159 | | - this.populateSeverity() |
| 176 | + this.populateSeverity(); |
160 | 177 | break; |
161 | 178 | case 'COORDINATES': |
162 | 179 | this.operators = this.regexOperators; |
|
181 | 198 | case 'VERSION': |
182 | 199 | this.operators = this.numericOperators; |
183 | 200 | break; |
| 201 | + case 'COMPONENT_HASH': |
| 202 | + this.operators = this.hashAlgorithms; |
| 203 | + break; |
184 | 204 | case 'CWE': |
185 | 205 | this.operators = this.listOperators; |
186 | 206 | break; |
|
196 | 216 | name: common.trimToNull(this.coordinatesName), |
197 | 217 | version: common.trimToNull(this.coordinatesVersion) |
198 | 218 | }); |
| 219 | + } else if (this.subject === "COMPONENT_HASH") { |
| 220 | + return JSON.stringify({ |
| 221 | + algorithm: common.trimToNull(this.operator), |
| 222 | + value: common.trimToNull(this.value) |
| 223 | + }); |
199 | 224 | } else { |
200 | 225 | return this.value; |
201 | 226 | } |
|
210 | 235 | this.axios.post(url, { |
211 | 236 | uuid: this.condition.uuid, |
212 | 237 | subject: this.subject, |
213 | | - operator: this.operator, |
| 238 | + operator: this.subject === 'COMPONENT_HASH' ? 'IS' : this.operator, |
214 | 239 | value: dynamicValue |
215 | 240 | }).then((response) => { |
216 | 241 | this.condition = response.data; |
|
222 | 247 | let url = `${this.$api.BASE_URL}/${this.$api.URL_POLICY}/${this.policy.uuid}/condition`; |
223 | 248 | this.axios.put(url, { |
224 | 249 | subject: this.subject, |
225 | | - operator: this.operator, |
| 250 | + operator: this.subject === 'COMPONENT_HASH' ? 'IS' : this.operator, |
226 | 251 | value: dynamicValue |
227 | 252 | }).then((response) => { |
228 | 253 | this.condition = response.data; |
|
0 commit comments