Skip to content

Signing and security

Sign inbound requests, and rotate or revoke secrets.

Sign requests

Inbound requests use their own signing scheme. It is different from outbound webhooks, which sign <unix-seconds>.<delivery-id>.<body> and send X-Webhook-* headers. Set three headers on every inbound request.

X-Project-Feed-Secret-Prefix
The lookup prefix shown next to the secret, such as pfin_ followed by 7 characters.
X-Project-Feed-Timestamp
The current Unix time in milliseconds. Requests more than 5 minutes off the server clock are rejected.
X-Project-Feed-Signature
sha256=<hex>, where the hex value is the HMAC-SHA256 of <timestamp>.<raw body> using the secret. The bare hex value without the prefix also works.
JavaScript
import crypto from "node:crypto";

const secret = process.env.PROJECT_FEED_INBOUND_SECRET;
const prefix = process.env.PROJECT_FEED_INBOUND_PREFIX;

const body = JSON.stringify({
  source: "ci",
  externalId: "build-1234",
  projectId: "prj_abc123",
  title: "Investigate flaky build",
  status: "todo",
});

const timestamp = Date.now().toString();
const signature = crypto
  .createHmac("sha256", secret)
  .update(`${timestamp}.${body}`)
  .digest("hex");

await fetch("https://projectfeed.app/api/v1/webhooks/inbound/tasks", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-Project-Feed-Secret-Prefix": prefix,
    "X-Project-Feed-Timestamp": timestamp,
    "X-Project-Feed-Signature": `sha256=${signature}`,
  },
  body,
});

Sign the raw body

Serialize the JSON once, sign that exact string, and send that exact string. A proxy or logger that reformats the body changes the bytes and breaks the signature.

Rotate and revoke secrets

Use one secret for each sender so you can change one without touching the others. In the secret's row menu, Rotate secret creates a new secret with a new lookup prefix and revokes the old one at once. Revoke makes every request signed with the secret fail with 401, and it cannot be undone. Owners and admins can do both.

Image preview
100%