You've already forked Tricky-Addon-Update-Target-List
mirror of
https://github.com/KOWX712/Tricky-Addon-Update-Target-List.git
synced 2025-09-06 06:37:09 +00:00
Prevent code injection from downloaded keybox file (#23)
* add sanitization of arbitrary keybox content
This commit is contained in:
@@ -175,10 +175,11 @@ export async function setupSystemAppMenu() {
|
|||||||
|
|
||||||
// Function to backup previous keybox and set new keybox
|
// Function to backup previous keybox and set new keybox
|
||||||
async function setKeybox(content) {
|
async function setKeybox(content) {
|
||||||
|
const sanitizedContent = content.replace(/'/g, "'\\''");
|
||||||
try {
|
try {
|
||||||
await execCommand(`
|
await execCommand(`
|
||||||
mv -f /data/adb/tricky_store/keybox.xml /data/adb/tricky_store/keybox.xml.bak 2>/dev/null
|
mv -f /data/adb/tricky_store/keybox.xml /data/adb/tricky_store/keybox.xml.bak 2>/dev/null
|
||||||
echo '${content}' > /data/adb/tricky_store/keybox.xml
|
echo '${sanitizedContent}' > /data/adb/tricky_store/keybox.xml
|
||||||
chmod 644 /data/adb/tricky_store/keybox.xml
|
chmod 644 /data/adb/tricky_store/keybox.xml
|
||||||
`);
|
`);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user