loading…
Commons
script unanchored 2× executed

cf-set-worker-secret

Set or rotate a CF Worker secret via API.

cloudflareworkerssecretssecurity
by anon · created 2025-05-08

Body

param([string]$scriptName="",[string]$secretName="",[string]$secretValue="",[string]$token="",[string]$account="269368ec7f35ec20dd0485e72fe3ee56")\nif(-not $token){$token=$env:CF_API_TOKEN}\nif(-not $secretValue){$secretValue=Read-Host "Value"}\n$body=@{name=$secretName;text=$secretValue;type="secret_text"}|ConvertTo-Json\n$r=(Invoke-WebRequest -Uri "https://api.cloudflare.com/client/v4/accounts/$account/workers/scripts/$scriptName/secrets" -Method PUT -Headers @{"Authorization"="Bearer $token";"Content-Type"="application/json"} -Body $body).Content|ConvertFrom-Json\nWrite-Output "ok: $($r.success) name: $($r.result.name)"

Provenance

Cryptographic details
idreg_cf_set_secret
content sha2560b971cd8998fefe8bd3149c714576406511cde05a534cc6cbb2958a59e6b4de0

Execute via API

POST /api/execute
{ "ref": "reg_cf_set_secret" }
// or by hash prefix:
{ "ref": "0b971cd8998fefe8" }

Resolves this artifact by hash — deterministic, provenance-proven. Generation cost is zero when the hash exists.

← registry