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.
This tiny library will parse YAML extensions used in serverless framework.
npm install sls-yaml
import yaml from "sls-yaml";
const compiledYamlAsJsonObject = yaml(YAML_FILE_PATH_OR_BUFFER);
${file(path/to/file.yml)}
${env:NODE_ENV}
${global:path.to.variable}
${self:path.to.variable}
${git:branch}
${git:sha1}
${replace(str, searchPattern, replaceValue )}
* - New extension not present in serverless yaml
const context = {
custom: ([arg]: string[]) => {
return `${arg}-beta`;
}
};
const result = yaml(content, null, context);
name: service
version: v1.0.2
subset: service@${custom(${self:version})}
name: service
version: v1.0.2
subset: service@v1.0.2-beta
This extension will include content of external yaml files.
version: 1
env: dev
config: ${file(./common.yml)}
endpoint: http://service-url
version: 1
env: dev
config:
endpoint: http://service-url
This extension will inject envronment values
export NODE_ENV = development
version: 1
env: ${env:NODE_ENV}
version: 1
env: development
This extension will inject variable from global scope.
version: 1
env: stage
config: ${file(./common.yml)}
endpoint: http://service-${global:env}
version: 1
env: stage
config:
endpoint: http://service-stage
This extension will inject variable from local scope.
version: 1
env: stage
config: ${file(./common.yml)}
port: 8080
endpoint: http://service:${self:port}
version: 1
env: stage
config:
port: 8080
endpoint: http://service:8080
This extension will inject current git branch name
branch: ${git:branch}
This extension will inject last git commit hash
image.tag: ${git:sha1}
replace(str:string, searchPattern:RegExp|string, replaceValue:string )
This extension will returns a new string with some or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match. If pattern is a string, only the first occurrence will be replaced.
version: v1.0.0
name: ServiceName@${replace(${ self : version }, /\\./gi, - )}
version: v1.0.0
name: ServiceName@v1-0-0
FAQs
Serverless framework yaml extension parser
We found that sls-yaml demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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’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.