Skip to main content

Common agent settings

These are the settings most people set. Every agent supports them unless a note says otherwise. To see every setting for an agent, use the Agent configuration editor or the agent's YAML template.

Each setting has a path, such as application.name. You write it differently in each source:

  • In a YAML file, nest the path. application: then name: my-app on the next line, indented.

  • As an environment variable, write CONTRAST__ followed by the path in upper case with double underscores between the parts. The setting application.name becomes CONTRAST__APPLICATION__NAME. See Environment variables.

  • As a Java system property, write -Dcontrast. followed by the path. The setting application.name becomes -Dcontrast.application.name. (Java agents only.)

Connection settings

Set the agent token. Use the other four only with agents that are older than the versions listed in Find the agent keys.

Setting

What it does

Default

api.token

The agent token, a base64 encoded JSON object that holds the URL, API key, service key and user name.

See Find the agent keys.

None

api.url

The Contrast web interface URL.

https://app.contrastsecurity.com/Contrast for the Java, Node.js and Go agents.

The Python and PHP agents have no default, so set the URL or use the agent token.

api.api_key

The API key the agent uses to communicate with Contrast.

None

api.service_key

The service key. The agent uses it to calculate the Authorization header.

None

api.user_name

The user name. The agent uses it to calculate the Authorization header.

None

Name your application and server

These settings control how Contrast shows your application and server:

Setting

What it does

Default

application.name

Overrides the application name that the agent reports.

On Java, when one process serves several applications, this setting makes the agent report all of them as one application with this name.

The agent derives a name from the application

application.group

The application group to associate the application with in Contrast.

None

application.code

The application code to use for the application in Contrast.

None

application.version

Overrides the application version that the agent reports.

None

server.name

Overrides the server name that the agent reports.

The host name of the machine

server.environment

Overrides the server environment. Use QA, PRODUCTION or DEVELOPMENT in upper case.

The host name of the machine

Organize and filter your data

Tags, application metadata, and session metadata help you find and filter applications, servers, libraries, and vulnerabilities in Contrast:

Setting

What it does

Default

application.tags

Labels for the application.

None

server.tags

Labels for the server.

None

assess.tags

Labels for vulnerabilities and preflight messages.

None

inventory.tags

Labels for libraries.

The Node.js and Go agents do not support this setting.

None

application.metadata

Your own key=value pairs for the application, such as owner or business unit.

None

application.session_id

The ID of a session that already exists in Contrast. The agent associates the vulnerabilities it finds with that session.

None

application.session_metadata

key=value pairs that Contrast uses to create a new session. The agent associates the vulnerabilities it finds with the new session.

None

Note

Write every tag setting as one comma-delimited string, for example label1,label2,label3. Don't use a YAML list. Write metadata as comma-delimited key=value pairs, for example business-unit=accounting,office=Baltimore.

Use either application.session_id or application.session_metadata, not both. Some agents don't start when both are set.

Common session metadata keys are commitHash, committer, branchName, gitTag, repository, testRun, version, and buildNumber. Most agents also add a build fingerprint named artifactHash for you.

To learn what tags, metadata and sessions do in Contrast, see Tag applications, Configure metadata values for individual applications, and Configure session metadata. Use session metadata filters to find the agent versions that add artifactHash.

Turn the agent off

Set the top-level enable setting to false to turn an agent off without removing it.

Note

It is not the same as assess.enable or protect.enable, which switch off only Assess or only Protect.

In a YAML file, write enable: false at the left margin with no parent key. As an environment variable, write CONTRAST__ENABLE=false. The default is true.

Write true or false in lower case. Some agents turn themselves off when they can't read the value, so a value such as True, yes, or 1 can switch an agent off with no message.