Run security scans.
(self)
| 169 | return False, "", str(e) |
| 170 | |
| 171 | def _run_security_scan(self) -> Tuple[bool, str, Optional[str]]: |
| 172 | """Run security scans.""" |
| 173 | try: |
| 174 | # Check for common security issues in dependencies |
| 175 | cargo_path = shutil.which("cargo") |
| 176 | if not cargo_path: |
| 177 | raise FileNotFoundError("cargo executable not found in PATH") |
| 178 | result = subprocess.run([cargo_path, "audit"], capture_output=True, text=True, cwd=self.root_path, timeout=180, shell=False) # nosec |
| 179 | |
| 180 | # cargo audit returns non-zero for vulnerabilities |
| 181 | if result.returncode != 0: |
| 182 | return False, result.stdout, result.stderr |
| 183 | |
| 184 | return True, result.stdout, None |
| 185 | |
| 186 | except subprocess.TimeoutExpired: |
| 187 | return False, "", "Security scan timed out" |
| 188 | except FileNotFoundError: |
| 189 | # If cargo audit is not available, skip this check |
| 190 | return True, "cargo-audit not available, skipping security scan", None |
| 191 | except Exception as e: |
| 192 | return False, "", str(e) |
| 193 | |
| 194 | def _check_dependencies(self) -> Tuple[bool, str, Optional[str]]: |
| 195 | """Check dependency consistency.""" |