# .gitlab-ci.yml snippet — auto-generated by CyberScope v7.6
stages:
  - security

cyberscope-scan:
  stage: security
  image: python:3.11-slim
  timeout: 25 minutes
  script:
    - apt-get update && apt-get install -y curl
    - curl -fsSL https://your.host/takeover-scanner-v6.tar.gz -o cs.tar.gz
    - tar xzf cs.tar.gz && cd takeover-scanner-v6
    - pip install -r backend/requirements.txt
    - python3 cyberscope_cli.py scan "$CYBERSCOPE_TARGET" --depth shallow --json scan.json
    - |
      python3 - <<'PY'
      import json, sys
      d = json.load(open('scan.json'))
      thresh = {'critical': ['critical'], 'high': ['critical','high'],
                 'medium': ['critical','high','medium']}.get('high', ['critical','high'])
      bad = [f for f in d.get('findings',[]) if f.get('severity') in thresh]
      if bad:
          for f in bad[:20]: print(f)
          sys.exit(1)
      PY
  artifacts:
    when: always
    paths: [takeover-scanner-v6/scan.json]
