Join our Newsletter — 33% off our NHI Course
Home› FAQ› Architecture & Implementation› Should security teams prioritise framework hardening or model-level…
Architecture & Implementation

Should security teams prioritise framework hardening or model-level controls first?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated October 8, 2026 Domain: Architecture & Implementation

Framework hardening comes first when the framework is the data path. If the runtime can expose secrets, files, or conversation history before the model even acts, model-only controls will miss the actual leak surface. Teams should secure dependency inventory, file access, serialization, and checkpoint storage before treating prompt safety as the primary issue.

Why framework hardening should come before model-only controls

When the framework is the data path, the real exposure sits below the model layer. If dependency loading, file access, serialization, or checkpoint handling can reveal secrets or conversation history, prompt filters and model policies arrive too late. Security teams should treat the runtime and its surrounding storage and access paths as the first control plane, because that is where the leak is happening.

That ordering matters because model-level controls usually assume the prompt is the main input surface. In practice, many failures occur before the model sees anything: local files are mounted, libraries are loaded, objects are deserialized, caches are read, and stored context is exposed. Hardening those paths reduces the chance that the model ever receives sensitive material in the clear.

The practical implication is that framework hardening is not just infrastructure hygiene. It changes the attack surface by constraining what the runtime can read, write, persist, or replay. If the framework can reach secrets, tokens, files, or prior chat state, the model becomes a secondary control rather than the primary protection boundary.

What to harden first in the runtime and data path

Start with the components that can disclose data before inference begins: dependency inventory, file permissions, serialization routines, cache locations, and checkpoint storage. Those are the places where sensitive material often enters the execution environment, is cached for convenience, or is restored without sufficient validation.

Dependency hardening should focus on knowing exactly what code and libraries are loaded, where they come from, and whether they can reach sensitive paths. File and object access need least privilege so that the runtime can only read the data it truly needs. Serialization and deserialization deserve special attention because they can surface hidden objects, metadata, or embedded references that a prompt-only control would never inspect.

Checkpoint and state storage need the same discipline. If a model or application persists intermediate state, the storage layer must be protected as if it were operational data, because it often contains more than the visible prompt. That includes access control, encryption, retention limits, and separation between environments so one runtime cannot easily recover another runtime's history.

Where model-level controls still matter, and where they do not

Model-level controls still matter for prompt injection, unsafe output handling, and policy enforcement at generation time. They are useful when the problem is how the model interprets instructions or how it emits content. They are not sufficient when the underlying framework already exposed the sensitive asset before the model had a chance to reason about it.

This distinction helps teams avoid false confidence. A model safety layer may stop a harmful response, but it cannot recover data that was already read from disk, pulled from a checkpoint, or leaked through a dependency. The right question is not whether the model can refuse misuse, but whether the runtime can be prevented from seeing the wrong material in the first place.

That is why a layered approach is still necessary. Model controls reduce downstream abuse, but framework hardening reduces upstream exposure. The first is about governing generated behaviour; the second is about shrinking the amount of sensitive data that ever reaches the generation boundary.

What good prioritisation looks like in practice

Prioritisation should follow the leak path, not the publicity value of the control. If a system processes confidential prompts, embeddings, uploaded documents, or stored conversations, teams should first verify who can read those assets, how they are mounted or serialized, and whether the runtime can reach them without explicit need. Once that is stable, model-level controls can refine the remaining behaviour.

Hardening is often the faster risk reduction move because it removes whole categories of exposure. It is usually easier to narrow file access or isolate checkpoints than to rely on a model to behave safely after sensitive context has already been loaded. That does not make model controls optional, but it does make them second-order when the framework sits closest to the data.

For teams operating at scale, the useful benchmark is whether the runtime can be trusted not to discover more than the model should see. If the answer is uncertain, the framework layer is still the priority.

Risk and Threat Considerations

When the framework can touch secrets, files, or prior conversation state, the main risk is silent pre-model exposure. An attacker does not need to defeat the model's safety behaviour if the runtime already reads the sensitive material as part of normal execution. That creates a broader leak surface and makes prompt-centric defenses incomplete.

Failure mechanism: Inadequate isolation, permissive file access, unsafe deserialization, or weak checkpoint handling lets the runtime access data that should have remained out of scope. The model may then process, log, cache, or echo information that was exposed earlier in the execution path.

Impact: Sensitive prompts, secrets, and stored context can be disclosed, replayed, or exfiltrated before model-level safeguards engage. In a production environment, that can turn a single permissive dependency or storage path into a repeated confidentiality failure across many sessions or tenants.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

CIS Controls v8 and NIST SP 800-53 Rev 5 set the technical controls, while ISO/IEC 27001:2022 defines the regulatory obligations.

FrameworkControl / ReferenceRelevance
CIS Controls v8CIS-5 — Account ManagementCovers inventory, access control, and least-privilege hardening around the runtime path.
CIS-7 — Continuous Vulnerability ManagementFits dependency inventory and hardening of framework components that create the leak path.
Recommendation — Apply CIS-5 to restrict runtime and storage access to only the accounts that truly need it. Apply CIS-7 to track and remediate vulnerable framework dependencies quickly.
NIST SP 800-53 Rev 5AC-6 — Least PrivilegeDirectly supports minimizing what the framework can read from files, checkpoints, and stored state.
Recommendation — Enforce AC-6 so the framework process can access only the data paths it must use.
ISO/IEC 27001:2022A.8.24 — Use of cryptographySupports protecting stored prompts, checkpoints, and conversation data at rest.
Recommendation — Use A.8.24 to encrypt sensitive runtime state and checkpoint storage.

Practitioner Guidance

What to prioritise: Treat dependency inventory, storage permissions, and serialization paths as the first review items when the framework can reach sensitive data. If those controls are weak, model safety work should be considered supplementary rather than foundational.

What to verify: Confirm that the runtime cannot read secrets, conversation history, or checkpoint data unless that access is explicitly required. Also verify that persisted state is segregated by environment and that deserialization cannot revive unintended objects or references.

Decision rule: If the leak exists before inference, harden the framework first; if the main issue is unsafe generation or response quality, model-level controls move higher. The ordering changes with the exposure point, not with the tool name.

Practitioner takeaway: The best control is the one that stops sensitive data from entering the model path at all, because once the runtime can see it, model-level guardrails are already playing catch-up.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on October 8, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org