Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@mozilla/nimbus-shared
Advanced tools
This is a place to define data and schemas used across Project Nimbus.
This is a place to define data and schemas used across Project Nimbus.
Any data that moves between systems should have Typescript types defined here, which will be automatically converted to JSON Schema. Any data that needs to be re-used by multiple systems should be stored here to be shared.
Install this package
$ npm install --save @mozilla/nimbus-shared
Import it.
import nimbus from "@mozilla/nimbus-shared";
JSON Schemas can be accessed in nimbus.schemas
:
import { schemas } from "@mozilla.nimbus-shared";
schemas.normandy.ConsoleLogArguments;
// {"$schema": "http://json-schema.org/draft-07/schema#", ...}
Helper functions to validate objects against those schemas can be found in nimbus.typeGuards
.
import { typeGuards } from "@mozilla/nimbus-shared";
typeGuards.normandy_checkConsoleLogArguments({});
/*
* {
* ok: false,
* errors: [
* {
* keyword: 'required',
* dataPath: '',
* schemaPath: '#/definitions/ConsoleLogArguments/required',
* params: [Object],
* message: "should have required property 'message'"
* }
* ]
* }
*/
typeGuards.normandy_checkConsoleLogArguments({ message: "It works!" });
/*
* {
* ok: true,
* errors: null
* }
*/
As well as everything available from JS, the original types the schemas are generated from are
available in the types
export of the library. Additionally, well-typed guards and assertions are
available in typeGuards
.
import { types, typeGuards } from "@mozilla/nimbus-shared";
let incomingJson: object = { message: "json from the server" };
// incoming JSON is a generic object with no type information
if (typeGuards.normandy_isConsoleLogArguments(incomingJson)) {
// incomingJson has been narrowed to `types.normandy.ConsoleLogArguments
} else {
// Something is wrong, and the types don't match what we expected.
}
const message: types.messaging.SimpleCFRMessage = { id: "incomplete-message" };
// Error: missing the following properties from type 'SimpleCFRMessage': template, trigger, content
const userInput = { arbitrary: "json" };
typeGuards.normandy_assertAddonRollbackArguments(userInput);
// userInput has now been asserted to be of type `normandy.AddonRollbackArguments`.
// If it wasn't the previous line would have thrown an error.
Native support coming soon. For now, consider using the NPM package and loading the schemas directly
from the filesystem. After installing this package via npm
, the schemas will be available at
node_modules/@mozilla/nimbus-shared/schemas/<group>/<type>.json
.
Node 14 is required to work on this repository, though will not be required for the eventual bundled outputs prepared for other systems.
Common tasks are defined as Make targets:
make install # Install dependencies with NPM
make lint # Run static analysis
make build # Build output files
make test # Test
Dependencies are managed with npm. Use npm install --save
and npm install --save-dev
to add new
dependencies.
TBD
FAQs
This is a place to define data and schemas used across Project Nimbus.
The npm package @mozilla/nimbus-shared receives a total of 24 weekly downloads. As such, @mozilla/nimbus-shared popularity was classified as not popular.
We found that @mozilla/nimbus-shared demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 16 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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.