AI · Advanced · 13 min read

What are the compliance risks of sending proprietary code to third-party AI models in financial services?

What a bank exposes when proprietary code reaches a third-party AI model, which regulations apply, and the controls that keep the practice defensible.

Rohit Varshney
Share

Sending proprietary code to third-party AI models creates direct exposure to intellectual property leakage, regulatory non-compliance, and audit failures in financial services. The tension between productivity gains and the need for human-accountable governance becomes acute when semi-autonomous agents interact with codebases that encode business logic and customer data patterns.

Financial services organisations must treat every prompt and context window as a potential transmission of regulated material. Productivity tools that feel harmless in an open-source setting become high-stakes controls when the same paste action carries trade secrets, pricing logic, or patterns derived from customer data. Governed delivery addresses this by placing policy evaluation before any model invocation and by maintaining human accountability for every action an agent proposes. The rest of this guide maps the technical pathway, the regulatory obligations that attach to it, and the governance patterns that keep delivery velocity without surrendering the audit trail.

Why financial services face heightened exposure

Few sectors combine regulatory classification, valuable proprietary logic and opaque vendor supply chains the way financial services does. Regulators already treat AI systems used in credit, fraud detection and customer onboarding as high-risk. The EU AI Act assigns applications to risk categories, with unacceptable-risk systems banned and high-risk systems subject to strict transparency and human-oversight duties. Many bank and insurer workloads fall squarely into that high-risk band because they affect access to financial services or the detection of financial crime.

The code behind those systems is rarely just implementation detail. It encodes business logic, risk models, pricing rules, and customer data patterns that constitute trade secrets and, in many cases, personal data under GDPR or equivalent regimes. A payment-routing module or a screening decision tree is not interchangeable commodity code. Once that material leaves the organisation's boundary, recovery is incomplete even if a contract later claims deletion rights.

Vendor oversight is where the gap opens. Third-party models provide limited visibility into training data provenance, retention windows, and sub-processor chains. Existing vendor-risk frameworks were built for hosted applications and data processors. They rarely address model drift, embedding reuse, or code-extraction attacks that reconstruct algorithms from outputs. The result is a gap: the organisation believes it has performed due diligence, while the actual transmission path remains outside continuous control. When semi-autonomous agents begin planning and executing changes against those codebases, the same gap widens because volume and speed outpace human review that only happens after generation.

How code reaches third-party models and where control is lost

The transmission path is ordinary engineering behaviour, not a sophisticated breach. Developers paste snippets or entire modules into chat interfaces and IDE copilots when they need a refactor, a test harness, or an explanation of legacy logic. Prompts and context windows then carry bounded contexts, domain models, event schemas, and sometimes configuration that reveals infrastructure topology. The developer intends to solve a local problem. The model provider receives a package of organisational knowledge.

Once transmitted, control depends entirely on contract and provider behaviour. The provider may log inputs for abuse monitoring, retain them for a defined period, or use them to improve models unless the agreement explicitly prohibits those uses. Many standard terms are silent or ambiguous on training, embeddings, and version-specific retention. Even enterprise tiers vary by product line, so a team can believe it has a safe plan while a sibling product still trains on prompts.

Semi-autonomous agents compound the issue. An agent that plans a multi-file change will assemble broader context than a human pasting a single function. Without an early gate, the agent selects files, summarises domain rules, and ships that package externally before any policy evaluation runs. Veracode's 2026 GenAI Code Security Report, published in July 2026, cites research showing that AI now authors roughly half of all committed code in organisations that have adopted AI coding tools. At that scale, ungoverned transmission is no longer an edge case. It is a default path unless architecture intervenes before the model is invoked.

Control is lost at the moment the request leaves the organisation's boundary. Post-hoc review of generated code can catch defects. It cannot unsend the prompt. Governance must therefore move upstream to intent: evaluate what the agent or developer is asking to do, strip or redact sensitive context, and only then allow an external call.

Core compliance risks: IP, data, and auditability

Three risk classes dominate when proprietary code meets third-party models. They interact, but each needs its own controls.

Intellectual-property leakage. Model inversion and extraction attacks can reconstruct proprietary algorithms from repeated queries and outputs. Even without a formal attack, routine use teaches the model the shape of internal APIs, naming conventions, and decision logic. Competitors or other tenants are not the only concern. The organisation may later find its own distinctive patterns reflected in generic suggestions served to the wider user base, depending on provider training policy. Trade-secret protection weakens once the material is outside a controlled processing environment.

Data-protection violations. Code frequently contains PII patterns, customer identifiers, account formats, or comments that reference real cases. Under GDPR and equivalent regimes, that material is personal data even when embedded in source. Sending it to a processor without a lawful basis, appropriate clauses, and transfer safeguards creates regulatory exposure separate from IP loss. Redaction after the fact does not cure an unlawful transfer that already occurred.

Audit and explainability failures. Third-party outputs are hard to reproduce. Model versions change, temperature and decoding settings differ, and the provider's internal routing may be opaque. When a generated change influences a credit, fraud, or onboarding path, the organisation must show which policy was in force, who approved the external call, and how the result was verified. Without an auditable trace at intent time, the bank cannot attribute the decision to a controlled process.

