Skip to content

Webhooks & Event Catalog ​

Arka emits durable, signed HTTP POST webhooks for artifact publishing, builds and immutable promotion, security scanning, license gates, retention/GC, repository administration, and migration workflows.

Every event is matched and enqueued through PostgreSQL's transactional outbox (async_jobs), deduplicated per (eventId, webhookId), delivered by background workers with retry support, and recorded in webhook_deliveries for inspection and manual replay.


1. Quick Start (arkactl & Console) ​

Manage webhooks in Platform → Webhooks in the Arka Console, via /api/v1/webhooks/*, or with arkactl webhook:

bash
# Inspect the live event catalog directly from your Arka server
arkactl webhook events --json

# Create a scoped webhook for production OCI & npm releases with HMAC + Bearer header
arkactl webhook create \
  --name prod-cd-trigger \
  --url https://cd.example.com/hooks/arka \
  --events asset.published,build.promoted \
  --repo-id "$PROD_REPO_ID" \
  --format oci --format npm \
  --secret "$WEBHOOK_HMAC_SECRET" \
  --header "Authorization=Bearer $CD_API_TOKEN" \
  --json

# Send a signed webhook.ping test delivery and inspect status/latency
arkactl webhook test "$WEBHOOK_ID" --json

# Rotate secret, adjust scope, or toggle enabled without recreating the webhook
arkactl webhook update "$WEBHOOK_ID" --secret "$NEW_HMAC_SECRET" --json
arkactl webhook update "$WEBHOOK_ID" --disable --json

# Inspect delivery attempts and replay a failed delivery
arkactl webhook deliveries "$WEBHOOK_ID" --limit 20 --json
arkactl webhook replay "$DELIVERY_ID" --json

Credential hygiene: Both secret and custom headers are encrypted at rest with Arka's envelope key (ARKA_CREDENTIAL_KEY) and participate in key rotation (arka rotate-credentials). Management APIs return only hasSecret: true and sorted headerNames — never plaintext secret or header values.


2. HTTP Request Headers & Payload Envelope ​

Every webhook delivery sends POST with Content-Type: application/json, User-Agent: Arka-Webhook/1.0, any configured custom headers (reserved headers such as Host, Content-Length, Content-Type, User-Agent, and X-Arka-* cannot be overridden), and canonical Arka headers:

HeaderDescription
X-Arka-EventCanonical event action name (for example build.promoted, asset.published, webhook.ping).
X-Arka-Event-IdStable UUID identifying the logical domain event. Identical across automatic retries and manual replays — use this key for receiver-side idempotency.
X-Arka-Attempt-IdUnique UUID for this specific HTTP delivery attempt.
X-Arka-DeliveryAlias of X-Arka-Attempt-Id for backward compatibility.
X-Arka-Signature-256Present when a signing secret is configured: sha256=<hex(HMAC-SHA256(secret, rawBody))>.

JSON Payload Envelope ​

json
{
  "action": "build.promoted",
  "actor": "ci-bot",
  "resourceType": "build",
  "resourceId": "ba61df5b-1cd6-47ce-bee7-22d375bf7883",
  "outcome": "success",
  "requestId": "req-01j9...",
  "repositoryId": "96ad5f63-d4b4-4c9e-a200-1bcfdfaa18ca",
  "repositoryName": "prod-npm",
  "format": "npm",
  "repositoryIds": [
    "9f42835f-2161-4dde-9dcf-9f5e23077437",
    "96ad5f63-d4b4-4c9e-a200-1bcfdfaa18ca"
  ],
  "formats": ["npm"],
  "detail": {
    "promotionId": "0f0a4b95-6f9f-4c23-8906-31f5f4e615c3",
    "sourceRepositoryId": "9f42835f-2161-4dde-9dcf-9f5e23077437",
    "targetRepositoryId": "96ad5f63-d4b4-4c9e-a200-1bcfdfaa18ca",
    "promotedCount": 2,
    "skippedCount": 0,
    "enforcePolicyGate": true
  },
  "occurredAt": "2026-12-03T01:23:45.678Z"
}

Scope Filtering Semantics (Fail-Closed) ​

  • Events: Each pattern matches * (all events), an exact action (asset.published), or a dot-delimited prefix (asset.*, build.*, migration_job.*).
  • Repository filter (repositoryIds): Empty matches all repositories. When non-empty, Arka delivers only events carrying a matching repositoryId or repositoryIds entry; global events without a repository scope are not delivered.
  • Format filter (formats): Empty matches all formats. When non-empty, Arka delivers only events carrying a matching lowercase format or formats entry.
  • Subscription mutation safety: Queued deliveries and manual replays re-validate the webhook's current enabled state, subscribed events, repository/format scope, and target URL version. Changing a webhook's URL never sends historical events to the new endpoint (rotating secret or headers on the same URL preserves replayability; webhook.ping remains replayable while enabled).

3. Verifying X-Arka-Signature-256 ​

Always compute the HMAC over the exact raw request bytes before JSON parsing and compare in constant time.

Go ​

go
func verifyArkaSignature(secret string, rawBody []byte, header string) bool {
	mac := hmac.New(sha256.New, []byte(secret))
	mac.Write(rawBody)
	expected := "sha256=" + hex.EncodeToString(mac.Sum(nil))
	return hmac.Equal([]byte(expected), []byte(strings.TrimSpace(header)))
}

Node.js (TypeScript / JavaScript) ​

ts
import { createHmac, timingSafeEqual } from 'node:crypto';

export function verifyArkaSignature(secret: string, rawBody: Buffer, header: string): boolean {
  const expected = Buffer.from(
    'sha256=' + createHmac('sha256', secret).update(rawBody).digest('hex'),
    'utf8',
  );
  const actual = Buffer.from(header.trim(), 'utf8');
  return expected.length === actual.length && timingSafeEqual(expected, actual);
}

Python ​

python
import hashlib
import hmac

def verify_arka_signature(secret: str, raw_body: bytes, header: str) -> bool:
    expected = "sha256=" + hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, header.strip())

4. Outbound Network & SSRF Policy ​

By default, Arka enforces strict public-egress SSRF protection on webhook URLs at creation, update, and DNS dial time:

  • Only http:// and https:// URLs with a hostname and no embedded credentials (userinfo) or fragments are accepted.
  • HTTP redirects (3xx) are never followed so receivers cannot bounce deliveries to internal endpoints or capture custom auth headers.
  • All resolved DNS addresses are validated before opening a socket (preventing DNS rebinding), and HTTP_PROXY / HTTPS_PROXY environment proxies are bypassed for webhook egress.
  • Delivery failure diagnostics recorded in webhook_deliveries.error_message use fixed safe classifications (never persisting raw receiver responses or malformed Location headers).

For self-hosted intranet deployments where receivers live on RFC 1918 / ULA private networks (for example internal Jenkins, GitLab, ArgoCD, or ChatOps gateways), set:

bash
ARKA_WEBHOOK_ALLOW_PRIVATE_NETWORKS=true

Even with ARKA_WEBHOOK_ALLOW_PRIVATE_NETWORKS=true, Arka always blocks cloud instance metadata and credential endpoints (169.254.0.0/16, fe80::/10, AWS EC2/EKS fd00:ec2::/32, Alibaba Cloud 100.100.100.200/32), unspecified (0.0.0.0 / ::), multicast, zoned IPv6 addresses, and HTTP redirects.


5. Complete Event Catalog ​

You can fetch this catalog programmatically at runtime via GET /api/v1/webhooks/events or arkactl webhook events --json.

Assets & Properties ​

Event ActionRepo/Format FilterDescription
asset.publishedYesAn asset was published to a Hosted repo or cached by a Proxy repo.
asset.deletedYesAn asset was deleted by path (atomic transactional outbox).
asset.deleteYesAn asset was deleted via catalog/management API.
component.deleteYesA component and its assets were deleted from the catalog.
asset.download.presignYesA download was redirected to a presigned storage URL.
asset.download.quarantinedYesAn asset download was blocked by quarantine policy.
asset.download.license_evaluatedYesA download license compliance policy was evaluated (audit / enforce).
asset.properties.updatedYesCustom asset properties were merged or replaced.
asset.properties.deletedYesA custom asset property key was removed.

Builds & Immutable Promotion ​

Event ActionRepo/Format FilterDescription
build.publishedYesA CI build record and its produced artifact references were recorded.
build.promotedYesA build was promoted across repositories (repositoryIds includes both source and target).

Repositories & Governance ​

Event ActionRepo/Format FilterDescription
repository.createYesA repository was created.
repository.updateYesRepository configuration or write policy was updated.
repository.deleteYesA repository was deleted.
repository.directory.deleteYesA directory prefix of Hosted repository assets was deleted.
repository.reindexYesRepository native metadata indexes were rebuilt.
repository.promoteYesA migration proxy repository was promoted to Hosted.
repository.quota.warningYesA repository crossed its quota warning threshold.
repository.quota.exceededYesA write was rejected with HTTP 507 quota_exceeded.
repository.grant.upsertYesA repository RBAC grant was created or updated.
repository.grant.deleteYesA repository RBAC grant was deleted.
repository.publish.loginYesA package client authenticated to publish.

Security & Maintenance ​

Event ActionRepo/Format FilterDescription
security.scan.completedYesA vulnerability scan completed for an asset.
retention.runYesA repository retention cleanup (or dry-run) completed.
blob_gc.runNoA global physical blob garbage collection pass completed.

Migration & Cutover ​

Event ActionRepo/Format FilterDescription
migration_source.createNoA migration source (Nexus 3, Artifactory, Harbor, or Arka) was created.
migration_source.provisionNoTarget repositories were provisioned from a migration source.
migration_job.startYesA migration import job started.
migration_job.completeYesA migration import job finished.
migration_job.resumeYesA migration job resumed from its saved watermark.
migration.verifyYesSource-vs-Arka parity verification finished.
migration_cutover.syncYesA cutover incremental sync job was queued.
migration_cutover.retryYesA cutover failed-item retry job was queued.

Diagnostics ​

Event ActionRepo/Format FilterDescription
webhook.pingNoSynchronous test delivery triggered via POST /api/v1/webhooks/{id}/test or arkactl webhook test.

Released under the Apache 2.0 License.