Repository navigation
Releases
Releases · rasuvaeff/yii3-webhooks
v2.0.2
- Mutation testing now counts uncovered code (
--with-uncovered, template mutator settings): overall MSI 99% againstminMsi98. Added a test for claiming a delivery that has attempts but no recorded attempt time.InMemoryDeliveryStorage::findPending()andWebhookRetryPolicy::fixed()signatures reformatted to one parameter per line, no behaviour change. - Changed: PHP 8.6 is supported: the
phpconstraint is widened to
8.3 - 8.6(#32). CI runs PHP 8.6 as a regular matrix entry; the
backward-compatibility job runs on PHP 8.5. - Changed: dev dependency
rasuvaeff/pinned-http-clientwidened from
^0.1to^1.1(#32): 1.x is the only line whose php range allows 8.6, so
the 8.6 CI job cannot resolve^0.1. The dispatcher test and the
examples/dispatcher.phpwiring are ported to the 1.x API (Resolver
interface instead of a closure;TransferFailedinstead of the removed
PinningFailed), and the SSRF sections ofREADME.md/README.ru.mdname
RequestRefusedinstead ofPinningFailed.
v2.0.1
- Docs and example only, no change to
src/: the SSRF section of the README
(andREADME.ru.md,llms.txt, the skill) now points to
rasuvaeff/pinned-http-clientas the PSR-18 client that resolves and filters
at delivery time, pins the connection and refuses redirects, with a snippet.
examples/dispatcher.phpwires it (no network needed: it shows a delivery to
a private host refused as a failed attempt); the example dispatcher moved to
examples/HttpWebhookDispatcher.phpand records only fixed text in
lastError.composer.json:suggestandrequire-devfor
rasuvaeff/pinned-http-client.
v2.0.0
A major for three breaking changes, none of which
roave/backward-compatibility-check can see: it compares the shape of the PHP
API, and all three are behavioural — the bytes on the wire, the URLs the
constructor accepts, and what save() writes. The green BC report on this
release is correct and says nothing about upgrade safety. Manual steps, the
legacy signer for a dual-accept window and the rollout order are in
UPGRADE.md.
- Breaking (signatures on the wire). The canonical message signed by
HmacSha256Signeris now length-prefixed:
"{strlen(eventId)}.{eventId}.{timestamp}.{strlen(payload)}.{payload}".
.is legal inside an event id, so the previous
"{eventId}.{timestamp}.{payload}"parsed into several different
(eventId, timestamp, payload) triples: an event id such as
order.1755600000produced exactly the bytes an attacker could re-frame as
event idorder, a timestamp of1755600000and a payload of their
choosing — same signature, different message, and a different nonce, so the
replay guard was bypassed too. Signature bytes therefore change, in both
directions: a receiver on 1.x rejects a 2.0 signature and a receiver on 2.0
rejects a 1.x one, so no rollout order avoids a delivery gap. Removing it
takes a window in which the receiver accepts both framings —UPGRADE.md
carries the five-line legacyWebhookSignerand the order (receivers accept
both → sender upgrades → receivers drop the legacy branch). Receivers you do
not control need a coordinated date instead. The replay guard is unaffected:
the nonce is theX-Webhook-Idheader, not the signature. - Breaking (endpoint validation).
WebhookEndpointnow rejects URLs it
used to accept: anything that is not http/https with a real host, URLs
carrying credentials (https://user:pass@host/), and hosts that are
loopback, private, link-local or otherwise reserved IP literals —
127.0.0.1,10.0.0.5,169.254.169.254(cloud metadata),[::1],
localhost. Deliveries that are meant to stay inside the perimeter opt back
in withallowPrivateNetwork: true. Host names are deliberately not
resolved; the README's Security section spells out what the dispatcher still
owes (resolve-and-filter, redirect policy, timeouts). Run your stored
registrations through the constructor before deploying —UPGRADE.mdhas the
loop. - Breaking (endpoint validation, root label). A single trailing dot is the
DNS root label: every resolver readslocalhost.aslocalhost, but the
string comparison did not,inet_pton('localhost.')fails as well, and the
host was classified as an unresolvable name and accepted.https://localhost./hook
therefore passed the whole loopback check thathttps://localhost/hookdid
not, and so didhttps://127.0.0.1./hookandhttps://sub.localhost./hook.
The host is now normalised before every check, which also turnshttps://./hook
— previously accepted as a host name — into the missing host it always was.
The normalisation touches the comparison only: an accepted URL is still stored
exactly as it was passed in, sohttps://partner.example.com./hookis
accepted andgetUrl()returns it verbatim. Reported by CodeRabbit on #23. ClaimingDeliveryStorage: an optional interface extending
WebhookDeliveryStoragefor backends that can hand a delivery to exactly one
worker.claimReady()leases the deliveries that are ready for another
attempt — skipping the ones still waiting out their backoff, so a backlog of
backing-off deliveries no longer starves the ready ones behind it — and
releaseClaim()gives a lease back early. Ownership is a lease, not a
status: a claimed delivery staysPendingand a worker that dies strands
nothing. Workers select the path withinstanceof; existing storages keep
working unchanged.WebhookRetryPolicy::readyThresholds(): the backoff rule as data a storage
backend can push into its own query — attempt count => the latest
lastAttemptAtthat is ready now.WebhookDeliveryStorage::save()no longer writes the status of a delivery
that already exists, in the contract and inInMemoryDeliveryStorage. A
worker that lost the race and still held a stalePendingcopy could
otherwise put a finished delivery back into the queue and deliver the same
webhook again.markDelivered()/markFailed()are the only writers of a
status; a claim writes a lease and leaves the deliveryPending. Storages
implemented outside this package must follow suit — seeUPGRADE.md.InMemoryDeliveryStorage::markDelivered()/markFailed()are a compare-and-set
onPending, matching what the database backend has always written as
UPDATE … WHERE id = ? AND status = 'pending'. The in-memory storage used to
overwrite a terminal status unconditionally, so a worker that lost a race could
turn aFaileddelivery into aDeliveredone — and consumer code debugged
against this storage behaved differently in production. Marking a delivery that
is unknown or already finished is now a silent no-op everywhere.WebhookRetryPolicy::nextDelaySeconds()applies the cap before the int cast.
An exponential policy with a largemaxAttemptsoverflowedPHP_INT_MAX
within a few dozen attempts, and the out-of-range cast (platform-defined,
typicallyPHP_INT_MIN) made the delay negative —isReadyForRetry()then
builtmodify('+-9223372036854775808 seconds')and took the worker down with
aDateMalformedStringException.- Docs: what a retry worker that survives a restart still owes — the payload and
the endpoint secret are deliberately not part of aWebhookDelivery, and both
lookups belong on the batch rather than on each delivery. examples/dispatcher.phpbuilds Guzzle withallow_redirects => falseand
connect/read timeouts, andexamples/claiming_worker.phpshows the two-worker
polling loop.- Docs: the endpoint URL is sensitive and a
WebhookDeliveryis not safe to
log as-is, correcting what README,llms.txt,AGENTS.mdand the agent skill
all said.WebhookEndpointrejects credentials but accepts a query string and
stores the URL verbatim, sohttps://host/hook?token=…puts a receiver's
credential in every delivery row and every log line that echoes one. Redact
query and fragment before logging; the recipe is in the Security section.
Nothing in this package logs a URL — the fix is a corrected claim, not new
API. Reported by CodeRabbit on #23. - Docs: the multi-worker recipe no longer falls back to
findPending(). The
instanceof ClaimingDeliveryStorage ? claimReady() : findPending()shape was
shown under a heading about running several workers, where the fallback branch
hands the same batch to all of them and delivers every webhook once per
worker. README (both languages),llms.txt, the interface docblocks and
examples/claiming_worker.phpnow throw instead, and say that a storage which
cannot claim means one worker. Reported by CodeRabbit on #23. - Docs:
UPGRADE.md, and the signature-format migration it describes, in
README (both languages) and the agent skill's safety rules — a receiver that
cannot verify the new framing is now a stated precondition of upgrading the
sender. Reported by CodeRabbit on #23.
v1.2.1
- Hygiene: anchor the timestamp digit pattern in
WebhookSignature::fromHeaderValue()with\zinstead of$(PCRE$
matches before a trailing\n). Not observable through public API — the
header parser alreadytrim()s each field before the regex runs.
v1.2.0
WebhookEvent::create()accepts an optionalid. The event id travels to
the receiver inX-Webhook-Idand is what they deduplicate on, so a webhook
mirroring a domain event should carry that event's identifier — otherwise a
republish arrives under a new id and the receiver's retry handling is
defeated. Omitted, the id stays 32 random hex characters.WebhookDelivery::create()accepts an optionalidas well, for
applications that generate delivery record ids themselves. Keep it within 32
characters — the column width inrasuvaeff/yii3-webhooks-db.- No id generator interface here, unlike
rasuvaeff/yii3-outbox:
WebhookDispatcheris an interface and the application owns the object that
would hold one. The README shows the wrapper factory for a project-wide id
scheme.
v1.1.0
- Ship an AI agent skill (
resources/skills/rasuvaeff-yii3-webhooks/SKILL.md+
extra.skillsin composer.json): projects using thellm/skillsComposer
plugin get the skill synced into.agents/skills/automatically on install. - Bump
rasuvaeff/property-testingdev dependency to^2.6. - Make property-test generator methods
public static(private ones are
removed by rector'sRemoveUnusedPrivateMethodRector— they are called via
reflection only).
v1.0.2
- Add
/benchmarksand/Makefileto.gitattributesexport-ignore. - Pin
testo/bridge-infectionto0.1.6: 0.1.7/0.1.8 (2026-06-29) misclassify failing tests as passed under mutants, producing false escapes in mutation testing.
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.
v1.0.1
v1.0.0
- Initial release: HMAC-SHA256 webhook signing and verification.
WebhookEvent,WebhookEndpoint,WebhookSignature,HmacSha256Signer.WebhookVerifierwith configurable timestamp tolerance.- Replay protection via
ReplayGuardandNonceStorageinterface. WebhookDelivery,WebhookDeliveryStatusenum,WebhookDeliveryStorageinterface.WebhookRetryPolicywith configurable max attempts and delay.InMemoryDeliveryStorageandInMemoryNonceStoragefor testing.