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.
Tiny, data-driven, high performance ECS library written using JavaScript TypedArrays.
<3kb
gzippednpm i bitecs
// imports a factory function
import bitECS from 'bitECS'
// define the max number of entities in the ecs
const n = 1000000
// create a new ECS and destruct desirable functions
const {
addEntity,
addComponent,
removeComponent,
registerComponent,
registerSystem,
update
} = bitECS(n)
// register components
const Vector3 = { x: 'float32', y: 'float32', z: 'float32' } // nested structures are fully supported
registerComponent('position', Vector3)
registerComponent('velocity', Vector3)
// register a movement system
registerSystem({
name: 'movement',
// update will only apply to these components
// in this case entities with both a position & velocity component will be processed
components: ['position', 'velocity'],
// update function provides component managers and the entity ID to do work on
update: (pos, vel) => eid => {
// entity data is obtained from the respective component managers
// managers are objects with typedarray properties
// this is how high performance is reaped and maintained
pos.x[eid] += vel.x[eid]
pos.y[eid] += vel.y[eid]
pos.z[eid] += vel.z[eid]
},
// called whenever an entity is added to the system (has required components)
onEnter: (pos, vel) => eid => {},
// called whenever an entity is removed from the system (no longer has required components)
onExit: (pos, vel) => eid => {},
// called once, before the system update (not per entity, no eid passed in)
onBefore: (pos, vel) => {},
// called once, after the system update
onAfter: (pos, vel) => {},
// called per entity, before the system updates it
onBeforeEach: (pos, vel) => eid => {},
// called per entity, after the system updates it
onAfterEach: (pos, vel) => eid => {}
})
// create n entities with random position and velocity
for(let i = 0; i < n; i++) {
let eid = addEntity()
addComponent('position', eid, {x: Math.random(), y: Math.random(), z: Math.random()})
addComponent('velocity', eid, {x: Math.random(), y: Math.random(), z: Math.random()})
}
// node
setInterval(() => {
update()
}, 16) // yes, this ECS can process one million entities in under 16ms (depending on the CPU)
// browser
const loop = () => {
requestAnimationFrame(loop)
update()
}
loop()
FAQs
Functional, minimal, data-oriented, ultra-high performance ECS library written in Javascript
The npm package bitecs receives a total of 828 weekly downloads. As such, bitecs popularity was classified as not popular.
We found that bitecs 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.