A2A Push Notification Security: Sender Validation and Receiver Hardening
Push notifications make an A2A server an HTTP client of your webhook. The sender validates destinations and outbound requests; the receiver authenticates the source, checks task scope, and handles duplicates. See Streaming and asynchronous operations for configuration and interactions, and Push notification security for security topics. This guide targets A2A v1.0.1. The fault probes require a valid task, credentials, and controlled test endpoints; they have not been tested against live endpoints.
Threat model
| Attack | Entry point | Defended on |
|---|---|---|
| SSRF: probing an internal network through a push URL | CreateTaskPushNotificationConfig.url and redirect targets | Sender (section 1) |
| Forgery: injecting fake task updates | Webhook endpoint | Receiver (section 3) |
| Replay: repeating business actions | Replayed requests and possible retries | Receiver (section 4) |
| Flooding: exhausting queues | Outbound retries and incoming requests | Both (sections 2 and 3) |
1. Sender: destination validation
After registration, validate resolved addresses before every connection. DNS rebinding and redirects can replace a public destination with an internal one. This implementation requires HTTPS, rejects userinfo, restricts ports, and does not follow redirects by default. These are implementation policies.
Receive CreateTaskPushNotificationConfig(url)
-> Validate HTTPS URL, userinfo and allowed ports
-> Resolve DNS; reject unsafe IPv4/IPv6 addresses
-> Persist the approved URL and configuration
At each delivery attempt:
-> Resolve and validate again
-> Connect to a validated address without another DNS lookup
-> Verify TLS for the original hostname
-> Reject redirects; record the reason without credentialsCover loopback, private, link-local, unspecified, and IPv4-mapped IPv6 addresses. Examples include 127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, ::1, fc00::/7, and fe80::/10; this is not a complete address classifier. Use a maintained address classification library and reject nonpublic destinations according to your environment. Add destination allowlists and network egress controls where appropriate. If redirects are necessary, apply the complete validation to every hop and do not forward credentials to a new origin.
2. Sender: messages, authentication, and bounded retries
The pinned a2a.proto
maps HTTP+JSON CreateTaskPushNotificationConfig to POST /tasks/{task_id}/pushNotificationConfigs, optionally prefixed by /{tenant}. The body is a flat TaskPushNotificationConfig, not a nested config. A successful response returns that object directly, including its configuration id, without a JSON-RPC result wrapper. This structural example uses placeholder credentials:
{
"taskId": "test-task-001",
"url": "https://callback.example.com/hook",
"authentication": {"scheme": "Bearer", "credentials": "TEST_CREDENTIAL_PLACEHOLDER"}
}Configuration requests and notifications use Content-Type: application/a2a+json. The credentials authorizing configuration creation belong to the A2A service; authentication.scheme and credentials describe outbound webhook authentication. Keep those roles separate. Notifications go to the configured url; /hook is this receiver’s choice, not a protocol path. Validate the agreed authentication information. The optional configuration token supports agreed notification validation; it is not a generic body key on StreamResponse. Never log credentials, tokens, or authentication headers.
Specification section 4.3.3
defines the body as a StreamResponse containing exactly one of task, message, statusUpdate, or artifactUpdate. For example:
{
"statusUpdate": {
"taskId": "test-task-001",
"contextId": "test-context-001",
"status": {"state": "TASK_STATE_COMPLETED"}
}
}The protocol requires at least one delivery attempt. Section 4.3.3 permits retries and section 13.2 recommends exponential backoff, but neither guarantees receipt. Duplicates may occur; the sender can stop after a configured consecutive-failure limit. Terminal notifications have no eventual-delivery guarantee either. This implementation chooses bounded retries:
Attempt delivery -> 2xx: receipt acknowledged
-> non-2xx / timeout: bounded exponential backoff
-> failure limit reached: stop, alert, reconcile task stateUse the specification’s recommended 10–30 second timeout range; retry counts and backoff caps are implementation settings. Expose alerts and recovery actions when delivery stops, then resume according to policy after fixing the destination or credentials. An authorized GetTask can reconcile task state. Do not assume every notification arrives. Stronger durable-delivery guarantees belong to an implementation contract.
3. Receiver: validation and acknowledgment
- Validate the media type, payload shape, and agreed source authentication. This Bearer example returns 401 for missing or invalid credentials without business effects; other schemes require their own agreed verification.
- Check that the notification concerns an expected task within the receiver’s authorization scope, binding tenant, sender, and task. The current webhook process need not have created the task. Even an authentic sender cannot update an unauthorized task. Read the task identifier from the relevant payload object; do not invent a common top-level
taskId. - Apply capacity limits before acknowledgment and persist or reliably enqueue valid notifications. This implementation returns 2xx only after that succeeds. An already persisted duplicate can be acknowledged.
- Return 429/503 according to policy when congested or unable to persist; do not acknowledge and then discard. The sender might retry or stop, so retain reconciliation and recovery paths.
A 2xx acknowledges successful receipt, not completion of asynchronous business processing. Failed consumers need retry, dead-letter, or manual recovery records.
4. Receiver: notifications, state, and side effects
There is no generic protocol event sequence field. A task ID and state alone cannot identify all duplicates: different messages or artifact updates can share a state.
| Layer | This implementation’s approach | What it does not prove |
|---|---|---|
| Notification record | Persist received notifications; deduplicate by an extension event identifier only when both parties negotiated it | Matching task and state do not establish duplicate payloads |
| State update | Check stored state and legal transitions transactionally; handle late updates and reconcile with GetTask when needed | An unchanged state does not make a message or artifact disposable |
| Business effect | Enforce a durable unique key for a specific action, such as tenant + task + final settlement; use a shared transaction or outbox | A 2xx does not prove settlement happened only once |
If an implementation uses extension event IDs, the sender generates them and keeps an ID stable across retries of the same event. Both parties agree on the extension location, format, scope, and retention. The receiver stores the sender/tenant/task/event ID durably. This is not a standard field. Process artifact chunks and append operations according to their object semantics; do not discard distinct chunks based on task state.
The integration assertions correspond to the pushNotifications: true item in section 3 of Production readiness
. See Task idempotency and recovery
for task recovery patterns.
5. Fault injection and business assertions
Run only in an authorized, isolated test environment. You need an A2A test server with push enabled, an active task that permits configuration creation, valid authorization, a controlled public HTTPS receiver, a controlled private HTTPS target, sender audit/egress records, and receiver business counters or persistence records. Do not probe internal networks or trigger real business callbacks in production.
The script uses Bash, curl, and Python 3. Export all input variables. CAPTURED_BODY is a file path to one valid StreamResponse JSON notification for the same test task, not a JSON string. CALLBACK_BASE excludes the final /hook; this example assumes Bearer authentication there. Credentials are not printed; responses are held briefly in a restricted temporary directory and cleaned up. Input shape checks are not full type or authorization validation. The script creates a test configuration; delete it from the test service afterward.
#!/usr/bin/env bash
set +x
set -euo pipefail
: "${A2A_TEST_ENVIRONMENT:?Set A2A_TEST_ENVIRONMENT to authorized-test}"
[[ "$A2A_TEST_ENVIRONMENT" == authorized-test ]] || exit 1
: "${A2A_BASE_URL:?Set the authorized test agent base URL}"
: "${A2A_VALID_TOKEN:?Set valid task-scoped test credentials}"
: "${TEST_TASK_ID:?Set an active task authorized for this caller}"
: "${CALLBACK_BASE:?Set the controlled HTTPS receiver base URL}"
: "${VALID_CALLBACK_CREDENTIALS:?Set valid Bearer credentials for that receiver}"
: "${PRIVATE_HTTPS_URL:?Set a controlled private HTTPS test target}"
: "${CAPTURED_BODY:?Set the path to a captured test notification JSON file}"
command -v curl >/dev/null
command -v python3 >/dev/null
[[ -r "$CAPTURED_BODY" && -s "$CAPTURED_BODY" ]] || exit 1
export A2A_BASE_URL TEST_TASK_ID CALLBACK_BASE VALID_CALLBACK_CREDENTIALS
export PRIVATE_HTTPS_URL CAPTURED_BODY
python3 - <<'CHECK'
import json, os, re
from urllib.parse import urlsplit
for name in ('A2A_BASE_URL', 'CALLBACK_BASE', 'PRIVATE_HTTPS_URL'):
url = urlsplit(os.environ[name])
if url.scheme != 'https' or not url.hostname or url.username or url.password or url.query or url.fragment:
raise SystemExit('Invalid HTTPS URL input: ' + name)
if not re.fullmatch(r'[A-Za-z0-9_-]+', os.environ['TEST_TASK_ID']):
raise SystemExit('Use a test task ID with URL-safe letters, digits, underscores or hyphens')
with open(os.environ['CAPTURED_BODY']) as stream:
body = json.load(stream)
if not isinstance(body, dict) or sum(key in body for key in ('task', 'message', 'statusUpdate', 'artifactUpdate')) != 1:
raise SystemExit('Expected a StreamResponse with exactly one payload')
CHECK
probe_dir="$(mktemp -d)"
trap 'rm -rf "$probe_dir"' EXIT
trap 'exit 130' INT
trap 'exit 143' TERM
umask 077
# Keep credentials out of command arguments and printed output.
printf 'Authorization: Bearer %s\n' "$A2A_VALID_TOKEN" > "$probe_dir/agent.headers"
printf 'Authorization: Bearer %s\n' "$VALID_CALLBACK_CREDENTIALS" > "$probe_dir/callback.headers"
create_config() {
CONFIG_URL="$1" python3 - <<'BODY' > "$probe_dir/config.json"
import json, os
json.dump({
'taskId': os.environ['TEST_TASK_ID'],
'url': os.environ['CONFIG_URL'],
'authentication': {'scheme': 'Bearer', 'credentials': os.environ['VALID_CALLBACK_CREDENTIALS']}
}, __import__('sys').stdout)
BODY
curl --silent --show-error --connect-timeout 5 --max-time 30 \
--header "@$probe_dir/agent.headers" --header 'Content-Type: application/a2a+json' \
--data-binary "@$probe_dir/config.json" --output "$probe_dir/config-response.json" \
--write-out '%{http_code}' "${A2A_BASE_URL%/}/tasks/$TEST_TASK_ID/pushNotificationConfigs"
}
# Normal control: same task and authorization, a controlled public HTTPS callback.
normal_code="$(create_config "${CALLBACK_BASE%/}/hook")"
[[ "$normal_code" == 2?? ]] || { printf 'Normal control failed: HTTP %s\n' "$normal_code" >&2; exit 1; }
python3 - "$probe_dir/config-response.json" <<'CONTROL'
import json, os, sys
with open(sys.argv[1]) as stream:
config = json.load(stream)
if not (config.get('id') and config.get('taskId') == os.environ['TEST_TASK_ID']
and config.get('url') == os.environ['CALLBACK_BASE'].rstrip('/') + '/hook'):
raise SystemExit('Normal control did not return the expected created config')
CONTROL
printf 'Normal config response checked; verify persisted config and test delivery.\n'
# Use HTTPS in both cases. HTTP rejection alone would not isolate address validation.
private_code="$(create_config "$PRIVATE_HTTPS_URL")"
printf 'Private-target response: HTTP %s; inspect address-policy reason and sender records.\n' "$private_code"
[[ "$private_code" == 4?? && "$private_code" != 401 && "$private_code" != 403 && "$private_code" != 404 ]] || {
printf 'Address-validation result inconclusive; inspect authorization and route first.\n' >&2
exit 1
}
# A 4xx is not a security verdict. Confirm the address-policy rejection, no created
# config, and no outbound connection in the controlled environment before proceeding.
# Record the business-effect counter/state before this pair, then compare afterward.
for attempt in 1 2; do
receipt_code="$(curl --silent --show-error --connect-timeout 5 --max-time 30 \
--header "@$probe_dir/callback.headers" --header 'Content-Type: application/a2a+json' \
--data-binary "@$CAPTURED_BODY" --output /dev/null --write-out '%{http_code}' \
"${CALLBACK_BASE%/}/hook")"
printf 'Replay %s receipt: HTTP %s; business-effect assertion pending.\n' "$attempt" "$receipt_code"
[[ "$receipt_code" == 2?? ]] || exit 1
done
forged_code="$(curl --silent --show-error --connect-timeout 5 --max-time 30 \
--header 'Content-Type: application/a2a+json' --data-binary "@$CAPTURED_BODY" \
--output /dev/null --write-out '%{http_code}' "${CALLBACK_BASE%/}/hook")"
printf 'Unauthenticated receipt: HTTP %s; verify authentication reason and zero business effects.\n' "$forged_code"
[[ "$forged_code" == 401 ]] || exit 1
printf 'HTTP probes finished; security and idempotency assertions require integration evidence.\n'| Scenario | Normal control and required evidence | Interpretation |
|---|---|---|
| Private destination | A public HTTPS configuration succeeds and actually exists with the same task and credentials. Use HTTPS for the private target too. Inspect an explicit address-policy rejection, no created configuration, and no outbound connection | Any 4xx is insufficient. Investigate authorization and routing for 401/403/404; even 400 may be a format error |
| Replay | Record the business counter, state, or transaction before delivery, after the first request, and after its duplicate. The valid first request has the expected effect; the duplicate adds none. If the captured event was already processed, the increment should be zero | Two 2xx responses show receipt only. If effects cannot be observed, leave the assertion pending integration or manual verification |
| Forgery | Reuse the valid task and body while removing credentials. Check the authentication rejection reason and unchanged business records | A 401 alone cannot establish all injection defenses |
Test redirects separately: return a 302 from a controlled public HTTPS endpoint to a controlled private HTTPS target. This implementation does not follow redirects: inspect the sender’s block record and zero visits to the target. An implementation allowing redirects must verify per-hop address checks and credential isolation. Use a successful direct public HTTPS delivery to exclude task, authentication, and TLS setup failures. An HTTP redirect would confound HTTPS policy with address policy.
6. Observability and recovery
The sender records receipt acknowledgment rate, retry latency, stopped deliveries, and address rejection reasons. Receipt acknowledgment is not business completion. The receiver records authentication/authorization failures, duplicate decisions, queue capacity, persistence failures, business-action deduplication, and reconciliation outcomes. Correlate task and configuration identifiers following section 4 of Production readiness , without credentials or production bodies.
Related pages
- Streaming and asynchronous operations : push and other asynchronous interactions
- Push notification security : security topic reference
- Task idempotency and recovery : task state and recovery implementation
- Security implementation : authentication, authorization, and access boundaries
Version and verification notes
Checked against A2A v1.0.1
sections 4.3 and 13.2, its HTTP+JSON binding, and the matching a2a.proto
. The configuration operation is CreateTaskPushNotificationConfig; the pinned proto governs fields. See also the data structures reference
.
The previous claim that scenarios 1, 3, and 4 were verified against an example endpoint has no traceable endpoint record; available historical records support builds and static text checks only. This revision covers pinned-protocol comparison, JSON syntax, and static script checks. Live fault injection, redirect blocking, and business idempotency remain unverified. The table above lists the runtime evidence still needed.