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.
serverless-plugin-deploy-environment
Advanced tools
Plugin the augments the serverless provider environment with deployment variables
This plugin exposes per-stage deployment variables and deployment environment, and allows users to run commands with the environment of a given stage. The defined deployment environment is automatically merged with the serverless provider environment. It also optionally resolves credstash variables. The benefit of this is that its simpler to manage different variables for each environment, and makes the addition of default environment variables simple.
See our docs for full documentation.
provider:
region: us-west-2
custom:
deploy:
variables:
dev:
role: "devRole"
streamArn: "devStream"
staging:
role: "stagingRole"
streamArn: "stagingStream"
environments:
# These will be added to all environments
default:
LAMBDA_LOG_LEVEL: info
LAMBDA_REGION: ${self:provider.region} # All references are resolved
LAMBDA_ES_HOST:
'Fn::GetAtt': [ 'ESCluster', 'DomainEndpoint' ]
dev:
LAMBDA_ES_HOST: localhost
plugins:
- serverless-plugin-deploy-environment
Given this config, running with sls deploy --stage dev
would yield the following resolved configuration
deployVariables:
role: "devRole"
streamArn: "devStream"
deployEnvironment:
LAMBDA_LOG_LEVEL: info
LAMBDA_REGION: us-west-2
LAMBDA_ES_HOST: localhost
This plugin also exposes a command to run with the stage environment exposed. Give the above config, the command
sls runWithEnvironment --command 'echo $LAMBDA_ES_HOST' --stage 'dev'
will output localhost
.
The way that we use this at Doppler is that we have two separate configuration files at config/deploy.yml and config/variables.yml. All of the variables defined in deploy.yml will become environment variables, and everything in variables.yml are internal variables used to resolve references elsewhere in serverless.yml. Then, in our main serverless.yml file, we have
custom:
deploy:
variables: ${file(config/variables.yml)}
environments: ${file(config/deploy.yml)}
provider:
# ... Other static properties
domain: ${self:deployVariables.domain}
role: ${self:deployVariables.role}
This plugin also offers the ability to resolve credstash secrets anywhere in the Serverless configuration. First, set up credstash by following the instructions here. Then, in your configuration file, you can add:
custom:
deploy:
environments:
staging:
MY_PASSWORD: ${credstash:stagingPassword}
production:
MY_PASSWORD: ${credstash:productionPassword}
Please note that because these are resolved at build time, the plain-text passwords WILL be viewable in Cloudformation and on the Lambda dashboard.
FAQs
Plugin the augments the serverless provider environment with deployment variables
We found that serverless-plugin-deploy-environment 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
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.