# @jupiterone/veracode-client

> Veracode REST & XML API client

Latest version **0.4.1** (published 2020-02-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @jupiterone/veracode-client
pnpm add @jupiterone/veracode-client
yarn add @jupiterone/veracode-client
bun add @jupiterone/veracode-client
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.1 |
| Published | 2020-02-07 |
| First published | 2019-03-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.10 |
| Dependencies | 4 |
| Unpacked size | 30.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | ahr5067, aiwilliams, charlieduong94, erichsmith, erkang, isaacwilliams, jpdimarz, jupiterone-dev, philidem, rcdilorenzo-lo |

## Links

- npm: https://www.npmjs.com/package/@jupiterone/veracode-client
- Repository: https://github.com/JupiterOne/veracode-client
- Homepage: https://github.com/JupiterOne/veracode-client#readme
- Issues: https://github.com/JupiterOne/veracode-client/issues
- npm.io page: https://npm.io/package/@jupiterone/veracode-client

## Dependencies (4)

- [xml-js](https://npm.io/package/xml-js.md) ^1.5.2
- [request](https://npm.io/package/request.md) ^2.88.0
- [archiver](https://npm.io/package/archiver.md) ^2.1.0
- [request-promise-native](https://npm.io/package/request-promise-native.md) ^1.0.5

## Recent versions

- 0.4.1 (latest) — 2020-02-07
- 0.4.0 — 2020-02-07
- 0.3.2 — 2019-07-10
- 0.3.1 — 2019-07-09
- 0.3.0 — 2019-06-11
- 0.2.0 — 2019-05-01
- 0.1.3 — 2019-03-01

## README

# veracode-client

[![Build Status](https://travis-ci.org/JupiterOne/veracode-client.svg?branch=master)](https://travis-ci.org/JupiterOne/veracode-client)

REST API client for Veracode. Uses xml-js to parse xml. Functionality follows
[the original Veracode API
documentation](https://help.veracode.com/reader/LMv_dtSHyb7iIxAQznC~9w/FhxRdiWf5qejrtajmjGtpw).

## Install

```bash
yarn add @jupiterone/veracode-client
```

## Usage

For convenience, all methods use objects to pass parameters, e.g. when the
original function expects parameters `app_id` and `sandbox_id`, VeracodeClient
function would be called the following object as parameter: `{appId, sandboxId}`

By default, calls return JSON.  When creating the VeracodeClient you can set
`returnXml` to `true` if you prefer to get back XML and convert it yourself.

Please see tests for more examples.

Usage example:

```javascript
const os = require('os');

const VeracodeClient = require('@jupiterone/veracode-client');

const veraClient = new VeracodeClient({
  apiId: process.env.VERA_ID,
  apiKey: process.env.VERA_KEY,
  [returnXml: <boolean>]
});

const testAppInfo = {
  appName: 'TestApp',
  appVersion: 'TestVersion',
  sandboxName: 'TestSandbox',
  businessCriticality: 'High', // 'High' is used by security-scan
  teams: 'Security', // Only security team will get notifications about this test app
  autoScan: true, // Required to start scan automatically after pre-scan
  description: 'Test application, safe to delete'
};

const appId = (await veraClient.createApp(testAppInfo)).application._attributes.app_id;
console.log('New app ID:', appId);

testAppInfo.appId = app_id;
const sandboxId = (await veraClient.createSandbox(testAppInfo)).sandbox._attributes.sandbox_id;
console.log('New Sandbox ID:', sandboxId);

testAppInfo.sandboxId = sandboxId;
const buildId = (await veraClient.createBuild(testAppInfo)).build._attributes.build_id;
console.log('New Build ID:', buildId);

testAppInfo.file = path.join(os.tmpdir(), `testapp.zip`);
await veraClient.createZipArchive('/my/source/code/location', testAppInfo.file, [ 'node_modules/**/*' ]);
const fileId = (await veraClient.uploadFile(testAppInfo)).file._attributes.file_id;
console.log('New File ID:', fileId);

const scanId = await veraClient.beginPrescan(testAppInfo).build.analysis_unit._attributes.build_id;
console.log('New Scan ID:', scanId);
```

## Development

To run the integration tests, you'll need a Veracode API id and secret. Follow
the [instructions on
Veracode](https://help.veracode.com/reader/LMv_dtSHyb7iIxAQznC~9w/Gv1oHnvAIwMy2gQSBrF0fA)
to obtain these credentials.

Once you have them, run this in your shell (with your id and secret substituted,
of course):

```sh
export VERA_ID=YOUR_VERACODE_ID
export VERA_KEY=YOUR_VERACODE_SECRET
export VERA_TEAM=SOME_TEAM_NAME_IN_YOUR_VERACODE_ACCOUNT // defaults to "Security"
```

Now you'll be able to run the integration tests with `yarn test:integration`.

## Notes

 1. Not all functions are currently implemented.

    List of implemented REST functions:

    |VeracodeClient method|API endpoint|
    |---|---|
    |getApplications|applications|
    |getFindings|applications/{applicationGUID}/findings|

    List of implemented XML functions:

    |VeracodeClient method|API endpoint|
    |---|---|
    |getAppList|getapplist.do|
    |getSandboxList|getsandboxlist.do|
    |createSandbox|createsandbox.do|
    |getBuildList|getbuildlist.do|
    |getAppBuilds|getappbuilds.do|
    |summaryReport|summaryreport.do|
    |detailedReport|detailedreport.do|
    |uploadFile|uploadfile.do|
    |beginPrescan|beginprescan.do|
    |createApp|createapp.do|
    |createBuild|createbuild.do|
    |getBuildInfo|getbuildinfo.do|
    |deleteApp|deleteapp.do|

 1. The `createZipArchive()` menthod is added to the client functionality for convenience

    Example:

    ```javascript
    await veraClient.createZipArchive('/path/to/my/repo', 'target_archive_name.zip', [ 'node_modules/**/*' ]);
    ```

 1. Only API ID and KEY authentication method supported

---
_Source: https://npm.io/package/@jupiterone/veracode-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
