Download OVOW/scripts/release/check_archive.sh from AIGeeksGroup/PhysicalWM: direct link, hf CLI and curl.
- Browser
- Download file 2.27 kB
-
https://huggingface.co/datasets/AIGeeksGroup/PhysicalWM/resolve/main/OVOW/scripts/release/check_archive.sh
- Command line
-
hf download hf://datasets/AIGeeksGroup/PhysicalWM/OVOW/scripts/release/check_archive.sh
-
curl -L -o check_archive.sh https://huggingface.co/datasets/AIGeeksGroup/PhysicalWM/resolve/main/OVOW/scripts/release/check_archive.sh
2.27 kB
| set -euo pipefail | |
| ARCHIVE="${1:-}" | |
| [[ -n "$ARCHIVE" && -f "$ARCHIVE" ]] || { | |
| echo "Usage: $0 /path/to/OVOW-source.tar.gz" >&2 | |
| exit 2 | |
| } | |
| entries="$(tar -tzf "$ARCHIVE")" | |
| if printf '%s\n' "$entries" | grep -Eq '(^/|(^|/)\.\.(/|$))'; then | |
| echo "[FAIL] archive contains an absolute or parent-traversal path" >&2 | |
| exit 1 | |
| fi | |
| bad_path_re='(^|/)(\.git|\.env|\.gradio|\.idea|\.vscode|temp_local|scripts/logs|outputs?|ckpts?|checkpoints?|dist|(engine/)?oneposeviagen/locate/models|(engine/)?oneposeviagen/DynamicPose|(engine/)?oneposeviagen/Orientation/wonder3d_oa/multi_view_generation)(/|$)|\.(pt|ckpt|safetensors|so|o|pyc|log|pid|pem|key)$' | |
| bad_paths="$(printf '%s\n' "$entries" | grep -Ei "$bad_path_re" | grep -Ev '(^|/)\.env\.example$' || true)" | |
| if [[ -n "$bad_paths" ]]; then | |
| printf '%s\n' "$bad_paths" >&2 | |
| echo "[FAIL] archive contains prohibited paths or artifacts" >&2 | |
| exit 1 | |
| fi | |
| work="$(mktemp -d)" | |
| trap 'rm -rf -- "$work"' EXIT | |
| tar --no-same-owner --no-same-permissions -xzf "$ARCHIVE" -C "$work" | |
| secret_re='(sk-[A-Za-z0-9_-]{16,}|AKIA[0-9A-Z]{16}|AKID[A-Za-z0-9]{13,}|gh[pousr]_[A-Za-z0-9]{20,}|hf_[A-Za-z0-9]{20,}|BEGIN (RSA |EC |OPENSSH )?PRIVATE KEY)' | |
| secrets="$(grep -RIlE --exclude=check_release.sh --exclude=check_archive.sh "$secret_re" "$work" || true)" | |
| if [[ -n "$secrets" ]]; then | |
| printf '%s\n' "$secrets" | sed "s#^$work/##" >&2 | |
| echo "[FAIL] archive contains credential-like values" >&2 | |
| exit 1 | |
| fi | |
| private_path_re='(/dev_[A-Za-z0-9_]+/|/data[0-9]*/(home|miniconda3|anaconda3)/|/root/\.(conda|cache)/|/(home|Users)/[a-z][A-Za-z0-9._-]*/(project|projects|code|work|workspace)/|\b(tos|oss|cos|obs|bos|hdfs|afs)://)' | |
| extra_file="$(dirname "${BASH_SOURCE[0]}")/private_patterns.txt" | |
| if [[ -f "$extra_file" ]]; then | |
| extra="$(grep -vE '^\s*(#|$)' "$extra_file" | paste -sd'|' -)" | |
| [[ -n "$extra" ]] && private_path_re="${private_path_re%\'}|$extra'" | |
| fi | |
| private_paths="$(grep -RIlE --exclude=check_release.sh --exclude=check_archive.sh "$private_path_re" "$work" || true)" | |
| if [[ -n "$private_paths" ]]; then | |
| printf '%s\n' "$private_paths" | sed "s#^$work/##" >&2 | |
| echo "[FAIL] archive contains developer-specific paths or internal URLs" >&2 | |
| exit 1 | |
| fi | |
| echo "Archive audit passed: $ARCHIVE" | |
| sha256sum "$ARCHIVE" | |