A command-line tool for integrating NowSecure security assessments into your CI/CD pipeline. This tool enables automated mobile application security testing for both Android and iOS applications.
Note
If you're looking for ready-made CI/CD integrations, look at one of the following:
git clone https://github.com/nowsecure/nowsecure-ci.git
cd nowsecure-ci
go build -o nsgo install github.com/nowsecure/nowsecure-ci@latestBefore using this tool, you need:
- A token from your NowSecure platform instance. More information on this can be found in the NowSecure Support Portal.
- A valid group UUID from the NowSecure Platform. More information on this can be found in the NowSecure Support Portal.
The tool can be configured using command-line flags, environment variables, or a configuration file.
All flags can be set via environment variables with the NS_ prefix:
export NS_TOKEN="your-api-token"
export NS_GROUP_REF="your-group-uuid"Create a .ns-ci.yaml file in your project root or home directory:
token: your-api-token
group_ref: your-group-uuidFlags can be provided explicitly as part of the CLI command itself
ns run file ./path/to/app.apk \
--group-ref YOUR_GROUP_UUID The tool provides three methods to run security assessments:
ns run filens run packagens run id
--group-ref- A valid group reference from NowSecure Platform--token- Authentication token for the NowSecure Platform API
-
--api-host- REST API base URL (default:https://lab-api.nowsecure.com)- Use this to point to a different NowSecure endpoint if you are accessing a single tenant instance
-
--ui-host- UI base URL (default:https://app.nowsecure.com)- Use this to point to a different NowSecure instance is you are accessing a single tenant instance
--analysis-type- Type of assessment to run (default:full)full- Complete security assessment including dynamic and static analysisstatic- Static analysis only (requires--androidor--iosplatform flag)sbom- Software Bill of Materials generation
--android- Specify that the application platform is Android--ios- Specify that the application platform is iOS
Note: These flags are mutually exclusive. You must provide exactly one when using run package or when running static analysis.
-
--poll-for-minutes- Maximum duration in minutes to poll for assessment results (default:60)- Set to
0to trigger the assessment without waiting for results - Required to be greater than
0when using--save-findings
- Set to
-
--minimum-score- Minimum acceptable security score threshold (default:0)- If the assessment score falls below this value, the command exits with code 1
- Score range is 0-100
-
--save-findings- Fetch and save all findings from the assessment (default:false)- Findings are written to
findings.jsonin the artifacts directory - Requires
--poll-for-minutesto be greater than 0
- Findings are written to
-
--artifacts-dir- Directory path where artifacts should be saved (default: current working directory)- Used in conjunction with
--save-findings
- Used in conjunction with
Upload and analyze a mobile application binary (APK or IPA file):
ns run file ./path/to/app.apk \
--group-ref YOUR_GROUP_UUID \
--analysis-type full \
--poll-for-minutes 60 \
--minimum-score 70 \
--save-findings \
--artifacts-dir ./artifactsTrigger an assessment for an existing application using its package name and platform:
ns run package com.example.myapp \
--android \
--group-ref YOUR_GROUP_UUID \
--analysis-type full \
--poll-for-minutes 60 \
--minimum-score 75Note: When using run package, you must specify either --android or --ios to indicate the platform.
Run an assessment using a pre-existing application's UUID:
ns run id aaaaaaaa-1111-bbbb-2222-cccccccccccc \
--group-ref YOUR_GROUP_UUID \
--analysis-type full \
--poll-for-minutes 60 \
--minimum-score 80 \
--save-findingsns run package com.example.myapp \
--ios \
--analysis-type static \
--group-ref YOUR_GROUP_UUIDns run package com.example.myapp \
--android \
--analysis-type static \
--group-ref YOUR_GROUP_UUIDns run file ./path/to/app.apk \
--analysis-type sbom \
--group-ref YOUR_GROUP_UUIDns run file ./path/to/app.ipa \
--group-ref YOUR_GROUP_UUID \
--poll-for-minutes 0