Skip to content
nofeb

Filter prompt injection out of an agent's inbound email

You do not have to turn anything on: nofeb scores every inbound message from 0 to 1 and, at 0.7 or above by default, quarantines it into Junk and keeps its content out of the message.received event. Tune the threshold and action (quarantine, flag or off) per organization, pod or inbox with PUT /v1/intelligence/settings, review GET /v1/quarantine, and release or delete each message. Give the model safe_body, which has everything the scorer found removed.

Checked against the engine on .

What do you need?

  • An inbox receiving mail
  • A key with policy:manage to change settings, and one with send:approve or policy:manage to release mail

Steps

  1. 1. See what a score looks like

    Every message carries injection_score and injection_reasons in its metadata. The safety report adds where each finding was (body, hidden HTML, an attachment, an encoded payload), the sender's trust level with its SPF, DKIM, DMARC and ARC results, and the quarantine state.

    Safety report
    curl https://api.nofeb.com/v1/messages/e3KX9Q/safety -H "Authorization: Bearer $NOFEB_API_KEY"
  2. 2. Set the threshold and action

    Settings inherit from organization to pod to inbox. A support inbox that hears from the public might quarantine at 0.6; an internal inbox might only flag, which records the score and lets the message through.

    Per-inbox settings
    curl -X PUT https://api.nofeb.com/v1/intelligence/settings -H "Authorization: Bearer $NOFEB_ADMIN_KEY" -H 'content-type: application/json' \
      -d '{"scope": "inbox", "inbox_id": "inb_…", "settings": {"injection_threshold": 0.6, "injection_action": "quarantine"}}'
  3. 3. Review the quarantine

    GET /v1/quarantine?inbox_id=… lists held messages newest first, each with its source (injection, hook, rule, sender list, spam, virus or DMARC), the reason, the score, the sender's trust level and a sanitised preview. Subscribe to message.quarantined to hear about each one as it happens.

  4. 4. Release or delete

    Releasing moves the message to the Inbox and emits message.released with the full message summary; allow_sender also adds the sender to the inbox's sender allowlist. Releasing undoes a safety control, so it needs send:approve or policy:manage and an agent's key cannot do it.

    Release, trusting the sender from now on
    curl -X POST https://api.nofeb.com/v1/messages/e3KX9Q/release -H "Authorization: Bearer $APPROVER_KEY" \
      -H 'content-type: application/json' -d '{"allow_sender": true}'
    
    # or discard it
    curl -X DELETE https://api.nofeb.com/v1/quarantine/e3KX9Q -H "Authorization: Bearer $NOFEB_API_KEY"
  5. 5. Feed the model safe_body

    For mail that gets through, read safe_body rather than the raw text. It removes what the scorer looks for (hidden text, zero-width, direction-altering and look-alike characters, role tokens, sentences addressed to an AI, tracking beacons, data-carrying links and encoded payloads), says what it removed, and wraps the rest in a header naming the sender.

  6. 6. Scan text from elsewhere

    Agents read web pages, documents and tool results too. POST /v1/safety/scan scores any text or HTML the way inbound mail is scored and returns it sanitised; the scan_text MCP tool does the same from inside an agent.

