@sentry/aws-serverless
Advanced tools
| #!/usr/bin/env node | ||
| import*as n from"node:http";import{buffer as t}from"node:stream/consumers";const e=globalThis,o="10.49.0";const r={};function i(n){if(!("console"in e))return n();const t=e.console,o={},i=Object.keys(r);i.forEach(n=>{const e=r[n];o[n]=t[n],t[n]=e});try{return n()}finally{i.forEach(n=>{t[n]=o[n]})}}function s(){return c().enabled}function a(n,...t){s()&&i(()=>{e.console[n](`Sentry Logger [${n}]:`,...t)})}function c(){return function(n,t,r=e){const i=r.__SENTRY__=r.__SENTRY__||{},s=i[o]=i[o]||{};return s[n]||(s[n]=t())}("loggerSettings",()=>({enabled:!1}))}const p={enable:function(){c().enabled=!0},disable:function(){c().enabled=!1},isEnabled:s,log:function(...n){a("log",...n)},warn:function(...n){a("warn",...n)},error:function(...n){a("error",...n)}},l=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function f(n,t,e){return`${function(n){return`${function(n){const t=n.protocol?`${n.protocol}:`:"",e=n.port?`:${n.port}`:"";return`${t}//${n.host}${e}${n.path?`/${n.path}`:""}/api/`}(n)}${n.projectId}/envelope/`}(n)}?${function(n){const t={sentry_version:"7"};return n.publicKey&&(t.sentry_key=n.publicKey),new URLSearchParams(t).toString()}(n)}`}class h{constructor(){this.t=`http://${process.env.AWS_LAMBDA_RUNTIME_API}/2020-01-01/extension`,this.o=null}async register(){const n=await fetch(`${this.t}/register`,{method:"POST",body:JSON.stringify({events:["INVOKE","SHUTDOWN"]}),headers:{"Content-Type":"application/json","Lambda-Extension-Name":"sentry-extension"}});if(!n.ok)throw new Error(`Failed to register with the extension API: ${await n.text()}`);this.o=n.headers.get("lambda-extension-identifier")}async next(){if(!this.o)throw new Error("Extension ID is not set");const n=await fetch(`${this.t}/event/next`,{headers:{"Lambda-Extension-Identifier":this.o,"Content-Type":"application/json"}});if(!n.ok)throw new Error(`Failed to advance to next event: ${await n.text()}`)}async error(n,t){if(!this.o)throw new Error("Extension ID is not set");const e=`Extension.${t.name||"UnknownError"}`,o=await fetch(`${this.t}/${n}/error`,{method:"POST",body:JSON.stringify({errorMessage:t.message||t.toString(),errorType:e,stackTrace:[t.stack]}),headers:{"Content-Type":"application/json","Lambda-Extension-Identifier":this.o,"Lambda-Extension-Function-Error":e}});throw o.ok||p.error(`Failed to report error: ${await o.text()}`),t}startSentryTunnel(){const e=n.createServer(async(n,e)=>{if("POST"===n.method&&n.url?.startsWith("/envelope"))try{const o=await t(n),r=o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength),s=(new TextDecoder).decode(r).split("\n")[0],a=JSON.parse(s||"{}");if(!a.dsn)throw new Error("DSN is not set");const c=function(n){const t=l.exec(n);if(!t)return void i(()=>{console.error(`Invalid Sentry Dsn: ${n}`)});const[e,o,r="",s="",a="",c=""]=t.slice(1);let p="",f=c;const h=f.split("/");if(h.length>1&&(p=h.slice(0,-1).join("/"),f=h.pop()),f){const n=f.match(/^\d+/);n&&(f=n[0])}return{protocol:(d={host:s,pass:r,path:p,projectId:f,port:a,protocol:e,publicKey:o}).protocol,publicKey:d.publicKey||"",pass:d.pass||"",host:d.host,port:d.port||"",path:d.path||"",projectId:d.projectId};var d}(a.dsn);if(!c)throw new Error("Invalid DSN");const h=f(c);fetch(h,{method:"POST",body:r}).catch(n=>{p.error("Error sending envelope to Sentry",n)}),e.writeHead(200,{"Content-Type":"application/json"}),e.end(JSON.stringify({}))}catch(n){p.error("Error tunneling to Sentry",n),e.writeHead(500,{"Content-Type":"application/json"}),e.end(JSON.stringify({error:"Error tunneling to Sentry"}))}else e.writeHead(404,{"Content-Type":"application/json"}),e.end(JSON.stringify({error:"Not found"}))});e.listen(9e3,()=>{p.log("Sentry proxy listening on port 9000")}),e.on("error",n=>{p.error("Error starting Sentry proxy",n),process.exit(1)})}}(async function(){const n=new h;for(await n.register(),n.startSentryTunnel();;)await n.next()})().catch(n=>{p.error("Error in Lambda Extension",n)}); | ||
| import*as n from"node:http";import{buffer as t}from"node:stream/consumers";const e=globalThis,o="10.50.0-alpha.0";const r={};function i(n){if(!("console"in e))return n();const t=e.console,o={},i=Object.keys(r);i.forEach(n=>{const e=r[n];o[n]=t[n],t[n]=e});try{return n()}finally{i.forEach(n=>{t[n]=o[n]})}}function s(){return c().enabled}function a(n,...t){s()&&i(()=>{e.console[n](`Sentry Logger [${n}]:`,...t)})}function c(){return function(n,t,r=e){const i=r.__SENTRY__=r.__SENTRY__||{},s=i[o]=i[o]||{};return s[n]||(s[n]=t())}("loggerSettings",()=>({enabled:!1}))}const p={enable:function(){c().enabled=!0},disable:function(){c().enabled=!1},isEnabled:s,log:function(...n){a("log",...n)},warn:function(...n){a("warn",...n)},error:function(...n){a("error",...n)}},l=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function h(n,t,e){return`${function(n){return`${function(n){const t=n.protocol?`${n.protocol}:`:"",e=n.port?`:${n.port}`:"";return`${t}//${n.host}${e}${n.path?`/${n.path}`:""}/api/`}(n)}${n.projectId}/envelope/`}(n)}?${function(n){const t={sentry_version:"7"};return n.publicKey&&(t.sentry_key=n.publicKey),new URLSearchParams(t).toString()}(n)}`}class f{constructor(){this.t=`http://${process.env.AWS_LAMBDA_RUNTIME_API}/2020-01-01/extension`,this.o=null}async register(){const n=await fetch(`${this.t}/register`,{method:"POST",body:JSON.stringify({events:["INVOKE","SHUTDOWN"]}),headers:{"Content-Type":"application/json","Lambda-Extension-Name":"sentry-extension"}});if(!n.ok)throw new Error(`Failed to register with the extension API: ${await n.text()}`);this.o=n.headers.get("lambda-extension-identifier")}async next(){if(!this.o)throw new Error("Extension ID is not set");const n=await fetch(`${this.t}/event/next`,{headers:{"Lambda-Extension-Identifier":this.o,"Content-Type":"application/json"}});if(!n.ok)throw new Error(`Failed to advance to next event: ${await n.text()}`)}async error(n,t){if(!this.o)throw new Error("Extension ID is not set");const e=`Extension.${t.name||"UnknownError"}`,o=await fetch(`${this.t}/${n}/error`,{method:"POST",body:JSON.stringify({errorMessage:t.message||t.toString(),errorType:e,stackTrace:[t.stack]}),headers:{"Content-Type":"application/json","Lambda-Extension-Identifier":this.o,"Lambda-Extension-Function-Error":e}});throw o.ok||p.error(`Failed to report error: ${await o.text()}`),t}startSentryTunnel(){const e=n.createServer(async(n,e)=>{if("POST"===n.method&&n.url?.startsWith("/envelope"))try{const o=await t(n),r=o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength),s=(new TextDecoder).decode(r).split("\n")[0],a=JSON.parse(s||"{}");if(!a.dsn)throw new Error("DSN is not set");const c=function(n){const t=l.exec(n);if(!t)return void i(()=>{console.error(`Invalid Sentry Dsn: ${n}`)});const[e,o,r="",s="",a="",c=""]=t.slice(1);let p="",h=c;const f=h.split("/");if(f.length>1&&(p=f.slice(0,-1).join("/"),h=f.pop()),h){const n=h.match(/^\d+/);n&&(h=n[0])}return{protocol:(d={host:s,pass:r,path:p,projectId:h,port:a,protocol:e,publicKey:o}).protocol,publicKey:d.publicKey||"",pass:d.pass||"",host:d.host,port:d.port||"",path:d.path||"",projectId:d.projectId};var d}(a.dsn);if(!c)throw new Error("Invalid DSN");const f=h(c);fetch(f,{method:"POST",body:r}).catch(n=>{p.error("Error sending envelope to Sentry",n)}),e.writeHead(200,{"Content-Type":"application/json"}),e.end(JSON.stringify({}))}catch(n){p.error("Error tunneling to Sentry",n),e.writeHead(500,{"Content-Type":"application/json"}),e.end(JSON.stringify({error:"Error tunneling to Sentry"}))}else e.writeHead(404,{"Content-Type":"application/json"}),e.end(JSON.stringify({error:"Not found"}))});e.listen(9e3,()=>{p.log("Sentry proxy listening on port 9000")}),e.on("error",n=>{p.error("Error starting Sentry proxy",n),process.exit(1)})}}(async function(){const n=new f;for(await n.register(),n.startSentryTunnel();;)await n.next()})().catch(n=>{p.error("Error in Lambda Extension",n)}); |
@@ -1,1 +0,1 @@ | ||
| {"type":"module","version":"10.49.0","sideEffects":false} | ||
| {"type":"module","version":"10.50.0-alpha.0","sideEffects":false} |
+4
-4
| { | ||
| "name": "@sentry/aws-serverless", | ||
| "version": "10.49.0", | ||
| "version": "10.50.0-alpha.0", | ||
| "description": "Official Sentry SDK for AWS Lambda and AWS Serverless Environments", | ||
@@ -73,5 +73,5 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
| "@opentelemetry/semantic-conventions": "^1.40.0", | ||
| "@sentry/core": "10.49.0", | ||
| "@sentry/node": "10.49.0", | ||
| "@sentry/node-core": "10.49.0", | ||
| "@sentry/core": "10.50.0-alpha.0", | ||
| "@sentry/node": "10.50.0-alpha.0", | ||
| "@sentry/node-core": "10.50.0-alpha.0", | ||
| "@types/aws-lambda": "^8.10.62" | ||
@@ -78,0 +78,0 @@ }, |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 8 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 8 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
289598
0.02%4
33.33%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
Updated
Updated