Compare commits

...

2 commits

Author SHA1 Message Date
David
d02710d6e2 Obfuscate instance & add SHA256 tooltip
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
2022-08-03 19:15:01 -07:00
David
3f65a94be3 Add crypto-js dependency 2022-08-03 18:48:34 -07:00
5 changed files with 47879 additions and 8681 deletions

38790
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -29,6 +29,7 @@
"chromatism": "3.0.0",
"click-outside-vue3": "4.0.1",
"cropperjs": "1.5.12",
"crypto-js": "^4.1.1",
"diff": "3.5.0",
"escape-html": "1.0.3",
"js-cookie": "^3.0.1",

View file

@ -1,5 +1,17 @@
import { mapState } from 'vuex'
import { get } from 'lodash'
import sha256 from 'crypto-js/sha256'
/** Haven't checked admin-fe sorry */
const OBFUSCATE = true
const obfuscate = (instance) => {
const half = Math.floor(instance.length / 2)
const fourth = Math.ceil(half / 2)
const slices = instance.match(new RegExp(`(.{${fourth}})(.{${half}})(.*)`))
slices[2] = slices[2].replace(/[^.]/g, '*')
return slices.slice(1, 4).join('')
}
/**
* This is for backwards compatibility. We originally didn't recieve
@ -9,10 +21,12 @@ import { get } from 'lodash'
*/
const toInstanceReasonObject = (instances, info, key) => {
return instances.map(instance => {
const censored = OBFUSCATE ? obfuscate(instance) : instance
const crypt = sha256(instance).toString()
if (info[key] && info[key][instance] && info[key][instance]['reason']) {
return { instance: instance, reason: info[key][instance]['reason'] }
return { instance: censored, reason: info[key][instance]['reason'], sha256: crypt }
}
return { instance: instance, reason: '' }
return { instance: censored, reason: '', sha256: crypt }
})
}

View file

@ -65,7 +65,10 @@
v-for="entry in rejectInstances"
:key="entry.instance + '_reject'"
>
<td>{{ entry.instance }}</td>
<td
:title="entry.sha256"
:aria-label="entry.sha256"
>{{ entry.instance }}</td>
<td v-if="entry.reason === ''">
{{ $t("about.mrf.simple.not_applicable") }}
</td>

17746
yarn.lock

File diff suppressed because it is too large Load diff