The nofeb inbound pipeline Two entry points, nofeb's own MX and provider webhooks authenticated by an inbound token, feed the same pipeline: sender authentication and spam and virus checks at the MX, routing by envelope recipient, the inbound.resolve hook, an injection score, sender trust and typed decisions, then sender lists, the inbound.pre_deliver hook and rules, delivery to the inbox, Junk or quarantine, then a message.received event by webhook or event feed, and access over REST or MCP for the agent. Ways in nofeb MX Any mail server delivers STARTTLS offered Recipient checked at RCPT Provider webhooks Cloudflare Email RoutingPostmark inbound streamMailgun routeSendGrid Inbound ParseAny raw POST /v1/inbound/…/{token} At the door Checks before 250 OK SPF · DKIM · ARC · DMARC Spam and virus scan Refuse, accept, or Junk Pipeline One pipeline Route by envelope recipient Delivered once, even if resent inbound.resolve hook Scored and triaged injection score, sender trust decisions on every message sender lists inbound.pre_deliver hook rules quarantine, reject or file Parsed for the model reply_text · safe_body codes, links, attachments extracted metadata security verdict Inbox Agent inbox Inbox, Junk or quarantine Typed metadata on the thread Raw message kept byte-exact The agent hears message.received webhook, event feed or stream wait_for_email long-poll until it arrives Agent: REST, SDK or MCP
Mail from any sending server reaches nofeb's MX; mail already handled by Cloudflare Email Routing, Postmark, Mailgun or SendGrid is passed on with your inbound token. Both join the same pipeline, where each message is scored for injection, labelled and triaged before your sender lists, hooks and rules decide its fate, and the agent hears about it by webhook, the event feed, the stream, REST or MCP.

What does the score look for?

Hidden HTML (display:none, zero-size, off-screen, white or same-colour text, comments), zero-width, bidirectional and tag characters, look-alike and mixed-script words, instructions aimed at an AI, chat-template and role tokens, text imitating a system prompt, links that carry data out in their query string, markdown image beacons, and encoded payloads. Each finding adds to the score and is named in the reasons, so a reviewer can see why a message was held.

No filter catches every instruction written in plain sight. The score is one layer: the inbox's autonomy tier still decides what the agent may send, and an agent key cannot approve its own send or release its own quarantine.

Frequently asked questions

Is there an email filter for prompt injection?

nofeb scores every inbound message for prompt injection and quarantines it above a threshold you set per inbox, before your agent or your webhooks see its content.

Will a false positive lose mail?

No. Quarantined mail is kept in Junk with its full content until a person releases or deletes it, and releasing with allow_sender stops the same sender being held again in that inbox.

Does scoring send my mail to a third party?

No. Scoring runs inside nofeb on every message. Message content leaves nofeb only if you choose a third-party model for decisions in your settings and give the explicit opt-in that requires, and even then the model sees only the sanitised text.

Status of everything on this page

Every capability named above, with its status as reconciled against the engine.

CapabilityWhat it doesStatus
Injection scoring and quarantine Every inbound message gets a prompt-injection score from 0 to 1 with its reasons: hidden text, invisible and look-alike characters, instructions aimed at an AI, role and chat-template tokens, tracking beacons, data-carrying links and encoded payloads. Above the threshold you set per organization, pod or inbox, the message is quarantined (or only flagged) for a person to release or delete, and its content stays out of the delivery event. Shipped
Sender trust on every message Each inbound message is labelled trusted, known, unknown or suspicious, with the reasons: its authentication results, your sender lists, look-alike domains, display-name spoofing, and whether the inbox has corresponded with the sender before. Shipped
safe_body for untrusted mail The message's new text with zero-width and direction-altering characters, hidden HTML and forgeable quoted history removed, wrapped in a provenance header that tells the model whose words these are. Shipped
Recipient and sender allowlists and blocklists Lists of addresses, domains or wildcards per organization, pod or inbox: who an agent may write to, and whose mail it reads. A blocked recipient is refused on every autonomy tier, a blocked sender's mail is rejected or quarantined, and you choose whether a send outside the allowlist is held for approval or refused. A check call predicts what a send or an inbound message would meet before it happens. Shipped
Human approval of held sends A held send waits with status awaiting_approval until a human approves or rejects it; both steps emit events. The approval queue lists every held send with its recipients (each marked if new to the conversation), the reasons it was held and who submitted it. Approving needs the separate send:approve scope, which keys from agent self-signup never hold, so an agent cannot approve its own send. Shipped
Autonomy tiers enforced by the server Every inbox carries a sending policy, from read-only to autonomous, enforced on the server for every surface that sends, so switching from the API to MCP cannot bypass it. Shipped