Features
- Automatic Downloads: The default
dca(deep code analysis) ruleset is automatically fetched on the first scan - Local Caching: Downloaded rulesets are cached at
~/.scanoss/crypto-finder/cache/ - Time-to-Live (TTL)-Based Expiration:
- Pinned versions (e.g.,
v1.0.0): cache TTL of 7 days - Latest versions: cache TTL of 24 hours
- Pinned versions (e.g.,
- Stale Cache Fallback: When the API is unreachable and the cache has expired,
crypto-finder automatically falls back to the expired cache if it is within the
maximum stale age (default: 30 days). Use
--strictto disable this behaviour. - Checksum Verification: SHA256 verification ensures ruleset integrity
- Retry Logic: Automatic retry with exponential backoff on network failures
- Combined Rulesets: Remote and local rulesets can be used together in a single scan
Configuration
1. API Key Setup
You can configure your API key using one of three methods (in priority order):2. API URL (Optional)
The default API URL ishttps://api.scanoss.com. To use a custom instance:
Usage Examples
Cache Management
Cache Location
Cache Behaviour
- First scan: Downloads and caches the default
dcaruleset - Subsequent scans: Uses the cached version if it has not expired
- Expired cache: Automatically re-downloads on the next scan
- API unreachable with expired cache: Falls back to stale cache if within the maximum stale age limit
- Manual cleanup: Delete
~/.scanoss/crypto-finder/cache/to clear the cache
Stale Cache Fallback (Default Behaviour)
When the cache expires and the API is unreachable, crypto-finder automatically falls back to the expired cache, provided it is within the maximum stale age (default: 30 days). Flow:- Check whether the cache is valid (not expired)
- ✅ Valid → Use cached rulesets
- Cache expired → Attempt to download fresh rulesets from the API
- ✅ API reachable → Download and update cache
- ❌ API unreachable → Check stale cache fallback:
- If cache age ≤ max stale age (30 days) → Use stale cache with warning
- If cache age > max stale age → Fail with error
- If
--strictflag is set → Fail with error
- Resilience: Transient API outages do not interrupt scans
- CI/CD reliability: Pipeline failures caused by infrastructure issues are avoided
- Offline capability: Scanning can continue with slightly outdated rulesets
--strict:
- Compliance audits that require fresh rulesets
- Security-critical scans where stale rulesets are not acceptable
- Environments where a scan failure is preferable to using outdated rulesets
Troubleshooting
No API Key Error
Cache Not Available / Air-Gapped Environments
If you are working in an air-gapped environment and need to use cached rulesets: Solution:- Run a scan whilst connected to the internet to download and cache the rulesets
- Transfer the cache directory (
~/.scanoss/crypto-finder/cache/) to the air-gapped environment (for example, via removable media) - Crypto-finder will automatically use the cache within the TTL period (24 hours for latest versions; 7 days for pinned versions)
- After the TTL expires, scans will use the stale cache fallback (up to 30 days) and emit a warning
- For long-term offline use, consider switching to
--no-remote-rules --rules-dirwith local rulesets
API Unreachable / Network Timeout
When the API is unreachable and an expired cache exists, crypto-finder automatically falls back to the stale cache and logs a warning. Example warning:- The scan completes successfully using the stale cache
- A warning is written to stderr
- The process exits with code 0 (success)
Cache Too Stale
If the cached rulesets exceed the maximum stale age (default: 30 days), the scan will fail.⚠️ Note: Verify that the error message below reflects the actual output emitted by crypto-finder in this scenario.Error:
- Wait for the API to recover and retry
- Increase the maximum stale age (up to 90 days):
- Use local rulesets instead:
Best Practices
- Initial setup: Configure your API key once using
crypto-finder configure --api-key <key> - Hybrid approach: Combine remote rulesets with project-specific local rules for additional customisation
- CI/CD pipelines:
- Use the
SCANOSS_API_KEYenvironment variable for secure key management - The default behaviour (with stale cache fallback) is recommended for most pipelines, as it prevents failures caused by transient API issues
- Use
--strictfor compliance-critical pipelines where fresh rulesets are required - Use
--max-stale-ageto tune the acceptable staleness window (e.g.,--max-stale-age 7d)
- Use the
- Offline/air-gapped environments:
- Pre-cache rulesets before going offline
- Stale cache fallback provides up to 30 days of coverage (configurable up to 90 days)
- For longer offline periods, use
--no-remote-rules --rules-dirwith local rulesets