Skip to content

Instantly share code, notes, and snippets.

@patrickkettner
Created April 4, 2023 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patrickkettner/93cccfc5284a822e5ddcd210bf20cf24 to your computer and use it in GitHub Desktop.
Save patrickkettner/93cccfc5284a822e5ddcd210bf20cf24 to your computer and use it in GitHub Desktop.
{
"name": "insecure download issue",
"version": "1.0",
"manifest_version": 3,
"action": {
"default_popup": "popup.html"
}
}
<!DOCTYPE html>
<html lang="en">
<body>
<button>download</button>
<script src="popup.js"></script>
</body>
</html>
const btn = document.querySelector('button');
btn.addEventListener('click', download)
function download(m_a, data) {
const lnk = document.createElement("a");
let file = new Blob([''], { type: 'plain/txt' });
lnk.href = URL.createObjectURL(file);
lnk.click()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment