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.
openapi-merge-cli
Advanced tools
This tool is based on the library. Please read that README for more details on how the merging algorithm works.
This library is intended to be used for merging multiple OpenAPI 3.0 files together. The most common reason that developers want to do this is because they have multiple services that they wish to expose underneath a single API Gateway. Therefore, even though this merging logic is sufficiently generic to be used for most use cases, some of the feature decisions are tailored for that specific use case.
In order to use this merging cli tool you need to have one or more OpenAPI 3.0 files that you wish to merge. Then you need to create a configuration file,
called openapi-merge.json
by default, in your current directory. It should look something like this:
{
"inputs": [
{
"inputFile": "./gateway.swagger.json"
},
{
"inputFile": "./jira.swagger.json",
"pathModification": {
"stripStart": "/rest",
"prepend": "/jira"
},
"operationSelection": {
"includeTags": ["included"]
}
},
{
"inputFile": "./confluence.swagger.yaml",
"disputePrefix": "Confluence",
"pathModification": {
"prepend": "/confluence"
},
"operationSelection": {
"excludeTags": ["excluded"]
}
}
],
"output": "./output.swagger.json"
}
In this configuration you specify your inputs and your output file. For each input you have the following parameters:
inputFile
or inputURL
: the relative path (or URL), from the openapi-merge.json
, to the OpenAPI schema file for that input (in JSON or Yaml format).disputePrefix
: if two inputs both define a component with the same name then, in order to prevent incorrect overlaps, we will attempt to use the dispute prefix to come up with a unique name for that component.pathModification.stripStart
: When copying over the paths
from your OpenAPI specification for this input, it will strip this string from the start of the path if it is found.pathModification.prepend
: When copying over the paths
from your OpenAPI specification for this input, it will prepend this string to the start of the path if it is found. prepend
will always run after stripStart
so that it is deterministic.operationSelection.includeTags
: Only operations that are tagged with the tags configured here will be extracted from the OpenAPI file and merged with the others. This instruction will not remove other tags from the top level tags definition for this input.operationSelection.excludeTags
: Only operations that are NOT tagged with the tags configured here will be extracted from the OpenAPI file and merged with the others. Also, these tags will also be removed from the top level tags
element for this file before being merged. If a single REST API operation has an includeTags
reference and an excludeTags
reference then the exclusion rule will take precidence.And then, once you have your Inputs in place and your configuration file you merely run the following in the directory that has your configuration file:
npx openapi-merge-cli
For more fine grained details on what Configuration
options are available to you. Please read the docs.
And the merge should be run and complete! Congratulations and enjoy!
If you experience any issues then please raise them in the bug tracker.
FAQs
A cli tool for the openapi-merge library.
The npm package openapi-merge-cli receives a total of 83,421 weekly downloads. As such, openapi-merge-cli popularity was classified as popular.
We found that openapi-merge-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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.