Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@travetto/asset
Advanced tools
Modular library for storing and retrieving binary assets with additional support for image modification at runtime
This module provides the framework for storing/retrieving assets. It also provides additional image functionality for on-the-fly resizing.
GraphicsMagick
is used under the covers for image transformation. If the binary is not installed the framework will spin up a docker
container to provide needed functionality.
The primary driver for the Asset framework is an AssetSource
which needs to be implemented to provide code on how to read and write files.
Initially you need to configure the AssetSource
to provide a backend for the storage and retrieval. Below we are using the Asset-Mongo
as the backend, but there are others to choose from.
class AppConfig {
@InjectableFactory()
static getConf(): AssetMongoConfig {
return new AssetMongoConfig();
}
@InjectableFactory()
static getSource(cfg: AssetMongoConfig): AssetSource {
return new AssetMongoSource(cfg);
}
}
After that, both AssetService
and ImageService
will rely upon the AssetSource
to do their work. Below you can see an example of storing and retrieving a user's profile image.
Storing of all assets goes through the AssetService
, but retrieval can either be from AssetService
or ImageService
depending on whether or not you want to perform image optimizations on retrieval.
@Injectable()
class UserProfileService {
constructor(
private asset: AssetService,
private image: ImageService,
private model: ModelService
) {}
async saveProfileImage(userId: string, image: Asset) {
const path = await this.asset.store(image);
const user = await this.model.getById(User, userId);
user.profileImage = path;
await this.model.update(User, user);
}
async getProfileImage(userId:string) {
const user = await this.model.getById(userId);
return await this.image.getImage(user.profileImage, { w: 100, h: 100 });
}
}
The current set of supported AssetSource
implementations are:
Asset-Mongo
provides the mongodb driver for file managementAsset-S3
provides the S3 driver for file managementFAQs
Modular library for storing and retrieving binary assets
The npm package @travetto/asset receives a total of 5 weekly downloads. As such, @travetto/asset popularity was classified as not popular.
We found that @travetto/asset demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.