Security quality of generated code adds a further operational layer. Veracode's 2026 GenAI Code Security Report recorded that roughly 44 per cent of AI code generation tasks in its tests introduced a risky security vulnerability, with an average security pass rate across models of 56 per cent, barely changed from 55 per cent in its first report. Functional correctness has outpaced security. Treating generation as trusted input therefore fails both compliance and engineering standards. Each risk class requires separate technical and contractual controls rather than a single vendor checkbox.

Regulatory landscape in 2026

Obligations that affect code-handling are no longer abstract. They map directly onto how engineering teams invoke models.

The EU AI Act classifies many financial AI systems as high-risk and imposes transparency and human-oversight duties. When a general-purpose AI (GPAI) model is used inside a high-risk downstream system, deployers in finance must act on the transparency information GPAI providers supply. That includes understanding limitations, intended use, and data-handling characteristics. Pasting proprietary credit or screening logic into an ungoverned chat interface sits poorly against those duties because the organisation cannot show human oversight at the point of externalisation.

NIST AI RMF functions (Govern, Map, Measure, Manage) extend explicitly to vendor systems. Supply-chain visibility is not optional framing. It requires knowing what leaves the boundary, which model version received it, and how drift or sub-processor change is monitored at runtime. One-time procurement questionnaires do not satisfy Measure and Manage once agents operate continuously.

SEC filings and supervisory commentary from financial institutions have increasingly named third-party AI risks, including limited visibility into training data and rising compliance cost as tools proliferate. The practical signal for engineering leaders is clear: boards and regulators expect governed use, not informal adoption.

Adoption has run ahead of control. Compliance Week's 2026 AI compliance survey, run with konaAI across 193 compliance, ethics, risk and audit leaders, found that more than 83 per cent of organisations report using AI tools, yet only about 25 per cent have implemented a strong governance framework. That gap is the compliance story of 2026 for code-handling. Teams already generate and commit large volumes of AI-assisted code while the policy layer that should gate external calls remains thin. Closing the gap means binding model use to the same change-management and evidence standards applied to any other production path.

People also ask how the EU AI Act's four risk categories work in practice. Unacceptable-risk systems are banned. High-risk systems, common in finance, carry the heaviest transparency and oversight load. Limited-risk systems face lighter transparency duties. Minimal-risk systems face few AI-specific rules. Codes of practice for GPAI sit alongside the Act to translate provider duties into operational expectations that deployers must consume and enforce in their own pipelines.

Governance patterns that keep code inside controlled boundaries

Safe use is achievable when the architecture assumes agents will try to move fast and builds gates they cannot route around. Four patterns work together.

Intent-level gates. Every request is evaluated against policy before any model receives proprietary context. The gate classifies intent, checks data-residency and secrecy rules, redacts or refuses sensitive spans, and records the decision with a reviewer identity where risk exceeds threshold. Generation that never sees the secret cannot leak it. This is the decisive control: move the gate from deploy-time review to intent-time enforcement.

Domain-aligned isolation. Event-driven and domain-aligned architectures keep sensitive bounded contexts off the path that external agents travel. Public interfaces expose only what policy allows. Internal aggregates, customer-derived features, and proprietary scoring logic stay behind interfaces that agents call through mediated tools rather than raw repository access. Domain-driven design gives teams the language to draw those boundaries deliberately rather than hoping folder structure is enough.

Human-in-the-loop at enforcement, not after the fact. Review belongs at the policy-enforcement point: approving an elevated intent, releasing a redaction exception, or accepting residual risk. Reviewing thousands of generated lines after the model has already seen the crown jewels is theatre. Humans remain accountable for architecture, constraints, and judgment. Agents remain accountable to the gate.

Continuous verification. Treat AI-generated code as untrusted input. Run the same static analysis, dependency scrutiny, secret scanning, and behavioural tests applied to any other change. Tie merge rights to harness results and to the intent-trace identifier so audit can replay why an external call was allowed.

Applied together, these patterns make auditability and reversibility properties of the delivery pipeline itself rather than paperwork added afterwards: AI participates in the lifecycle while human architects retain responsibility for constraints and evidence. Velocity comes from removing rework and incident cost, not from removing the gate.

Common misconceptions and anti-patterns

Several beliefs delay safe adoption and leave transmission paths open.

Assuming a DPA is enough. A standard data-processing agreement rarely addresses model training, embeddings, prompt logging, or version-specific behaviour. Explicit AI clauses are required for notice of material model changes, audit rights, export and deletion, sub-processor transparency, and a prohibition on training on proprietary inputs where that is the organisation's policy.

Treating model choice as the security decision. Switching to a "more secure" or enterprise-tier model while developers still paste full modules into unmanaged chat leaves the primary leakage path untouched. Model selection matters for contract posture. Prompt and context control matter more for day-to-day exposure.

