
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
@google-cloud/debug-agent
Advanced tools
This module is experimental, and should be used by early adopters. This module uses APIs that may be undocumented and subject to change without notice.
This module provides Stackdriver Debugger support for Node.js applications. Stackdriver Debugger is a feature of Google Cloud Platform that lets you debug your applications in production without stopping or pausing your application. Here's an introductory video:
# Install with `npm` or add to your `package.json`.
npm install --save @google-cloud/debug-agent
// Require and start in the startup of your application:
require('@google-cloud/debug-agent').start({ allowExpressions: true });
// No auth necessary if your code is running on Google Cloud Platform.
// ... or, if you are running elsewhere, you can manually provide credentials:
require('@google-cloud/debug-agent').start({
allowExpressions: true,
projectId: 'particular-future-12345',
keyFilename: '/path/to/keyfile.json'
});
This starts the automatic Debugger Agent that enables your app to be debuggable using the Stackdriver Stackdriver Debug view within the Google Cloud Console. You can start adding snapshots and log-points to your application.
The Stackdriver Debugger Agent should work without manually provided authentication credentials for instances running on Google Cloud Platform, as long as the Stackdriver Debugger API access scope is enabled on that instance. For Google App Engine instances, this is automatic if the Debugger API has been enabled for your project (which is the default).
For Google Compute Engine instances, you need to explicitly enable the Debugger API access scope for each instance. When creating a new instance through the GCP web console, you can do this in one of two ways under Identity and API access:
You may add the Stackdriver Debugger API access scope to existing Compute instances if they are running as a non-default service account by adding the Cloud Debugger Agent role to the service account. For more information, see the docs for Creating and Enabling Service Accounts for Instances.
If your application is running outside of Google Cloud Platform, such as locally, on-premise, or on another cloud provider, you can still use Stackdriver Debugger.
You will need to specify your project name. Your project name is visible in the Google Cloud Console, it may be something like particular-future-12345
. If your application is running on Google Cloud Platform, you don't need to specify the project name. You can specify this either in the module options, or through an environment variable:
// In your app:
var debug = require('@google-cloud/debug-agent').start({
allowExpressions: true,
projectId: 'particular-future-12345',
keyFilename: '/path/to/keyfile.json'
});
# Or in Bash:
export GCLOUD_PROJECT='particular-future-12345'
You need to provide service account credentials to your application.
The recommended way is via Application Default Credentials.
GOOGLE_APPLICATION_CREDENTIALS
to the full path to the key. The debug agent will automatically look for this environment variable.If you are running your application on a machine where your are using the gcloud
command line tools, and are logged using gcloud auth login
, you already have sufficient credentials, and a service account key is not required.
Alternatively, you may set the keyFilename or credentials configuration field to the full path or contents to the key file, respectively. Setting either of these fields will override either setting GOOGLE_APPLICATION_CREDENTIALS or logging in using gcloud. For example:
// Require and start the agent with configuration options
require('@google-cloud/debug-agent').start({
// Allow the evaluation of watch expressions and snapshot conditions:
allowExpressions: true,
// The path to your key file:
keyFilename: '/path/to/keyfile.json',
// Or the contents of the key file:
credentials: require('./path/to/keyfile.json')
});
See the configuration object for more details.
Generate a source-context.json
file which contains information about the version of the source code used to build the application. This file should be located in the root directory of your application. When you open the Stackdriver Debugger in the Cloud Platform Console, it uses the information in this file to display the correct version of the source.
gcloud beta debug source gen-repo-info-file
You can customize the behaviour of the automatic debugger agent. See the agent configuration for a list of possible configuration options. These options can be passed in the options
object passed to the start
function.
require('@google-cloud/debug-agent').start({
// .. auth settings ..
// debug agent settings:
allowExpressions: true,
serviceContext: {
service: 'my-service',
version: 'version-1'
},
capture: { maxFrames: 20, maxProperties: 100 }
});
Once your application is running (deployed, or elsewhere), you should be able to use the Debug UI in your Cloud developer console. You can find the Debug UI in the 'STACKDRIVER -> Debug' section in the navigation panel, or by simply searching for 'Debug' in the cloud console.
If your source is hosted in a cloud source repository, Stackdriver Debugger will display the source code of your application automatically. Alternatively, you can also point the debugger to local files, a GitHub or Bitbucket repository, through a Source Capture, or you can simply type in a filename and line number. More details are on source options are available here.
If you have the source available, you can set a snapshot by clicking in the gutter (line number area). Once you set a snapshot, the debug agent will insert a momentary breakpoint at the code location in the running instances of the application.
As soon as that line of code is reached in any of the running instances of your application, the stack traces, local variables, and watch expressions are captured, and your application continues.
package.json
file.o.f
looks like a property access, but dynamically, it may end up calling a getter function. We presently do NOT detect such dynamic-side effects.2017-03-14, Version 1.0.0 (Experimental), @dominicdkramer
allowExpressions
configuration option.3256eed494
] - Update options in README (#249) (Matthew Loring) #24936a0c2c012
] - Add allowExpressions option (#244) (Matthew Loring) #24448a9952ec0
] - Report FUNCTION_NAME as the description (#247) (Ali Ijaz Sheikh)cfc4f3fedf
] - Relax configuration rules for agent (#245) (Matthew Loring) #2458358f670e2
] - Remove unused dependencies (#246) (Matthew Loring) #2466615823884
] - Reduce test loudness (#243) (Ali Ijaz Sheikh)52b5bd3f52
] - deal with source-context read errors (#242) (Ali Ijaz Sheikh)ce7ce0bbe9
] - improve normalizeConfig test (#241) (Ali Ijaz Sheikh)21a8f5accf
] - merge configs using a deep copy (#240) (Ali Ijaz Sheikh)75974f56d5
] - Document minorVersion_ as an internal property (#239) (Ali Ijaz Sheikh)FAQs
Stackdriver Debug Agent for Node.js
The npm package @google-cloud/debug-agent receives a total of 12,430 weekly downloads. As such, @google-cloud/debug-agent popularity was classified as popular.
We found that @google-cloud/debug-agent demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.