Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
detect-autofill
Advanced tools
Small javascript library to detect and even prevent browsers autofill of form elements. Usefull for implementing floating labels or applying custom logics/styles.
<head>
...
<script src="https://unpkg.com/detect-autofill/dist/detect-autofill.js"></script>
...
</head>
document.addEventListener('onautocomplete', function(e) {
e.target.hasAttribute('autocompleted'); // true or false
e.preventDefault(); // prevent autocomplete
// do you stuff...
})
Small javascript library to detect browser autofill of form elements. Usefull for implementing floating labels or appling custom styles.
Modern browsers all have some ability to autocomplete the forms in a web page. It can be a login or a registration form, and the autofill can be triggered automatiaclly by the browser or manually by the user. In both cases there is no native way to detect the autocomplete. This is where this small library comes in handy.
Every browser has it's own way to autocomplete a form. Basically this library creates and triggers a CustomEvent
called autocomplete
every time this happends.
Furthermore this custom event can be prevented like all native events in order to block browser autofill using e.preventDefault()
.
onautocomplete
onautocomplete
cancelonautocomplete
CustomEvent | Edge | IE11 | Chrome | Firefox | Safari | Opera | iOS |
---|---|---|---|---|---|---|---|
onautocomplete | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
* This script uses different technics to detect autofill based on the browser:
:-webkit-autofill
to trigger a custom animation.inputType
property of the event.data
property.The demos can be tested on every browser. If something is not working properly, please open an issue or a PR.
Title | Source code | Live demo |
---|---|---|
Fake login page | Code | Live |
FAQs
Small javascript library to detect and even prevent browsers autofill of form elements. Usefull for implementing floating labels or applying custom logics/styles.
The npm package detect-autofill receives a total of 22,891 weekly downloads. As such, detect-autofill popularity was classified as popular.
We found that detect-autofill demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.