Skip to content

Business operating system for Claude Code — 57 skills, 21 agents, smart daemon. Unified inbox (WhatsApp/Email/Slack/Telegram), autonomous PR merge, full-AWS monitoring, revenue (Stripe+RevenueCat), e-commerce (Shopify), marketing (Klaviyo/Meta/GA4), voice (Bland/ElevenLabs), APM (Datadog/NewRelic/OTEL), YOLO mode.

fix(ops-package): address review — security, null safety, cleanup temp files

auroracapital9bb270d62192
diff --git a/claude-ops/skills/ops-package/lib/carriers/dhl.sh b/claude-ops/skills/ops-package/lib/carriers/dhl.sh
index f8e1937b..90bc24f2 100755
--- a/claude-ops/skills/ops-package/lib/carriers/dhl.sh
+++ b/claude-ops/skills/ops-package/lib/carriers/dhl.sh
@@ -10,7 +10,7 @@ set -euo pipefail
DHL_BASE_URL="https://api-gw.dhlparcel.nl"
-_dhl_token_cache="${TMPDIR:-/tmp}/dhl_parcel_nl_token.json"
+_dhl_token_cache="${TMPDIR:-/tmp}/dhl_parcel_nl_token_${USER:-$(id -u)}.json"
dhl_auth_header() {
local uid key
@@ -46,8 +46,8 @@ dhl_auth_header() {
return 1
fi
# DHL tokens last ~10 minutes; cache for 9.
- jq -n --arg t "$token" --arg e "$((now + 540))" \
- '{token:$t, expires_at: ($e|tonumber)}' > "$_dhl_token_cache"
+ (umask 077; jq -n --arg t "$token" --arg e "$((now + 540))" \
+ '{token:$t, expires_at: ($e|tonumber)}' > "$_dhl_token_cache")
printf 'Authorization: Bearer %s' "$token"
}
diff --git a/claude-ops/skills/ops-package/lib/carriers/dpd.sh b/claude-ops/skills/ops-package/lib/carriers/dpd.sh
index 6d907599..6e25cd01 100755
--- a/claude-ops/skills/ops-package/lib/carriers/dpd.sh
+++ b/claude-ops/skills/ops-package/lib/carriers/dpd.sh
@@ -11,7 +11,7 @@ set -euo pipefail
DPD_DEFAULT_BASE_URL="https://public-dis-ws.dpd.nl/shipping/rest"
-_dpd_token_cache="${TMPDIR:-/tmp}/dpd_token.json"
+_dpd_token_cache="${TMPDIR:-/tmp}/dpd_token_${USER:-$(id -u)}.json"
_dpd_base_url() {
local override
@@ -55,8 +55,8 @@ dpd_auth_header() {
return 1
fi
# DPD tokens last ~24h; cache for 23.
- jq -n --arg t "$token" --arg e "$((now + 82800))" \
- '{token:$t, expires_at: ($e|tonumber)}' > "$_dpd_token_cache"
+ (umask 077; jq -n --arg t "$token" --arg e "$((now + 82800))" \
+ '{token:$t, expires_at: ($e|tonumber)}' > "$_dpd_token_cache")
printf 'Authorization: %s' "$token"
}
diff --git a/claude-ops/skills/ops-package/lib/carriers/fedex.sh b/claude-ops/skills/ops-package/lib/carriers/fedex.sh
index 63baf1a9..017390f4 100755
--- a/claude-ops/skills/ops-package/lib/carriers/fedex.sh
+++ b/claude-ops/skills/ops-package/lib/carriers/fedex.sh
@@ -10,7 +10,7 @@ set -euo pipefail
FEDEX_BASE_URL_PROD="https://apis.fedex.com"
FEDEX_BASE_URL_SANDBOX="https://apis-sandbox.fedex.com"
-_fedex_token_cache="${TMPDIR:-/tmp}/fedex_token.json"
+_fedex_token_cache="${TMPDIR:-/tmp}/fedex_token_${USER:-$(id -u)}.json"
_fedex_base_url() {
if [ "${FEDEX_SANDBOX:-0}" = "1" ]; then
@@ -56,8 +56,8 @@ fedex_auth_header() {
printf '%s\n' "$resp" >&2
return 1
fi
- jq -n --arg t "$token" --arg e "$((now + ttl - 60))" \
- '{token:$t, expires_at: ($e|tonumber)}' > "$_fedex_token_cache"
+ (umask 077; jq -n --arg t "$token" --arg e "$((now + ttl - 60))" \
+ '{token:$t, expires_at: ($e|tonumber)}' > "$_fedex_token_cache")
printf 'Authorization: Bearer %s' "$token"
}
diff --git a/claude-ops/skills/ops-package/lib/carriers/myparcel.sh b/claude-ops/skills/ops-package/lib/carriers/myparcel.sh
index 0ded0273..2d9b4f31 100755
--- a/claude-ops/skills/ops-package/lib/carriers/myparcel.sh
+++ b/claude-ops/skills/ops-package/lib/carriers/myparcel.sh
@@ -38,15 +38,28 @@ myparcel_ship() {
} | with_entries(select(.value != null))')
fi
+ # For NL insured shipments MyParcel requires signature + only_recipient.
+ local _sig_val="$SIGNATURE"
+ local _only_recip="false"
+ if [ "$INSURANCE" -gt 0 ] 2>/dev/null; then
+ local _to_cc; _to_cc=$(printf '%s' "$TO_JSON" | jq -r '.cc // "NL"')
+ if [ "$_to_cc" = "NL" ]; then
+ _sig_val="true"
+ _only_recip="true"
+ fi
+ fi
+
local options
options=$(jq -n \
--argjson pkg "$PKG_TYPE" \
- --argjson sig "$(printf '%s' "$SIGNATURE" | sed 's/true/1/;s/false/0/')" \
+ --arg sig "$_sig_val" \
+ --arg only "$_only_recip" \
--argjson ins "$INSURANCE" \
--arg desc "$DESCRIPTION" \
'{
package_type: $pkg,
- signature: $sig,
+ signature: ($sig == "true"),
+ only_recipient: (if $only == "true" then true else null end),
label_description: (if $desc == "" then null else $desc end),
insurance: (if $ins > 0 then {amount: ($ins * 100), currency: "EUR"} else null end)
} | with_entries(select(.value != null))')
@@ -107,6 +120,7 @@ myparcel_label() {
local tmp_body tmp_headers
tmp_body=$(mktemp); tmp_headers=$(mktemp)
+ trap 'rm -f "$tmp_body" "$tmp_headers"' EXIT
curl -sS -D "$tmp_headers" -o "$tmp_body" \
-H "$auth" -H "$UA_HEADER" -H "Accept: application/pdf" \
"$MYPARCEL_BASE_URL/shipment_labels/${id}?format=A4&positions=1"
@@ -157,11 +171,11 @@ myparcel_list() {
local auth; auth=$(myparcel_auth_header)
curl -sS -H "$auth" -H "$UA_HEADER" \
-H "Accept: application/json;charset=utf-8" \
- "$MYPARCEL_BASE_URL/shipments?size=10&page=1" \
+ "$MYPARCEL_BASE_URL/shipments?size=30&page=1" \
| jq '[.data.shipments[] | {
carrier: "myparcel",
id, status, barcode,
- recipient: (.recipient.person + " — " + .recipient.city + " (" + .recipient.cc + ")"),
+ recipient: ((.recipient.person // "") + " — " + (.recipient.city // "") + " (" + (.recipient.cc // "") + ")"),
created
}]'
}
diff --git a/claude-ops/skills/ops-package/lib/carriers/ups.sh b/claude-ops/skills/ops-package/lib/carriers/ups.sh
index 8425d331..3e6fed1f 100755
--- a/claude-ops/skills/ops-package/lib/carriers/ups.sh
+++ b/claude-ops/skills/ops-package/lib/carriers/ups.sh
@@ -11,7 +11,7 @@ set -euo pipefail
UPS_BASE_URL="https://onlinetools.ups.com"
-_ups_token_cache="${TMPDIR:-/tmp}/ups_token.json"
+_ups_token_cache="${TMPDIR:-/tmp}/ups_token_${USER:-$(id -u)}.json"
ups_auth_header() {
local cid secret
@@ -48,8 +48,8 @@ ups_auth_header() {
printf '%s\n' "$resp" >&2
return 1
fi
- jq -n --arg t "$token" --arg e "$((now + ttl - 60))" \
- '{token:$t, expires_at: ($e|tonumber)}' > "$_ups_token_cache"
+ (umask 077; jq -n --arg t "$token" --arg e "$((now + ttl - 60))" \
+ '{token:$t, expires_at: ($e|tonumber)}' > "$_ups_token_cache")
printf 'Authorization: Bearer %s' "$token"
}
diff --git a/claude-ops/skills/ops-package/lib/common.sh b/claude-ops/skills/ops-package/lib/common.sh
index d4965f22..51120d60 100755
--- a/claude-ops/skills/ops-package/lib/common.sh
+++ b/claude-ops/skills/ops-package/lib/common.sh
@@ -22,7 +22,7 @@ resolve_env() {
printf '%s' "$v"; return 0
fi
if [ -f "$PREFS_PATH" ] && command -v jq &>/dev/null; then
- v=$(jq -r --arg k "$prefs_key" '.[$k] // empty' "$PREFS_PATH" 2>/dev/null || true)
+ v=$(jq -r --arg k "$prefs_key" '.[$k] // .user_config[$k] // empty' "$PREFS_PATH" 2>/dev/null || true)
if [ -n "$v" ] && [ "$v" != "null" ]; then
printf '%s' "$v"; return 0
fi
@@ -134,13 +134,13 @@ parse_ship_flags() {
SIGNATURE="false"; INSURANCE="0"; DESCRIPTION=""; PICKUP="false"
while [ $# -gt 0 ]; do
case "$1" in
- --to) TO_RAW="$2"; shift 2 ;;
- --from) FROM_RAW="$2"; shift 2 ;;
- --weight) WEIGHT="$2"; shift 2 ;;
- --package-type) PKG_TYPE="$2"; shift 2 ;;
+ --to) TO_RAW="${2:-}"; shift 2 ;;
+ --from) FROM_RAW="${2:-}"; shift 2 ;;
+ --weight) WEIGHT="${2:-}"; shift 2 ;;
+ --package-type) PKG_TYPE="${2:-1}"; shift 2 ;;
--signature) SIGNATURE="true"; shift ;;
- --insurance) INSURANCE="$2"; shift 2 ;;
- --description) DESCRIPTION="$2"; shift 2 ;;
+ --insurance) INSURANCE="${2:-0}"; shift 2 ;;
+ --description) DESCRIPTION="${2:-}"; shift 2 ;;
--pickup) PICKUP="true"; shift ;;
*) echo "ship: unknown flag: $1" >&2; return 64 ;;
esac
diff --git a/claude-ops/skills/ops-package/ops-package.sh b/claude-ops/skills/ops-package/ops-package.sh
index 22827c8a..f7508a14 100755
--- a/claude-ops/skills/ops-package/ops-package.sh
+++ b/claude-ops/skills/ops-package/ops-package.sh
@@ -55,29 +55,9 @@ Credential resolution (per-carrier env var → preferences.json key → Doppler)
EOF
}
-# list_configured_carriers — emits only carriers whose credentials resolve.
-list_configured_carriers() {
- local out=()
- for c in "${CARRIERS[@]}"; do
- if "${c}_configured"; then
- out+=("$c")
- fi
- done
- printf '%s\n' "${out[@]:-}"
-}
-
-# resolve_carrier [--carrier name] ...
# Sets $CARRIER to the selected carrier name. Exits with a helpful error when
# no carrier is configured.
CARRIER=""
-consume_carrier_flag() {
- if [ "${1:-}" = "--carrier" ]; then
- CARRIER="${2:-}"
- FLAG_ARGS_CONSUMED=2
- else
- FLAG_ARGS_CONSUMED=0
- fi
-}
pick_carrier() {
if [ -n "$CARRIER" ]; then