
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Time and shared secret based hash creation/validation library.
Use Gilde to create and validate shared secret and time based hashes derived from any JSON-serializable data. Gilde is mostly useful in a controlled environment (such as a set of microservices within one organization/infrastructure) and not suitable for public-facing authorizations.
npm install gilde
var Gilde = require('gilde'),
gilde = new Gilde().setSecret('Thirteen stone columns inside a pyramid.');
var data = {
some: 'awesome data'
};
var hash = gilde.create(data);
This will create a time and shared secret based derived hash, based on the given data. Then, in another part of your system, you can validate the given data against the given hash, using the following syntax.
Once you've created a hash, you can validate it, using:
var result = gilde.validate(hash, data);
// returns either true or false
This will return a boolean value of the validation result.
var result = gilde.validate(hash, data, { timeout: 5000 });
// returns either true or false
Furthermore, you can pass a third argument to .validate()
— currently, it only supports the timeout
option which will control the threshold (in milliseconds) of timestamps that are still considered valid. In the given example, any hash older than 5000 milliseconds (5 s) will be considered invalid.
The shared secret, JSON serialized data and the current UNIX timestamp in milliseconds are hashed together using the SHA256 algorhythm into hashA
. The derived hashA
is then hashed again together with the same UNIX timestamp using the SHA256 algorhythm into hashB
. The resulting hashB
is joined with the same timestamp and returned from the function as a single string, e.g. 57b91ea40b4bc28baa4ff782e661c5a6a12db97a3f60f4bd272ff32d9d77d8ed,1444044349222
.
The result of calling gilde.create()
thus returns a string that contains the derived hash and the timestamp used in the hashing process. Revealing the timestamp in a non-hashed format is acceptable and required, since this is used for validation on the other end, and timeouts are used to invalidate any hashes marked as older than a configurable threshold.
When validating the hashes, gilde.validate()
requires you to supply the resulting created hash and the underlying data in question. It will then try to recreate the hash using the supplied timestamp and will produce a positive result if both the hash can be recreated (meaning the shared secret is the same and data matches) and time threshold is not exceeded (e.g. hash is validated within N milliseconds after it was first created).
MIT.
FAQs
Time and shared secret based hash creation/validation library
The npm package gilde receives a total of 0 weekly downloads. As such, gilde popularity was classified as not popular.
We found that gilde 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.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.