specific build playbooksby updated 7 min read

Building a SOC 2 Evidence Collector With Inngest

A SOC 2 type 2 report covers how controls operated over a period, so the evidence has to exist for every month of it. How to collect access reviews and change records as they happen with Inngest, GitHub and locked storage.

An evidence collector runs Inngest functions that save proof of each control as it operates, such as a quarterly snapshot of GitHub access with a reviewer's sign-off and a record of approvals and checks for every merged pull request. A SOC 2 type 2 report covers a period, so the evidence has to cover that period.

The AICPA's SOC 2 guide describes two kinds of examination. A type 1 examination looks at the system description and whether controls were suitably designed as of a point in time. A type 2 examination covers the same ground and adds whether the controls "operated effectively throughout the period of time," along with the service auditor's tests of those controls and the results.

That period is why evidence collection takes so long when it starts at audit time. Proof that a quarterly access review happened in March is hard to rebuild in November. A collector that saves the proof when the control runs leaves you with a dated record for every month of the period.

This build uses Inngest for scheduling and waiting, GitHub as the example system, and locked object storage for the evidence. The same pattern works for your identity provider, cloud accounts and HR system.

Start from your control list

Your controls, and the evidence your auditor agrees will show they operated, decide what to collect. Write one row per control:

ControlEvidenceWhen it's collected
Quarterly access reviewMember list with roles, plus a named reviewer's sign-offEach quarter
Approved code changesWho approved each merged pull request and how its checks endedEvery merge
OffboardingAccount removal in each system, with timestampsEach departure
Vendor reviewEach vendor's current report and your review notesOn your review schedule

Keep the link from each control to the Trust Services Criteria in a config table instead of hard-coding it into functions. On October 28, 2026 the AICPA proposed updated SOC 2 criteria that restructure the current set and add points of focus on AI governance and related risks. Comments are open through January 15, 2027, and if approved the new criteria would apply to engagements beginning on or after December 31, 2027. A config table lets you remap when your auditor moves to the new set.

Why Inngest fits

Three features do most of the work:

  • Cron triggers: a function can run on a schedule, and prefixing the expression with a time zone, such as TZ=America/Chicago, runs it in that zone instead of UTC.
  • step.waitForEvent(): a function can pause until a matching event arrives or a timeout passes, which is how a sign-off fits into the same run that collected the snapshot.
  • Webhook transforms: Inngest gives you webhook URLs and runs a short transform on each delivery, and its docs include a GitHub example that names events from the X-Github-Event header, such as github.pull_request.

The code below uses the v4 TypeScript SDK, where triggers go in the options object passed to createFunction.

The two collectors

import { Inngest, cron } from "inngest";
import { Octokit } from "@octokit/rest";
import { saveEvidence, sendSlackDM } from "./evidence-store"; // your storage and Slack helpers

export const inngest = new Inngest({ id: "evidence-collector" });
const github = new Octokit({ auth: process.env.GITHUB_TOKEN });
const ORG = process.env.GITHUB_ORG!;
const REVIEWER = process.env.ACCESS_REVIEWER_SLACK_ID!;
const ESCALATE_TO = process.env.SECURITY_LEAD_SLACK_ID!;

// Quarterly: snapshot who has access to the GitHub org, then collect a sign-off.
export const githubAccessReview = inngest.createFunction(
    { id: "github-access-review", triggers: [cron("TZ=America/Chicago 0 9 1 1,4,7,10 *")] },
    async ({ step }) => {
        const snapshot = await step.run("list-members", async () => {
            const admins = await github.paginate(github.rest.orgs.listMembers, { org: ORG, role: "admin" });
            const everyone = await github.paginate(github.rest.orgs.listMembers, { org: ORG, role: "all" });
            const adminLogins = new Set(admins.map((m) => m.login));
            return everyone.map((m) => ({ login: m.login, role: adminLogins.has(m.login) ? "admin" : "member" }));
        });

        const reviewId = await step.run("store-snapshot", () =>
            saveEvidence({ kind: "access-review", system: "github", payload: snapshot }),
        );

        await step.run("ask-reviewer", () =>
            sendSlackDM(REVIEWER, `GitHub access review is ready. Review and sign off: https://evidence.example.com/reviews/${reviewId}`),
        );

        const signoff = await step.waitForEvent("wait-for-signoff", {
            event: "evidence/access-review.signed",
            timeout: "7d",
            if: `async.data.reviewId == "${reviewId}"`,
        });

        if (!signoff) {
            await step.run("escalate", () =>
                sendSlackDM(ESCALATE_TO, `GitHub access review ${reviewId} has no sign-off after 7 days.`),
            );
            return { reviewId, signedOff: false };
        }

        await step.run("store-signoff", () =>
            saveEvidence({ kind: "access-review-signoff", system: "github", payload: { reviewId, ...signoff.data } }),
        );
        return { reviewId, signedOff: true };
    },
);