One-time due diligence. Procurement reviews age quickly. Providers update models, change retention defaults, and add sub-processors. Runtime monitoring of model versions, endpoint inventories, and policy-gate metrics must replace annual paperwork as the living control.

Expecting larger models to be inherently safer. Scale improves fluency. It does not create an audit trail, enforce data minimisation, or verify that generated code meets secure-coding standards. Without verification layers, larger models simply accelerate the production of unverified changes.

Open-ended chat in regulated delivery. Chat interfaces optimised for convenience bypass change management. Governed pipelines with tool mediation, intent gates, and merge policies preserve the useful parts of coding assistance without the uncontrolled egress.

These anti-patterns share a root cause: locating trust in the vendor or the model rather than in the organisation's own enforcement point. Reverse that. Trust the gate you operate, verify everything downstream, and keep contracts aligned with the technical reality of prompts and agents.

Decision framework: allowing external model access

Use the following criteria consistently when deciding whether a workflow may call a third-party model with code-related context. Score each row honestly. If any row lands in "refuse", redesign the workflow before enabling the tool.

CriterionAllow with standard controlsAllow only with elevated controlsRefuse until redesigned
Data sensitivityPublic or fully synthetic examplesInternal business logic with secrets redacted by gateRaw customer data, production secrets, or unredacted regulated datasets
System risk tierDeveloper productivity tooling with no production decision pathSupports delivery for high-risk AI systems but does not itself decide credit, fraud, or onboardingDirectly generates or alters decision logic in high-risk production paths without human sign-off
Contract postureExplicit no-train, limited retention, audit rights, sub-processor noticeEnterprise terms with residual ambiguity mitigated by technical redactionStandard consumer terms silent on training and retention
Runtime evidenceIntent gate, immutable prompt trace, reviewer identity on exceptionsSame as left, plus continuous model-version monitoringNo gate, no trace, or post-hoc review only
VerificationMandatory security testing and policy checks on all AI-assisted diffsAdditional dual review for security-sensitive modulesMerge paths that trust generation without tests

Practical sequence

  1. Classify the bounded context and the downstream AI risk tier before selecting a tool.
  2. Confirm contractual AI clauses match the classification; do not rely on a generic DPA.
  3. Implement the intent gate and redaction rules as code, not as guidance.
  4. Mediate repository and ticket access through tools the gate can observe.
  5. Require verification harnesses and link merges to intent-trace IDs.
  6. Monitor model versions, failure rates, and exception approvals as operational metrics.

If a team cannot complete steps 3 to 5, keep AI assistance inside fully internal or air-gapped tooling until the control plane exists. Productivity deferred is preferable to an unrecoverable transfer.

Frequently Asked Questions

What happens to code sent to a third-party model?

The provider may log, retain, or use the input for training unless the contract explicitly prohibits it. Many standard terms remain silent on this point, so assume retention until proven otherwise in writing.

Does the EU AI Act apply to code sent to general-purpose models?

Yes when the downstream system is high-risk. GPAI providers must supply transparency information that downstream deployers in finance must act upon inside their own governance and oversight processes.

How do I prevent proprietary logic from leaking through prompts?

Route every request through an intent gate that strips or redacts sensitive context before the model is invoked. Keep raw bounded contexts behind mediated tools agents cannot bypass.

Is a standard data-processing agreement sufficient?

No. DPAs rarely address model training, embeddings, or version-specific behaviour. Explicit AI clauses for notice, audit rights, deletion, and export are required.

What evidence satisfies a regulator that code was never sent externally?

Maintain an auditable trace showing every prompt was evaluated by policy before any external call, with the evaluation decision and reviewer recorded alongside model version metadata.

Can we still use AI coding tools safely in regulated environments?

Yes, when the tools run inside governed pipelines that enforce early gates, verification, and human accountability rather than open-ended chat interfaces with unrestricted repository context.

Who is accountable when AI-generated code causes a compliance breach?

The bank is. Model providers' standard terms rarely accept liability for what their output does once it is merged, and regulators look to the regulated entity rather than its tooling vendor. Inside the bank, accountability should trace to the named owner who approved the intent and the reviewer who accepted the change, which is only possible when both are recorded at the time of the decision.

Do self-hosted or on-premises models remove the compliance risk?

They remove the third-party transfer, which addresses most of the IP-leakage and data-transfer exposure described in this guide. They do not remove the need for intent gates, verification and an audit trail. Generated code still enters production paths, and the EU AI Act's human-oversight duties for high-risk systems apply whoever hosts the model.

Further reading

Rohit Varshney

Rohit Varshney

Principal · AI Native Infrastructure and Operations

Principal for AI-native infrastructure and operations at Bugni Labs. GCP-native, event-driven, DevSecOps-hardened platforms with SRE discipline. Multi-year delivery at a UK Tier-1 bank across Cloud CoE, PSD2 and Open Banking, and commercial onboarding.

Was this useful?
Share

The Engineering Notebook

Once a month, a long read on what we're learning building governed AI for regulated enterprises. No hot takes, no roundups.

Prefer to talk it through?