Security
IntentSharp sends your application's data to a model, reads what the model writes back, and can run commands a model planned against a technology you connect. This page says what that exposes, what each check stops, what reaches the model, what you must do and what IntentSharp does not do.
No check makes an application safe by itself: IntentSharp checks what a reply or a command may do, and your permissions, your rule files and your review decide the rest. To report a security problem, see What to report, and how.
What a library like this is exposed to.
| Threat | What IntentSharp does | What it leaves to you |
|---|---|---|
| Instructions hidden in data: text in an input, a document, a target's description or a tool result that the model follows | Every request marks the input, a retry's previous reply and the judge's candidate answer as data, not instructions. That is a signal to the model, not a boundary. The controls are the checks on each reply, your validators, the rule sets at the checkpoints and a target's inspection, and none of them asks a model. | Treat every input, document, description and tool result as untrusted. Keep enforced rules on what a steered reply or command could do. |
| Unchecked output: model text that reaches your code, a target, the memory or the next request | A reply is checked against your type and your validators, then at the Reply checkpoint when rule sets apply. A target runs only a command that passed the Data checkpoint, and a write needs data.allowWrites. A reply the Reply checkpoint refuses is withheld from the result, the attempts, the memory, the next request and the cache. | Read Value only when Success is true. Treat RawOutput and Attempts as unfiltered model text (below). |
| Cost and resource use: a document, a caller or an endpoint that burns time, memory or money | A 5-minute time budget per call, an attempt limit, a model-call limit, an input limit, a 16 MB reply limit, a 4 MB limit on a folder store's documents and on edits, limits on YAML nesting and aliases, and a 250 ms limit on each match of a pattern rule. An edit that raises a time or spend limit, or makes one unlimited, is flagged as widening. | Keep the budgets. A file can remove a limit with unlimited, and a call with no limits and no time budget can run until you cancel it. |
| Key and data disclosure: a key, or data your application holds, that reaches a person or a host it should not | A provider file names each key by reference; a key written into it does not load. IntentSharp never logs a key, the serialized input, a whole request or a whole reply; the body of a provider's error reply, which may echo the input, is logged at Debug only. The built-in providers follow no redirect, send each request to the entry's endpoint, and refuse a key over plain http to a host that is not loopback unless the entry opts in. A change to an entry's endpoint, secret or kind is flagged as widening. Nothing is sent to C2Consultants. | Guard the folder that holds the provider file as you guard the keys. Bound what a file may name with UseSecretResolver, and pin hosts with rules on request.host. |
| Excessive agency: an agent tool or a target that does more than you meant | A tool runs only an intent the Tool checkpoint allows. A target's command is refused when no rule allows its entities and operations, and when its inspection names an operation and no entity, unless the target says the command touches none. | Write InspectAsync to refuse what it cannot read, check TargetExecution.Limits.AllowWrites again in ExecuteAsync, and give the target an account with only the permissions it needs. |
| Hostile files: a file in a watched folder, or a model's edit, built to break the reader or reach outside the folder | No file can load code: a file names a check or a .NET type only when your application registered it by name, and no YAML tag creates a .NET type. Duplicate keys, more than 64 levels, alias blow-ups and literal keys are refused, and so is a document name that would reach outside the store's folder. A version that does not load never replaces the last good one. | Treat write access to a store's folder and its .intentsharp folder as full trust (below). |
| Races: two calls or two processes that turn a refusal into an allow | Every check fails closed when something it needs fails: a source that throws, a rule set that is not loaded, a setting that cannot be read, a subject it does not know. One check reads one version of the rules. The Request checkpoint runs before the cache is read and before each provider of a chain. | The folder store's lock covers one host. Applications on several hosts that share rule files need a store of their own that shares a lock. |
What each checkpoint stops, and what it does not see.
A check fails closed: an operation goes ahead only when each required subject of its checkpoint is covered by an enforced rule and no enforced rule fails. Guardrails has the rule files.
| Checkpoint | Runs | Stops | Does not see |
|---|---|---|---|
request | Before every model call of a call with rule sets: each provider of a chain and the judge, before the cache is read | A call to a provider, a host or a model the rules do not allow, and a call that breaks a rule on its purpose, its intent, its output limit or its input's length | The input's content: only its length |
reply | After a reply passed its checks, before the judge sees it and before it is returned | A reply whose text, value or string values break a rule; the reply is withheld | Property names; text the model wrote with JSON escapes; a reply that failed its checks |
tool | Before an intent runs as an agent tool, and when the tool list is built | An intent or a tag the rules do not allow; such a tool is left out of the list | The agent's argument |
embedding | Before EmbedAsync | An embedding provider the rules do not allow | A memory's own embedding calls |
data | Before a target runs a command, when it is planned and when it runs | Entities and operations no rule allows, and a write unless data.allowWrites is true; a run past data.timeout is stopped | What the target's inspection missed: the inspection is the trust boundary |
environment | When a change is found, and before each target operation while rule sets wait to be brought up to date | Target operations while the rules catch up with a changed target or rule file | Calls that are not target operations |
A call on a client with no rule source, which names no set, runs no checkpoint. The model calls of a judge of your own, and of a provider a memory holds directly, are not checked. Nor are the calls of an IIntentInvoker of your own: its CheckToolAsync decides only which tools are listed, and its RunAsync must apply the same decision itself.
What each call sends, and every control over it.
Only the providers you configure receive requests, and nothing goes to C2Consultants. Each call below goes to the first provider of its role's chain, and to the next one, which may be another vendor's, after a transient error or when a rule or setting refuses the first. A call that names its provider never falls back. What leaves your process has the whole data flow.
| Call | What it sends |
|---|---|
A call of TransformAsync, and every API built on it: values, collections, [AIIntent] methods, intents from files, agent tools | Your system instructions, the intent, the input (an object as JSON), the output requirements, your examples and the schema of the result |
| A retry | The same, with the previous reply, up to 6,000 characters, and its findings: the checks' issues, your validators' messages (for a validator that throws, its exception's message), the rules' messages and the judge's problems. A reply the Reply checkpoint withheld is left out, and only the rules' messages go. |
| A fallback | The same request, to the next provider of the chain |
| The judge | The input and the candidate answer, to the judge role's provider |
| A target's plan | The request, the input and the target's description: its entities, their fields, its instructions and only the properties the target lists. The message of a TargetOperationException that the target's inspection throws goes back to the model on the next attempt. |
| A rule compile, experimental and off until you turn it on | The rule file's intent text and rules, and the target's description, to the maintenance role |
| A mapping compile | The source and target shapes, your declarations and stated text, the input that triggered the compile, your examples and your golden samples |
| A trial, experimental | A sampled call's input, run again under the candidate version |
| An embedding | The text given to EmbedAsync, or the text a memory embeds |
| A specialist request, with IntentSharp.Specialist | To the specialist service you wire in: the intent's definition as the catalog holds it, the context items your context sources return and your requirements, and later the fit verdict. A rule set at the specialist checkpoint can refuse it before anything is sent. Runs on the specialist, probe cases and the AI fit judge are calls like the first row (Models per intent) |
- Project or redact the input before the call, and leave a member out with
[JsonIgnore]. The input limit,MaxInputChars, refuses a larger input; it never cuts one. - Pin where a call may go with enforced rules on
request.provider,request.hostandrequest.model; they apply to every provider of a chain and to the judge. A call that namesAIRequestOptions.Providernever falls back, andFallbackOnTransientErrors = falseturns the fallback off for the client. JudgeModedecides whether the judge sees the input and the answer.- A target's description holds only the properties the target lists, never connection data. Keep secrets out of a
TargetOperationException's message and out of your validators' messages: both reach the model. - Rule compilation runs only on a client that turns it on.
DoNotRecord, orRecordInMemory = false, keeps a call out of the memory;BypassCache, orUseCache = false, keeps it out of the request cache.- Every request of the
openaiandanthropickinds goes through anHttpClientyou can give the client, so a handler of yours can log or refuse it (The HTTP clients). A chat client's own middleware does the same for thechat-clientkind. - An agent tool tells the agent's model an exception's type and a short reason, unless
IntentToolOptions.IncludeErrorDetailis set.
What comes back as the model wrote it.
AIResult.RawOutput, the RawOutput of each record in Attempts and the memory's record of a call hold the model's text as it wrote it. A reply that failed its checks never reaches the Reply checkpoint, so it is kept as it came back, and it goes to the model with the next attempt, marked as data. The one exception is a reply the Reply checkpoint refused: a marker that names the rule takes its place everywhere. Do not show RawOutput or Attempts to end users, and do not write them to logs that people without access to the data can read.
The Reply checkpoint sees a reply in two forms, and each has a blind spot. reply.strings holds the string values and never a property name, so a rule on it does not check the keys of a dictionary or of a JSON result. reply.text is the raw reply, so a pattern on it does not see text written with JSON escapes. Write a content rule on both, and check keys in a validator of your own.
Whoever can write the folder decides what runs.
- A store's folder and its history are full trust. Whoever can write the folder a
FolderDocumentStorereads, or its.intentsharpfolder of history and state, can write a rule file, a settings file or the provider file. The client checks such a file, but it goes to no edit writer of yours, and a version written straight into the history runs at the next start without your validators. Keep write access to both as tight as access to the keys. Keep.intentsharpout of source control and out of backups that people without access to the keys can read: a refused version stays in the history with its text, so a key pasted into the provider file stays there. - The provider file decides where keys go. An entry's endpoint is the address its key and the calls' data go to, its secret names the value sent, and its kind names the code that sends it. A change to any of them is flagged as widening and, like every edit, applies by default. An endpoint with a user name or a key in it does not load. Hold flagged edits with a writer of your own, use
httpsendpoints, and pin hosts with a rule onrequest.host(Provider secrets, Provider file). - Bound what a provider file may name. The default resolver reads any environment variable and, under
AddIntentSharp, any configuration key, so a provider file can name any value the process holds, your license key included. A resolver of your own, set withUseSecretResolver, resolves only the references you allow (Provider secrets). - A stored mapping is trusted as stored. Before a stored mapping runs, IntentSharp checks that it fits its shapes, not that its steps do what the intent says, and it does not run the golden samples again. Whoever can write the mapping store decides what every process maps, and a key's first compile goes to no edit writer. Give a mapping fed by untrusted data golden samples, and limit write access to the store (Compiled mappings).
- The library's own intents are documents. The intent that plans a target's commands and the one that compiles rules written as intent can be replaced in the store by a developer or a model, and an edit of either is never flagged as widening. The library's own checks of a plan and of a compiled rule set stay in code whatever the documents say.
What the developer must do.
- Treat every input, document, target description and tool result as untrusted data.
- Filter the input before the call: the Request checkpoint sees only its length.
- Treat
RawOutput,Attemptsand the memory's records as unfiltered model text. - Write content rules on both
reply.textandreply.strings, and check keys in a validator. - Keep
.intentsharpout of source control, and treat write access to a store's folder as full trust. - Hold edits flagged as widening, the provider file's above all, with a writer of your own.
- Use
httpsendpoints, pin hosts withrequest.host, and bound secret references withUseSecretResolver. - With an
HttpClientof your own, throughWithHttpClientFactoryor a handler on a named client, turn redirects off. - Write an enforced
allowrule onrequest.providerwhen data must not reach a fallback of another vendor. - Keep a time budget. The default is 5 minutes.
- Write
InspectAsyncto refuse what it cannot read, setTouchesNoEntityonly for a command that touches nothing, check writes again inExecuteAsync, and give the target an account with only the permissions it needs, or a read-only connection. - Keep secrets out of
TargetOperationExceptionmessages and validator messages, which reach the model. - Give a mapping fed by untrusted data golden samples, and limit write access to the mapping store.
- Set
JudgeStrictness.FailClosedwhen the judge is a gate rather than a hint.
What IntentSharp does not do.
- It does not learn from earlier calls. No call trains, tunes or calibrates anything, and no model changes through IntentSharp. Each call sends what that call's request holds.
- Memory and trials are records, not training. The memory records completed calls, and IntentSharp never puts a recalled record into a request: to give a later call past results, pass them in its input. A trial runs a candidate version beside the running one and counts how often the two agree; a person decides whether to activate it, and nothing is calibrated.
- A reviewed outcome changes what the model is told, not a model. Feedback your application stores and passes to later calls, or an edit to an intent file after a review, changes the request. A compiled rule or mapping is a document a person can read and revert, not a model that got better.
- It does not promise that an answer is right. A result that passes means its checks passed. The optional judge is one more model's review, not proof, and there is no confidence score.
- It does not see what your target or provider does outside it. It checks the command a target says it will run and the reply a provider returns. The technology's own permissions bound what a command can do.
- It does not review edits for you. It flags an edit that widens what the rules allow and applies it by default. It ships no queue, approval state or user interface: a writer of your own holds what needs a person.
- It does not mask personal data, and holds no security certification. What your application sends is what the model receives.
How the key is handled
The library checks your license key offline, when a client is built, and sends nothing to us. Keep keys out of source control: they are confidential under the license.
What to report, and how
Email licensing@c2consultants.net with "security" in the subject line. The contact is also published in /.well-known/security.txt. Please do not report security problems in public issue trackers or forums.
In scope
- The libraries:
IntentSharp,IntentSharp.Catalog,IntentSharp.Guardrails,IntentSharp.Extensions.AIandIntentSharp.Specialist. - The license service at license.intentsharp.com: the evaluation form, the checkout and the keys it issues.
- This website, intentsharp.com.
What to include
- What you found and where: the package and version, or the address.
- The steps to reproduce it, and what an attacker could do with it.
- How to reach you for follow-up questions.
Please do not
- Make real or test payments, or send card details, to probe the checkout.
- Submit the evaluation form repeatedly or with other people's addresses: every accepted request sends a real email.
- Access, change or delete data that is not yours, or degrade the service for other people, for example with high-volume automated scanning.
We will acknowledge the report, confirm whether we can reproduce it, and tell you when a fix is released. Please give us reasonable time to release a fix before you disclose the problem publicly.
Advisories: every security fix is listed in the changelog, under Security in the release that contains it, with what it fixes.