// On every merged pull request: record who approved it and how its checks ended.
export const changeRecord = inngest.createFunction(
    {
        id: "change-record",
        triggers: [{ event: "github.pull_request", if: "event.data.action == 'closed' && event.data.pull_request.merged == true" }],
    },
    async ({ event, step }) => {
        const owner: string = event.data.repository.owner.login;
        const repo: string = event.data.repository.name;
        const pr = event.data.pull_request;

        const reviews = await step.run("list-reviews", async () => {
            const { data } = await github.rest.pulls.listReviews({ owner, repo, pull_number: pr.number });
            return data.map((r) => ({ reviewer: r.user?.login, state: r.state, at: r.submitted_at }));
        });

        const checks = await step.run("list-checks", async () => {
            const { data } = await github.rest.checks.listForRef({ owner, repo, ref: pr.merge_commit_sha });
            return data.check_runs.map((c) => ({ name: c.name, conclusion: c.conclusion }));
        });

        return step.run("store-change", () =>
            saveEvidence({
                kind: "change",
                system: "github",
                payload: { repo: `${owner}/${repo}`, pr: pr.number, author: pr.user.login, mergedAt: pr.merged_at, reviews, checks },
            }),
        );
    },
);

The access review runs at 9:00 Central on the first day of each quarter. It saves the member list, sends the reviewer a link, and waits up to seven days for an evidence/access-review.signed event with the same review ID. Your review page sends that event with inngest.send() when the reviewer approves or flags changes. If nothing arrives, waitForEvent returns null and the function escalates. A missed review shows up the week it's missed, while there's still time to do it.

The change record runs on each github.pull_request event that the transform produces. GitHub's webhook docs say that when a pull request is closed, merged is true if it was merged and false if it was closed with unmerged commits, so the trigger's if expression keeps only real merges. The function then lists the pull request's reviews, which GitHub returns in chronological order, and the check runs on the merge commit.

saveEvidence and sendSlackDM are your own helpers. Inngest's step.run reference says each step has its own retry counter and its state is memoized by the step ID, so a failure in a later step doesn't repeat the GitHub calls that already finished.

Where to keep the evidence

Evidence is more useful to an auditor when nobody could have edited it after the fact. Amazon S3 Object Lock stores objects with a write-once-read-many model and works only in buckets with versioning turned on. In compliance mode, no user, including the account's root user, can overwrite or delete a locked version until its retention date. Governance mode lets users with a special permission change the settings. Set a retention period that covers your audit period and some margin.

Use a fixed path for every file, such as kind/system/period/id.json, and write an index row for each one with the control, the period and the date collected. When the auditor sends a request list, the index answers most of it.

Where Claude helps

The collection itself should be plain code that runs the same way every time. A language model is useful on top of it in two places, with a person checking the result:

  • Explaining an access diff: give Claude this quarter's member list and last quarter's, and ask for a short summary of who was added, who was removed and whose role changed, for the reviewer to confirm against the raw lists.
  • Answering a request list: give Claude the auditor's requests and your evidence index, and ask it to match each request to the files that answer it and list the requests nothing answers. The person preparing the response checks each match before anything goes to the auditor.

How to read a SOC 2 report covers the report from the customer's side, and SOC 2 and AI vendors covers what to keep on file for each AI provider your product uses.

What tends to break

  • Sign-offs that never come: the escalation handles the usual case. Pick a second reviewer for when the first one is away.
  • A collector that hides a missed control: if a review didn't happen, the record should say so. A gap you find in March can be fixed. One the auditor finds becomes an exception in the report.
  • Changes outside pull requests: direct pushes and changes made in a cloud console never reach this function. Branch protection and your cloud provider's audit logs cover those.

What to build first

Start with access reviews and change records. Both run often, both live in systems with good APIs, and both are easy to show an auditor. Add offboarding next, since it touches every system you use, then vendor reviews on whatever schedule your policy sets.

Ask your auditor to look at the first quarter's output before you build more. Their feedback on format is cheaper to apply to two collectors than to ten.

Sources

  1. AICPA & CIMA, SOC 2 guide: Reporting on an Examination of Controls at a Service Organization Relevant to Security, Availability, Processing Integrity, Confidentiality, or Privacy (checked 2026-12-02)
  2. AICPA SOC 2 guide, chapter 1 excerpt, paragraphs 1.05 and 1.24 (type 1 and type 2 examinations, time frame) (checked 2026-12-02)
  3. AICPA news release, AICPA proposes update of SOC 2 Trust Services Criteria (Oct. 28, 2026) (checked 2026-12-02)
  4. Inngest docs, Scheduled functions (cron triggers and TZ prefix) (checked 2026-12-02)
  5. Inngest TypeScript SDK v4 reference, step.waitForEvent() (checked 2026-12-02)
  6. Inngest docs, Webhooks and transform functions (GitHub example) (checked 2026-12-02)
  7. GitHub REST API, List organization members (role filter) (checked 2026-12-02)
  8. GitHub REST API, List reviews for a pull request (checked 2026-12-02)
  9. GitHub docs, Webhook events and payloads: pull_request (closed and merged) (checked 2026-12-02)
  10. Amazon S3 User Guide, Locking objects with Object Lock (checked 2026-12-02)
soc 2inngestcomplianceevidencelong-tail
go deeper

Worked steps, FAQs and resources on this topic.

read the guide
the list

Get the next one.

Field notes from real deployments, written the way this one was. No schedule promised and nothing sold to you. Unsubscribe whenever.

ready to ship?

Let's build yours.

Reading is the easy part. We do the work. Tell us what's broken and we'll tell you straight up whether we can help.

let's talk