This repository has been archived by the owner on Jun 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from snyk/feat/demo
feat: add a demo server that triggers a vuln method
- Loading branch information
Showing
5 changed files
with
107 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
# Snyk Nodejs Runtime Agent | ||
|
||
Use this package as a library in your application to monitor your dependencies and learn how the dependencies' vulnerable methods are being invoked in your deployments. | ||
|
||
# Howto | ||
```js | ||
require('@snyk/nodejs-agent')({ | ||
url: 'https://homebase.snyk.io/api/v1/beacon', | ||
projectId: `your project ID from snyk.io`, | ||
}); | ||
``` | ||
|
||
# Demo | ||
`npm start` to bring up an http server that invokes a vulnerable method on every request. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// load the agent from the local project and start it | ||
require('../lib')({ | ||
url: 'http://localhost:8000/api/v1/beacon', | ||
projectId: 'A3B8ADA9-B726-41E9-BC6B-5169F7F89A0C', | ||
debug: true, | ||
}); | ||
|
||
// create a server with a known vulnerability | ||
const http = require('http'); | ||
const st = require('st'); | ||
const PORT = process.env.PORT || 3000; | ||
|
||
|
||
http.createServer( | ||
st({ | ||
path: __dirname + '/static', | ||
url: '/', | ||
cors: true | ||
}) | ||
).listen(PORT, () => console.log(`Demo server started, hit http://localhost:${PORT}/hello.txt to try it`)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Hello there! | ||
|
||
You've just triggered a vulnerable method in `st`, congratulations! | ||
|
||
This event is being recorded and will be sent to the homebase service shortly. | ||
Refresh this page to trigger the event once again. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters