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.
static-type-js
Advanced tools
Static type support for javascript
/// var Parent = Type.create([type definition], [prototype]);
/// var Child = Parent.inherit([type definition], [prototype]);
var AdminUser, Group, User;
Group = Type.create({
_group: Type.STRING
}, {
_construct: function(group) {
this._group = group;
},
setGroup: function(value) {
this._group = value;
},
getGroup: function() {
return this._group;
}
});
AdminUser = Group.inherit({
username: Type.STIRNG,
date: Type.DATE
},{
_construct: function(username) {
this.username = username;
this.date = new Date;
this._super('admin'); /// this will override group because parent is group
},
setUser: function(value) {
this.username = value;
}
});
User = AdminUser.inherit({
username: Type.STIRNG,
date: Type.DATE
},{
_construct: function(username) {
this.username = username;
this.date = new Date;
this._super('test'); // this will override username to test because parent is AdminUser
this.setGroup('user'); // this will set group to user
},
setPassword: function(value) {
// this is not allowed all members must be defined at initialization proces (in _construct)
this.password = value;
}
});
var user = new User('igor');
user.username = 1; // throws type error because initial value is string
user.date = new RegExp; // throw type error because initial value is date
user.date = new Date; // is allowed because is correct type
user.date = null; // its allowed because all members are allowed to be null or undefined because of GC
user.date = 1; // re assigning values with wrong type throws type error
user.date = new Date; // re assigning initial value is allowed
User.prototype.one = 1; // Will throw type error because adding something to prototype after initialization is not allowed
User.one = 1; // Extending roots is not allowed
FAQs
Prototype inheritance and type system for js
The npm package static-type-js receives a total of 2 weekly downloads. As such, static-type-js popularity was classified as not popular.
We found that static-type-js 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.