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.
github.com/aws/aws-sdk-mobile-analytics-js
Developer Preview: We welcome developer feedback on this project. You can reach us by creating an issue on the GitHub repository or posting to the Amazon Mobile Analytics forums:
The Mobile Analytics SDK for JavaScript allows JavaScript enabled applications to create and submit events for analysis in the AWS Console and through Auto Export to S3 and Redshift. The library uses the browser's local storage API to create a local cache for the data, allowing your web application to batch and record events even when the app is offline.
<script src="/js/aws-sdk.min.js"></script> <script src="/js/aws-sdk-mobile-analytics.min.js"></script>
Step 1. Log in to the Amazon Mobile Analytics management console and create a new app. Be sure to note your App Id and Cognito Identity Pool Id.
Step 2. Initialize the credentials provider using a Cognito Identity Pool ID. This is necessary for the AWS SDK to manage authentication to the Amazon Mobile Analytics REST API.
AWS.config.region = 'us-east-1'; AWS.config.credentials = new AWS.CognitoIdentityCredentials({ IdentityPoolId: COGNITO_IDENTITY_POOL_ID //Required e.g. 'us-east-1:12345678-c1ab-4122-913b-22d16971337b' });
Step 3. Instantiate the Mobile Analytics Manager, including your App ID generated in Step 1, above. Session events will be automatically recorded and the client will batch and automatically submit events to Amazon Mobile Analytics every 10 seconds.
var options = { appId : MOBILE_ANALYTICS_APP_ID //Required e.g. 'c5d69c75a92646b8953126437d92c007' }; mobileAnalyticsClient = new AMA.Manager(options);
To manually force an event submission you can call:
mobileAnalyticsClient.submitEvents();
You can optionally add custom events to capture additional information you find valuable.
mobileAnalyticsClient.recordEvent('CUSTOM EVENT NAME', { 'ATTRIBUTE_1_NAME': 'ATTRIBUTE_1_VALUE', 'ATTRIBUTE_2_NAME': 'ATTRIBUTE_2_VALUE' /* ... */ }, { 'METRIC_1_NAME': 1, 'METRIC_2_NAME': 99.3 /* ... */ });
By default a session lasts 10 minutes. You can override this default setting when initializing the Mobile Analytics Manager by including "sessionLength" in the "options" object.
var options = { appId : MOBILE_ANALYTICS_APP_ID, sessionLength: 300000 //Session Length in milliseconds. This will evaluate to 5min. }; mobileAnalyticsClient = new AMA.Manager(options);
A session's timeout can also be updated to allow for continuation of a session.
//This will set the current session to expire in 5 seconds from now. mobileAnalyticsClient.resetSessionTimeout(5000); //This will reset the current session's expiration time using the time specified during initialization. //If the default setting was used (10 minutes) then the session will expire 10 minutes from now. mobileAnalyticsClient.resetSessionTimeout();
You can record monetization events to enable reports such as Average Revenue Per User (ARPU) and more.
mobileAnalyticsClient.recordMonetizationEvent( { productId : PRODUCT_ID, //Required e.g. 'My Example Product' price : PRICE, //Required e.g. 1.99 quantity : QUANTITY, //Required e.g. 1 currency : CURRENCY_CODE //Optional ISO currency code e.g. 'USD' }, {/* Custom Attributes */}, {/* Custom Metrics */} );
Additional app and environment details can be added to the "options" object when initializing the SDK. These details will be captured and applied to all events and can be useful if using Auto Export for custom analysis of your data.
var options = { appId : MOBILE_ANALYTICS_APP_ID, //Required e.g. 'c5d69c75a92646b8953126437d92c007' appTitle : APP_TITLE, //Optional e.g. 'Example App' appVersionName : APP_VERSION_NAME, //Optional e.g. '1.4.1' appVersionCode : APP_VERSION_CODE, //Optional e.g. '42' appPackageName : APP_PACKAGE_NAME, //Optional e.g. 'com.amazon.example' make : DEVICE_MAKE, //Optional e.g. 'Amazon' model : DEVICE_MODEL, //Optional e.g. 'KFTT' platform : DEVICE_PLATFORM, //Optional valid values: 'Android', 'iPhoneOS', 'WindowsPhone', 'Blackberry', 'Windows', 'MacOS', 'Linux' platformVersion : DEVICE_PLATFORM_VER //Optional e.g. '4.4' }; mobileAnalyticsClient = new AMA.Manager(options);
Please note, if device details are not specified Amazon Mobile Analytics will make best efforts to determine these values based on the User-Agent header value. It is always better to specify these values during initialization if they are available.
Further documentation and advanced configurations can be found here:
https://aws.github.io/aws-sdk-mobile-analytics-js/doc/AMA.Manager.html
The Amazon Mobile Analytics JavaScript SDK will make requests to the following endpoints
For most frameworks you can whitelist both domains by whitelisting all AWS endpoints with "*.amazonaws.com".
v0.9.2:
v0.9.1:
v0.9.0:
FAQs
Unknown package
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.