Compare commits
1 commit
dbabc262d9
...
318910265e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
318910265e |
1 changed files with 0 additions and 27 deletions
27
lib/env.sh
27
lib/env.sh
|
|
@ -232,33 +232,6 @@ forge_api_all() {
|
||||||
printf '%s' "$all_items"
|
printf '%s' "$all_items"
|
||||||
}
|
}
|
||||||
|
|
||||||
# =============================================================================
|
|
||||||
# DIRECT CURL API CALLS WITH URL VALIDATION
|
|
||||||
# =============================================================================
|
|
||||||
# These helpers provide a consistent way to make authenticated API calls
|
|
||||||
# with URL validation to prevent injection attacks.
|
|
||||||
# =============================================================================
|
|
||||||
|
|
||||||
# forge_api_call - Direct curl call with URL validation
|
|
||||||
# Usage: forge_api_call "GET /issues" [extra_args...]
|
|
||||||
forge_api_call() {
|
|
||||||
local url="$1"
|
|
||||||
shift
|
|
||||||
|
|
||||||
# Validate FORGE_API to prevent URL injection
|
|
||||||
if ! validate_url "$FORGE_API"; then
|
|
||||||
echo "ERROR: FORGE_API validation failed - possible URL injection attempt" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
curl -sf -X "${url%% *}" \
|
|
||||||
-H "Authorization: token ${FORGE_TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
"${FORGE_API}${url#* }" "$@"
|
|
||||||
}
|
|
||||||
# Backwards-compat alias
|
|
||||||
codeberg_api_all() { forge_api_all "$@"; }
|
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# WOODPECKER API HELPER
|
# WOODPECKER API HELPER
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue