Skip to main content

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
  • 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 --strict to 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 is https://api.scanoss.com. To use a custom instance:

Usage Examples

Cache Management

Cache Location

Cache Behaviour

  • First scan: Downloads and caches the default dca ruleset
  • 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:
  1. Check whether the cache is valid (not expired)
    • ✅ Valid → Use cached rulesets
  2. 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 --strict flag is set → Fail with error
Rationale:
  • 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
When to use --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

Solution: Configure your API key using any of the methods shown above.

Cache Not Available / Air-Gapped Environments

If you are working in an air-gapped environment and need to use cached rulesets: Solution:
  1. Run a scan whilst connected to the internet to download and cache the rulesets
  2. Transfer the cache directory (~/.scanoss/crypto-finder/cache/) to the air-gapped environment (for example, via removable media)
  3. Crypto-finder will automatically use the cache within the TTL period (24 hours for latest versions; 7 days for pinned versions)
  4. After the TTL expires, scans will use the stale cache fallback (up to 30 days) and emit a warning
  5. For long-term offline use, consider switching to --no-remote-rules --rules-dir with 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:
Behaviour:
  • The scan completes successfully using the stale cache
  • A warning is written to stderr
  • The process exits with code 0 (success)
To disable fallback and fail instead:

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:
Solutions:
  1. Wait for the API to recover and retry
  2. Increase the maximum stale age (up to 90 days):
  1. Use local rulesets instead:

Best Practices

  1. Initial setup: Configure your API key once using crypto-finder configure --api-key <key>
  2. Hybrid approach: Combine remote rulesets with project-specific local rules for additional customisation
  3. CI/CD pipelines:
    • Use the SCANOSS_API_KEY environment 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 --strict for compliance-critical pipelines where fresh rulesets are required
    • Use --max-stale-age to tune the acceptable staleness window (e.g., --max-stale-age 7d)
  4. 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-dir with local rulesets