mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-20 23:25:43 +01:00
Answer security round 1: 0 🔴, 0 🟡 (0 misread); replace Forge keys and digits of any script, and fetch with the repo read-only
This commit is contained in:
@@ -39,10 +39,15 @@ function walk(value, path, visit) {
|
||||
}
|
||||
}
|
||||
|
||||
// `<app id>/<environment id>/...`, so one more id, where any other extension key names a macro.
|
||||
function isForgeKey(key, value) {
|
||||
return key === 'extensionKey' && String(value).includes('/')
|
||||
}
|
||||
|
||||
function walkAttributes(attributes, path, visit, nodeType) {
|
||||
for (const [key, member] of Object.entries(attributes)) {
|
||||
const memberPath = `${path}/${key}`
|
||||
if (formatKeys.has(key)) visit(member, memberPath, 'kept')
|
||||
if (formatKeys.has(key) && !isForgeKey(key, member)) visit(member, memberPath, 'kept')
|
||||
else if (nodeType === 'mention' && key === 'text') visit(member, memberPath, 'person')
|
||||
else walkFree(member, memberPath, visit)
|
||||
}
|
||||
@@ -125,7 +130,7 @@ function replacer(document, draws) {
|
||||
function mixed(original) {
|
||||
if (/^[0-9a-f]+$/.test(original)) return fresh(() => hex(original.length))
|
||||
return fresh(() => [...original].map((character) => {
|
||||
if (/\d/.test(character)) return digits(1)
|
||||
if (/\p{N}/u.test(character)) return digits(1)
|
||||
if (!/\p{L}/u.test(character)) return character
|
||||
return character === character.toLowerCase() ? letters(1) : letters(1).toUpperCase()
|
||||
}).join(''))
|
||||
|
||||
Reference in New Issue
Block a user