Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
6820167
fix(#8672): resolve mint URL from config in dispatch workflows
mfrancisc Nov 4, 2026
bddf936
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Nov 5, 2026
e0cce73
fix(#8672): address PR 9104 review on mint URL resolver
mfrancisc Nov 5, 2026
3873835
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Nov 5, 2026
407e355
fix(#8672): gate mint URL resolver and align URL checks
mfrancisc Nov 5, 2026
4f2d23c
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Nov 5, 2026
61ddf39
fix(#8672)!: prefer config mint_url over FULLSEND_MINT_URL
mfrancisc Nov 5, 2026
274b2de
ci(ci-local): pin yq so script-test matches GitHub runners
mfrancisc Nov 6, 2026
c62fa15
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Nov 6, 2026
6e30f6a
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Nov 6, 2026
0471562
test(#8672): cover fail-closed mint URL resolver branches
mfrancisc Nov 6, 2026
b0dd927
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Nov 6, 2026
6db5779
test(#8672): isolate PATH in missing-yq resolver tests
mfrancisc Nov 6, 2026
0336aa4
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Nov 6, 2026
a5731ae
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Nov 9, 2026
23c2d4f
fix(#8672): notice when config mint_url overrides FULLSEND_MINT_URL
mfrancisc Nov 9, 2026
36b3661
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Nov 9, 2026
481761b
fix(#8672): keep vendored script lists in alphabetical order
mfrancisc Nov 9, 2026
59668f9
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Nov 10, 2026
063c582
fix(#8672): resolve mint URL from vendored defaults or workflow pin
mfrancisc Nov 10, 2026
e78f451
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Nov 10, 2026
c07729f
docs(#8672): document dispatch mint_url precedence and migration
mfrancisc Nov 10, 2026
c8cbead
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Nov 11, 2026
1bad343
fix(#8672): strengthen mint resolver wiring tests and docs
mfrancisc Nov 11, 2026
54fbd0d
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Nov 12, 2026
e61f1c6
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Nov 12, 2026
1b17a4e
fix(#8672): omit mint host from config override notice
mfrancisc Nov 12, 2026
56bac31
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Nov 16, 2026
c9791dc
fix(#8672): gofmt vendored script map after main merge
mfrancisc Nov 16, 2026
cd34567
fix(#8672): address matrix event_payload as an object in harness-run
mfrancisc Nov 16, 2026
5276966
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Nov 18, 2026
680fe83
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Nov 19, 2026
4d1cbd9
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Nov 24, 2026
89f1939
fix(#8672): accept loopback mint URLs from config
mfrancisc Nov 25, 2026
b74a75c
chore: merge main into fix/8672-workflow-mint-url-from-config
mfrancisc Nov 26, 2026
6367e32
fix(#8672): resolve review skip tokens from layered mint URL
mfrancisc Nov 26, 2026
3501310
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Dec 2, 2026
59b967a
fix(#8672)!: keep review fallback independent of masked mint URL
mfrancisc Dec 2, 2026
b82877b
Merge branch 'main' into fix/8672-workflow-mint-url-from-config
mfrancisc Dec 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
295 changes: 295 additions & 0 deletions .github/scripts/resolve-effective-mint-url-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,295 @@
#!/usr/bin/env bash
Comment thread
mfrancisc marked this conversation as resolved.
Resolved
Comment thread
mfrancisc marked this conversation as resolved.
Resolved
# resolve-effective-mint-url-test.sh — Tests for resolve-effective-mint-url.sh
#
# Run from the repo root:
# bash .github/scripts/resolve-effective-mint-url-test.sh

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SCRIPT="${SCRIPT_DIR}/resolve-effective-mint-url.sh"
BASH_ABS="$(command -v bash)"
FAILURES=0

if ! command -v yq >/dev/null 2>&1; then
echo "FAIL: yq is required to run resolve-effective-mint-url-test.sh" >&2
exit 1
fi

TMPDIR="$(mktemp -d)"
Comment thread
mfrancisc marked this conversation as resolved.
Resolved
trap 'rm -rf "${TMPDIR}"' EXIT

run_resolve() {
local fallback="${1:-}"
local output_file="${TMPDIR}/github-output.txt"
local stderr_file="${TMPDIR}/resolve-stderr.txt"
local oldpwd="${PWD}"
: >"${output_file}"
: >"${stderr_file}"
Comment thread
mfrancisc marked this conversation as resolved.
Resolved
cd "${TMPDIR}/repo"
GITHUB_OUTPUT="${output_file}" FALLBACK_MINT_URL="${fallback}" "${BASH_ABS}" "${SCRIPT}" 2>"${stderr_file}"
cd "${oldpwd}"
grep '^mint_url=' "${output_file}" | cut -d= -f2-
}

run_resolve_stderr() {
local fallback="${1:-}"
local output_file="${TMPDIR}/github-output.txt"
local stderr_file="${TMPDIR}/resolve-stderr.txt"
local oldpwd="${PWD}"
: >"${output_file}"
: >"${stderr_file}"
cd "${TMPDIR}/repo"
GITHUB_OUTPUT="${output_file}" FALLBACK_MINT_URL="${fallback}" "${BASH_ABS}" "${SCRIPT}" 2>"${stderr_file}"
cd "${oldpwd}"
cat "${stderr_file}"
}

assert_notice_contains() {
local name="$1" want="$2" stderr="$3"
if ! grep -F -- "${want}" <<<"${stderr}" >/dev/null; then
echo "FAIL: ${name}: expected notice containing ${want@Q}, stderr=${stderr@Q}"
Comment thread
mfrancisc marked this conversation as resolved.
Resolved
FAILURES=$((FAILURES + 1))
fi
}

assert_no_notice_override() {
local name="$1" stderr="$2"
if grep -F -- "overrides FULLSEND_MINT_URL" <<<"${stderr}" >/dev/null; then
echo "FAIL: ${name}: unexpected override notice in stderr=${stderr@Q}"
FAILURES=$((FAILURES + 1))
fi
}

run_resolve_expect_fail() {
local fallback="${1:-}"
local name="${2}"
local expected="${3}"
local leak="${4:-}"
local output_file="${TMPDIR}/github-output.txt"
local stderr_file="${TMPDIR}/stderr.txt"
local oldpwd="${PWD}"
local got
local script_path="${RESOLVE_PATH:-${PATH}}"
: >"${output_file}"
: >"${stderr_file}"
cd "${TMPDIR}/repo"
if PATH="${script_path}" GITHUB_OUTPUT="${output_file}" FALLBACK_MINT_URL="${fallback}" "${BASH_ABS}" "${SCRIPT}" 2>"${stderr_file}"; then
cd "${oldpwd}"
echo "FAIL: ${name}: expected non-zero exit"
FAILURES=$((FAILURES + 1))
return 0
Comment thread
mfrancisc marked this conversation as resolved.
Resolved
fi
cd "${oldpwd}"
got="$(cat "${stderr_file}")"
if ! grep -F -- "${expected}" "${stderr_file}" >/dev/null; then
echo "FAIL: ${name}: expected ${expected@Q} in stderr, got ${got@Q}"
FAILURES=$((FAILURES + 1))
fi
if [[ -n "${leak}" ]] && grep -F -- "${leak}" "${stderr_file}" >/dev/null; then
echo "FAIL: ${name}: stderr leaked ${leak@Q}"
FAILURES=$((FAILURES + 1))
fi
}

setup_repo() {
rm -rf "${TMPDIR}/repo"
mkdir -p "${TMPDIR}/repo/.fullsend"
cd "${TMPDIR}/repo"
}

assert_eq() {
local name="$1" want="$2" got="$3"
if [[ "${want}" != "${got}" ]]; then
echo "FAIL: ${name}: want ${want@Q}, got ${got@Q}"
if [[ -s "${TMPDIR}/resolve-stderr.txt" ]]; then
echo "Resolver stderr:"
cat "${TMPDIR}/resolve-stderr.txt"
fi
FAILURES=$((FAILURES + 1))
fi
}

Comment thread
mfrancisc marked this conversation as resolved.
Resolved
setup_repo
if (unset GITHUB_OUTPUT; FALLBACK_MINT_URL="https://fallback.example" "${BASH_ABS}" "${SCRIPT}" 2>"${TMPDIR}/resolve-stderr.txt"); then
echo "FAIL: missing GITHUB_OUTPUT: expected non-zero exit"
FAILURES=$((FAILURES + 1))
else
assert_notice_contains "missing GITHUB_OUTPUT" "GITHUB_OUTPUT is required" "$(cat "${TMPDIR}/resolve-stderr.txt")"
fi

setup_repo
assert_eq "fallback only" "https://fallback.example" "$(run_resolve "https://fallback.example")"

setup_repo
printf 'version: "1"\nmint_url: https://overlay.example\n' >.fullsend/config.yaml
Comment thread
mfrancisc marked this conversation as resolved.
Resolved
assert_eq "overlay wins" "https://overlay.example" "$(run_resolve "https://fallback.example")"
assert_notice_contains "overlay override notice" "mint_url from .fullsend config overrides FULLSEND_MINT_URL" "$(run_resolve_stderr "https://fallback.example")"

setup_repo
printf 'version: "1"\nmint_url: https://same.example\n' >.fullsend/config.yaml
assert_eq "file matches fallback" "https://same.example" "$(run_resolve "https://same.example")"
assert_no_notice_override "no notice when values match" "$(run_resolve_stderr "https://same.example")"

setup_repo
assert_no_notice_override "no notice for fallback only" "$(run_resolve_stderr "https://fallback.example")"

setup_repo
printf 'version: "1"\nmint_url: https://base.example\n' >.fullsend/config.base.yaml
assert_eq "base only" "https://base.example" "$(run_resolve "https://fallback.example")"
assert_notice_contains "base override notice" "mint_url from .fullsend config overrides FULLSEND_MINT_URL" "$(run_resolve_stderr "https://fallback.example")"

setup_repo
printf 'version: "1"\n' >.fullsend/config.yaml
printf 'version: "1"\nmint_url: https://base.example\n' >.fullsend/config.base.yaml
assert_eq "silent overlay uses base" "https://base.example" "$(run_resolve "https://fallback.example")"

setup_repo
printf 'version: "1"\nmint_url: https://overlay.example\n' >.fullsend/config.yaml
printf 'version: "1"\nmint_url: https://base.example\n' >.fullsend/config.base.yaml
assert_eq "overlay beats base" "https://overlay.example" "$(run_resolve "https://fallback.example")"

setup_repo
printf 'version: "1"\nmint_url: null\n' >.fullsend/config.yaml
printf 'version: "1"\nmint_url: https://base.example\n' >.fullsend/config.base.yaml
assert_eq "null overlay uses base" "https://base.example" "$(run_resolve "https://fallback.example")"

setup_repo
printf 'version: "1"\nmint_url: ""\n' >.fullsend/config.yaml
printf 'version: "1"\nmint_url: https://base.example\n' >.fullsend/config.base.yaml
assert_eq "empty overlay uses base" "https://base.example" "$(run_resolve "https://fallback.example")"

setup_repo
printf 'version: "1"\nmint_url: ""\n' >.fullsend/config.base.yaml
assert_eq "empty base uses fallback" "https://fallback.example" "$(run_resolve "https://fallback.example")"

setup_repo
printf 'version: "1"\nmint_url: null\n' >.fullsend/config.yaml
assert_eq "null overlay uses fallback" "https://fallback.example" "$(run_resolve "https://fallback.example")"

setup_repo
printf 'version: "1"\nmint_url: "null"\n' >.fullsend/config.yaml
assert_eq "literal null overlay uses fallback" "https://fallback.example" "$(run_resolve "https://fallback.example")"

setup_repo
assert_eq "empty fallback" "" "$(run_resolve "")"

setup_repo
printf 'version: "1"\nmint_url: http://evil.example\n' >.fullsend/config.yaml
run_resolve_expect_fail "https://fallback.example" "reject non-loopback http from config" "::error::mint_url must be a valid HTTPS URL, or HTTP on localhost/127.0.0.1"
Comment thread
mfrancisc marked this conversation as resolved.
Resolved

setup_repo
printf 'version: "1"\nmint_url: https://user:pass@mint.example\n' >.fullsend/config.yaml
run_resolve_expect_fail "https://fallback.example" "reject userinfo mint_url" "::error::mint_url must not contain userinfo" "user:pass"

setup_repo
printf 'version: "1"\nmint_url: https://mint.example/a@b\n' >.fullsend/config.yaml
assert_eq "at-sign in path is not userinfo" "https://mint.example/a@b" "$(run_resolve "")"

setup_repo
printf 'version: "1"\nmint_url: HTTPS://mint.example\n' >.fullsend/config.yaml
run_resolve_expect_fail "" "reject uppercase scheme (Go parity)" "::error::mint_url must be a valid HTTPS URL"

setup_repo
assert_eq "localhost http fallback" "http://localhost:8080" "$(run_resolve "http://localhost:8080")"

setup_repo
assert_eq "loopback http fallback" "http://127.0.0.1:8080" "$(run_resolve "http://127.0.0.1:8080")"

setup_repo
printf 'version: "1"\nmint_url: http://127.0.0.1:18502\n' >.fullsend/config.yaml
assert_eq "emulator loopback http in overlay and fallback" "http://127.0.0.1:18502" "$(run_resolve "http://127.0.0.1:18502")"

setup_repo
printf 'version: "1"\nmint_url: http://localhost:8080\n' >.fullsend/config.base.yaml
assert_eq "localhost http from base config" "http://localhost:8080" "$(run_resolve "https://fallback.example")"

setup_repo
run_resolve_expect_fail "http://evil.example" "reject non-loopback http fallback" "::error::mint_url must be a valid HTTPS URL, or HTTP on localhost/127.0.0.1"

setup_repo
run_resolve_expect_fail "https://u:p@host" "reject userinfo fallback" "::error::mint_url must not contain userinfo" "u:p"

setup_repo
run_resolve_expect_fail "http://user@127.0.0.1" "Go rejects loopback userinfo" "::error::mint_url must not contain userinfo" "user@"

# Mirror the URL cases in internal/urlutil.TestIsMintURL. The resolver
# deliberately permits an empty value: mint-token reports that separately.
for valid_url in \
"https://mint.example.com" \
"https://mint.example.com/v1/token" \
"http://127.0.0.1:18502" \
"http://localhost"; do
setup_repo
assert_eq "Go accepts ${valid_url}" "${valid_url}" "$(run_resolve "${valid_url}")"
done

for invalid_url in \
"http://10.0.0.1" \
"http://example.com" \
"https://" \
"http:///path" \
"ftp://127.0.0.1" \
"https://mint.example " \
"https://host:abc" \
$'https://mint.example\t/path'; do
setup_repo
run_resolve_expect_fail "${invalid_url}" "Go rejects ${invalid_url}" "::error::mint_url must be a valid HTTPS URL"
done

setup_repo
run_resolve_expect_fail $'https://mint.example\nsmuggled' "reject LF in fallback" "::error::mint_url must not contain CR or LF"
Comment thread
mfrancisc marked this conversation as resolved.
Resolved

setup_repo
run_resolve_expect_fail $'https://mint.example\rsmuggled' "reject CR in fallback" "::error::mint_url must not contain CR or LF"

setup_repo
printf 'mint_url: [unclosed\n' >.fullsend/config.yaml
run_resolve_expect_fail "https://fallback.example" "reject unparsable overlay" "::error::failed to read mint_url from .fullsend/config.yaml"

setup_repo
printf 'version: "1"\n' >.fullsend/config.yaml
printf 'mint_url: [unclosed\n' >.fullsend/config.base.yaml
run_resolve_expect_fail "https://fallback.example" "reject unparsable base under silent overlay" "::error::failed to read mint_url from .fullsend/config.base.yaml"

# Isolate PATH so yq is missing without dropping bash/tr from system
# directories that also contain yq (for example /usr/bin on merged-/usr).
noyq_bin="${TMPDIR}/noyq-bin"
mkdir -p "${noyq_bin}"
for _cmd in bash tr grep cut cat; do
_src="$(command -v "${_cmd}")"
if [[ -z "${_src}" || ! -x "${_src}" ]]; then
echo "FAIL: required tool ${_cmd} not found on PATH"
exit 1
fi
ln -s "${_src}" "${noyq_bin}/${_cmd}"
done
if PATH="${noyq_bin}" command -v yq >/dev/null 2>&1; then
echo "FAIL: isolated PATH still finds yq"
exit 1
fi

run_resolve_without_yq() {
local fallback="${1:-}"
local output_file="${TMPDIR}/github-output.txt"
local oldpwd="${PWD}"
: >"${output_file}"
cd "${TMPDIR}/repo"
PATH="${noyq_bin}" GITHUB_OUTPUT="${output_file}" FALLBACK_MINT_URL="${fallback}" "${BASH_ABS}" "${SCRIPT}"
cd "${oldpwd}"
grep '^mint_url=' "${output_file}" | cut -d= -f2-
}

setup_repo
assert_eq "no yq without config files" "https://fallback.example" "$(run_resolve_without_yq "https://fallback.example")"

setup_repo
printf 'version: "1"\nmint_url: https://overlay.example\n' >.fullsend/config.yaml
RESOLVE_PATH="${noyq_bin}" run_resolve_expect_fail "https://fallback.example" "yq required when config files exist" "::error::yq is required to resolve mint_url from config"
Comment thread
mfrancisc marked this conversation as resolved.
Resolved

if [[ "${FAILURES}" -eq 0 ]]; then
echo "All tests passed."
else
echo "${FAILURES} test(s) failed."
exit 1
fi
Loading
Loading