
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).
construct-url
Advanced tools
A lightweight library to construct URLs including query parameters, path, protocol, domain and hash.
A lightweight NPM module to construct URLs including query parameters, path, protocol, domain and hash.
Installation using NPM:
$ npm i construct-url --save
Example usage:
const constructURL = require("construct-url");
// returns "https://example.com/page/details?option_a=test&option_b=test_two#main"
constructURL("http://example.com/", {
queryParams: {
option_a: "TEST",
OPTION_B: "test_two"
},
path: "/page/details",
lowercase: true,
protocol: "https",
hash: "main"
});
constructUrl(baseUrl, options);
The base URL is the domain for the constructed URL and which all query parameters, the path and the hash is appended to.
Query parameters should be a object passed in. Each key and value in the object will be appended to the URL as a query parameter. The key will be used as the query parameter and the value as the query value.
For example a query parameter object containing a key of "a" and a corresponding value of "b", would result in a query string of "?a=b".
Path parameter will be added to the URL as a path. The path parameter will avoid duplicate "/" in the path, by removing the last character of the base URL if it is a "/" and the first character of the path if it is a slash "/".
The hash parameter will be used to add a hash symbol and the value to the end of a URL. For example, if a hash value of "main" is provided, the constructed URL will end in "#main".
If the lowercase parameter has a value of true
, the path, hash and query parameters will all be converted to lowercase.
If the protocol attribute is equal to "https" or "http", the constructed URL will start with the relevant protocol. If the base URL provided already has a different protocol, the protocol will be replaced. If the protocol attribute is equal to "none", the constructed URL will have no protocol, even if the base URL had a protocol.
FAQs
A lightweight library to construct URLs including query parameters, path, protocol, domain and hash.
The npm package construct-url receives a total of 0 weekly downloads. As such, construct-url popularity was classified as not popular.
We found that construct-url 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.