New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@serverless/sdk

Package Overview
Dependencies
Maintainers
4
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@serverless/sdk - npm Package Compare versions

Comparing version 0.5.19 to 0.5.20

lib/limit-tag-value.js

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

### [0.5.20](https://github.com/serverless/console/compare/@serverless/sdk@0.5.19...@serverless/sdk@0.5.20) (2023-06-07)
### Features
- Enforce limits on tag values ([8985b99](https://github.com/serverless/console/commit/8985b99b3c56cf8de30a50b3c855301eef84c25c))
- Enforce max length on tag name ([38a771b](https://github.com/serverless/console/commit/38a771bb9d072f0c6d7c7bd1bf82870223a31317))
### [0.5.19](https://github.com/serverless/console/compare/@serverless/sdk@0.5.18...@serverless/sdk@0.5.19) (2023-05-18)

@@ -7,0 +14,0 @@

8

lib/create-error-captured-event.js

@@ -9,2 +9,3 @@ 'use strict';

const resolveNonErrorName = require('./resolve-non-error-name');
const limitTagValue = require('./limit-tag-value');

@@ -33,8 +34,9 @@ const typeMap = new Map([

tags.name = error.name;
tags.message = error.message;
tags.message = limitTagValue(error.message);
} else {
tags.name = options._name || resolveNonErrorName(error);
tags.message = typeof error === 'string' ? error : util.inspect(error);
tags.message = limitTagValue(typeof error === 'string' ? error : util.inspect(error));
}
tags.stacktrace = options._stack || resolveStackTraceString(error);
tags.stacktrace = limitTagValue(options._stack || resolveStackTraceString(error));
capturedEvent.tags.setMany(tags, { prefix: 'error' });

@@ -41,0 +43,0 @@

@@ -12,4 +12,5 @@ 'use strict';

const reportError = require('./report-error');
const MAX_VALUE_LENGTH = require('./max-tag-value-length');
const isValidTagName = RegExp.prototype.test.bind(/^[a-zA-Z0-9_.-]+$/);
const isValidTagName = RegExp.prototype.test.bind(/^[a-zA-Z0-9_.-]{1,256}$/);

@@ -38,3 +39,12 @@ const ensureTagName = (() => {

return (inputValue, tagName) => {
if (typeof inputValue === 'string') return inputValue;
if (typeof inputValue === 'string') {
if (Buffer.from(inputValue).length > MAX_VALUE_LENGTH) {
return resolveException(inputValue, null, {
errorCode,
errorMessage: `Invalid trace span tag value for "${tagName}": Too large string:"%v"`,
Error: ServerlessSdkError,
});
}
return inputValue;
}
if (typeof inputValue === 'number') {

@@ -53,3 +63,3 @@ return ensureFinite(inputValue, {

let type = null;
return inputValue.map((item) => {
const normalizedValue = inputValue.map((item) => {
if (typeof item === 'string') {

@@ -89,2 +99,10 @@ if (type == null) type = 'string';

});
if (Buffer.from(JSON.stringify(normalizedValue)).length > MAX_VALUE_LENGTH) {
return resolveException(inputValue, null, {
errorCode,
errorMessage: `Invalid trace span tag value for "${tagName}": Too large value:"%v"`,
Error: ServerlessSdkError,
});
}
return normalizedValue;
}

@@ -91,0 +109,0 @@ return resolveException(inputValue, null, {

{
"name": "@serverless/sdk",
"repository": "serverless/console",
"version": "0.5.19",
"version": "0.5.20",
"author": "Serverless, Inc.",

@@ -6,0 +6,0 @@ "dependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc