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.
Like an array, but rounder.
Hoopy is a circular array
data type.
It extends Array
so that out-of-bounds indices
wrap back round
to the start of the array
(or if they're negative indices,
they wrap back round
to the end of the array).
If you want a fixed-length buffer for streamed I/O, Hoopy can do that for you.
Via npm
:
npm i hoopy --save
Or if you just want the git repo:
git clone git@gitlab.com:philbooth/hoopy.git
const Hoopy = require('hoopy');
const hoopy = new Hoopy(10);
assert(Array.isArray(hoopy));
You must pass
a size
argument
to the Hoopy
constructor,
otherwise it will throw.
for (let i = 0; i < hoopy.length; ++i) {
hoopy[i] = i;
console.log(hoopy[i]);
}
You can read and write array items using square brackets for indexing as you would with a normal array. However, if you write to an out-of-bounds index, it will not increase the length of the array. Instead the index is applied modulo the array length, wrapping back round to the start. Negative indices work in reverse, wrapping back round to the end of the array.
The methods
push
, pop
, shift
and unshift
will throw if called.
Future versions of the library
may implement sane behaviour
for them.
All of the other Array
methods
work normally.
hoopy.grow(50);
The grow
method
adds items to the array.
It takes one argument,
which is the number
of items to grow the array by.
The new length of the array
will be the old length
plus the number you pass to grow
.
If the current state of the array
includes overflowed indices,
grow
will take care
to move those items
in to the freshly-created
available space,
so that the correct order is maintained
for your data.
The caller is responsible
for ensuring they don't overwrite
unprocessed items.
If you need to increase
the size of the array,
you must call grow
.
Yes.
To install the dependencies:
npm i
To run the tests:
npm t
To lint the code:
npm run lint
MIT.
FAQs
Like an array, but rounder.
The npm package hoopy receives a total of 3,061,614 weekly downloads. As such, hoopy popularity was classified as popular.
We found that hoopy 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.