Compare commits
No commits in common. "4146aa997b203f72bafecf44406c2775c1fb759d" and "6d55ac6cc53c77bf9bc7041c761741ed6e593607" have entirely different histories.
4146aa997b
...
6d55ac6cc5
5 changed files with 3 additions and 25 deletions
|
|
@ -108,7 +108,7 @@ HIGH_CONFIDENCE_SECRET_PATTERNS = [
|
||||||
(
|
(
|
||||||
[A-Za-z0-9_.-]*
|
[A-Za-z0-9_.-]*
|
||||||
(
|
(
|
||||||
password|passwd|passphrase|pass|pin|pwd|
|
password|passwd|passphrase|
|
||||||
token|auth[_-]?token|access[_-]?token|refresh[_-]?token|
|
token|auth[_-]?token|access[_-]?token|refresh[_-]?token|
|
||||||
secret|client[_-]?secret|secret[_-]?key|
|
secret|client[_-]?secret|secret[_-]?key|
|
||||||
api[_-]?key|access[_-]?key|private[_-]?key|
|
api[_-]?key|access[_-]?key|private[_-]?key|
|
||||||
|
|
@ -116,8 +116,7 @@ HIGH_CONFIDENCE_SECRET_PATTERNS = [
|
||||||
aws[_-]?access[_-]?key[_-]?id|aws[_-]?secret[_-]?access[_-]?key|
|
aws[_-]?access[_-]?key[_-]?id|aws[_-]?secret[_-]?access[_-]?key|
|
||||||
azure[_-]?client[_-]?secret|azure[_-]?tenant[_-]?id|azure[_-]?client[_-]?id|
|
azure[_-]?client[_-]?secret|azure[_-]?tenant[_-]?id|azure[_-]?client[_-]?id|
|
||||||
google[_-]?application[_-]?credentials|gcp[_-]?service[_-]?account|
|
google[_-]?application[_-]?credentials|gcp[_-]?service[_-]?account|
|
||||||
service[_-]?account[_-]?key|
|
service[_-]?account[_-]?key
|
||||||
session_key
|
|
||||||
)
|
)
|
||||||
[A-Za-z0-9_.-]*
|
[A-Za-z0-9_.-]*
|
||||||
)
|
)
|
||||||
|
|
|
||||||
6
tests.sh
6
tests.sh
|
|
@ -2,11 +2,6 @@
|
||||||
|
|
||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
|
|
||||||
# These tests intentionally run as root and exercise Enroll's root-output
|
|
||||||
# safety checks. Keep test-created directories private even on Forgejo/Docker
|
|
||||||
# images that default to a permissive umask such as 0002.
|
|
||||||
umask 077
|
|
||||||
|
|
||||||
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
TMP_PARENT="${TMPDIR:-/tmp}"
|
TMP_PARENT="${TMPDIR:-/tmp}"
|
||||||
KEEP_WORKDIR=0
|
KEEP_WORKDIR=0
|
||||||
|
|
@ -14,7 +9,6 @@ if [[ -n "${ENROLL_TEST_WORKDIR:-}" ]]; then
|
||||||
WORK_DIR="${ENROLL_TEST_WORKDIR}"
|
WORK_DIR="${ENROLL_TEST_WORKDIR}"
|
||||||
KEEP_WORKDIR=1
|
KEEP_WORKDIR=1
|
||||||
mkdir -p "${WORK_DIR}"
|
mkdir -p "${WORK_DIR}"
|
||||||
chmod 700 "${WORK_DIR}" || true
|
|
||||||
else
|
else
|
||||||
WORK_DIR="$(mktemp -d "${TMP_PARENT%/}/enroll-tests.XXXXXX")"
|
WORK_DIR="$(mktemp -d "${TMP_PARENT%/}/enroll-tests.XXXXXX")"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -645,9 +645,7 @@ def test_cli_harvest_remote_sops_encrypts_and_prints_path(
|
||||||
assert calls.get("encrypt")
|
assert calls.get("encrypt")
|
||||||
|
|
||||||
|
|
||||||
def test_cli_harvest_remote_password_required_exits_cleanly(
|
def test_cli_harvest_remote_password_required_exits_cleanly(monkeypatch):
|
||||||
tmp_path: Path, monkeypatch
|
|
||||||
):
|
|
||||||
def boom(**kwargs):
|
def boom(**kwargs):
|
||||||
raise RemoteSudoPasswordRequired("pw required")
|
raise RemoteSudoPasswordRequired("pw required")
|
||||||
|
|
||||||
|
|
@ -662,8 +660,6 @@ def test_cli_harvest_remote_password_required_exits_cleanly(
|
||||||
"example.com",
|
"example.com",
|
||||||
"--remote-user",
|
"--remote-user",
|
||||||
"root",
|
"root",
|
||||||
"--out",
|
|
||||||
str(tmp_path / "remote-harvest"),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
with pytest.raises(SystemExit) as e:
|
with pytest.raises(SystemExit) as e:
|
||||||
|
|
|
||||||
|
|
@ -969,10 +969,6 @@ def test_manifest_fqdn_existing_output_rejects_symlink_component(tmp_path: Path)
|
||||||
_write_state(bundle, state)
|
_write_state(bundle, state)
|
||||||
|
|
||||||
(out / "inventory").mkdir(parents=True)
|
(out / "inventory").mkdir(parents=True)
|
||||||
# The output path itself must be root-safe so this test reaches the
|
|
||||||
# intended nested-symlink guard even when CI/root uses a permissive umask.
|
|
||||||
out.chmod(0o700)
|
|
||||||
(out / "inventory").chmod(0o700)
|
|
||||||
escape.mkdir()
|
escape.mkdir()
|
||||||
(out / "inventory" / "host_vars").symlink_to(escape, target_is_directory=True)
|
(out / "inventory" / "host_vars").symlink_to(escape, target_is_directory=True)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,7 @@ def test_prepare_manifest_output_dir_allows_existing_clean_tree_in_site_mode(
|
||||||
):
|
):
|
||||||
out = tmp_path / "site"
|
out = tmp_path / "site"
|
||||||
out.mkdir()
|
out.mkdir()
|
||||||
# Match Enroll's root-run output safety expectations regardless of the
|
|
||||||
# ambient CI/container umask.
|
|
||||||
out.chmod(0o700)
|
|
||||||
(out / ".git").mkdir()
|
(out / ".git").mkdir()
|
||||||
(out / ".git").chmod(0o700)
|
|
||||||
(out / ".git" / "ignored-link").symlink_to(tmp_path, target_is_directory=True)
|
(out / ".git" / "ignored-link").symlink_to(tmp_path, target_is_directory=True)
|
||||||
|
|
||||||
assert prepare_manifest_output_dir(out, allow_existing=True) == out
|
assert prepare_manifest_output_dir(out, allow_existing=True) == out
|
||||||
|
|
@ -49,9 +45,6 @@ def test_prepare_manifest_output_dir_allows_existing_clean_tree_in_site_mode(
|
||||||
def test_prepare_manifest_output_dir_rejects_existing_tree_symlink(tmp_path: Path):
|
def test_prepare_manifest_output_dir_rejects_existing_tree_symlink(tmp_path: Path):
|
||||||
out = tmp_path / "site"
|
out = tmp_path / "site"
|
||||||
out.mkdir()
|
out.mkdir()
|
||||||
# Keep the root-safety check from masking the specific symlink assertion on
|
|
||||||
# Forgejo/Docker hosts that run with umask 0002.
|
|
||||||
out.chmod(0o700)
|
|
||||||
(out / "bad-link").symlink_to(tmp_path, target_is_directory=True)
|
(out / "bad-link").symlink_to(tmp_path, target_is_directory=True)
|
||||||
|
|
||||||
with pytest.raises(ManifestOutputError, match="contains a symlink"):
|
with pytest.raises(ManifestOutputError, match="contains a symlink"):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue