
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).
angular-server-side-configuration
Advanced tools
Configure an angular application at runtime on the server via environment variables.
The Angular CLI provides build time configuration (via environment.ts). In a Continuous Delivery environment this is sometimes not enough.
Environment variables are used for configuration. This package provides a script
to search for usages in bundled angular files and a script for inserting populated
environment variables into index.html file(s) by replacing <!--CONFIG-->
(Missing environment variables will be represented by null). This should be done
on the host serving the bundled angular files.
This will not work in Module.forRoot or Module.forChild scripts or parameters. These are build time only due to AOT restrictions.
npm install --save angular-server-side-configuration
Use process.env.NAME in your environment.prod.ts, where NAME is the environment variable that should be used.
import 'angular-server-side-configuration/process';
export const environment = {
production: process.env.PROD !== 'false',
apiAddress: process.env.API_ADDRESS || 'https://example-api.com'
};
Add <!--CONFIG-->
to index.html. This will be replaced by the configuration script tag.
This is optional, as the environment variables can simply be inserted somewhere in the head tag.
It is however the safest option.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Angular Example</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<!--CONFIG-->
</head>
<body>
<app-root></app-root>
</body>
</html>
npm install -g angular-server-side-configuration
ngssc insert /path/to/angular/files --search
angular-server-side-configuration provides a CLI.
npm install angular-server-side-configuration -g
ngssc --help
Usage: insert [options] [directory]
Search and replace the placeholder with environment variables (Directory defaults to current working directory)
Options | Description |
---|---|
-s, --search | Search environment variables in available .js files (Defaults to false) |
-e, --env <value> | Add an environment variable to be resolved (default: []) |
-p, --placeholder <value> | Set the placeholder to replace with the environment variables (Defaults to <!--CONFIG--> ) |
-h, --head | Insert environment variables into the head tag (after title tag, if available, otherwise before closing head tag) |
--dry | Perform the insert without actually inserting the variables |
-h, --help | output usage information |
Usage: init [options] [directory]
Initialize an angular project with angular-server-side-configuration (Directory defaults to current working directory)
Options | Description |
---|---|
-ef, --environment-file | The environment file to initialize (environmentFile defaults to src/environments/environment.prod.ts) |
--npm | Install angular-service-side-configuration via npm (Default) |
--yarn | Install angular-service-side-configuration via yarn |
-h, --help | output usage information |
Apache License, Version 2.0
FAQs
Configure an angular application on the server
The npm package angular-server-side-configuration receives a total of 1,832 weekly downloads. As such, angular-server-side-configuration popularity was classified as popular.
We found that angular-server-side-configuration demonstrated a healthy version release cadence and project activity because the last version was released less than 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.