(value: str, label: str)
| 2761 | |
| 2762 | |
| 2763 | def require_sha256_digest(value: str, label: str) -> str: |
| 2764 | normalized = optional_text(value, maximum=71) |
| 2765 | if ( |
| 2766 | normalized is None |
| 2767 | or not normalized.startswith("sha256:") |
| 2768 | or len(normalized) != 71 |
| 2769 | or any( |
| 2770 | character not in "0123456789abcdef" for character in normalized.removeprefix("sha256:") |
| 2771 | ) |
| 2772 | ): |
| 2773 | raise SystemExit(f"{label} must use sha256:<64 lowercase hex characters>.") |
| 2774 | return normalized |
| 2775 | |
| 2776 | |
| 2777 | def require_scan_relative_file(scan: sqlite3.Row, value: str) -> str: |
no test coverage detected