A notebook is an interactive document, such as a Jupyter notebook, that mixes executable code, output and text and runs with the permissions of its user or attached identity. Risks include hard-coded credentials, secrets saved in cell outputs and untrusted notebooks executing code. Scan for secrets, clear outputs before sharing and use scoped, short-lived credentials.
What a notebook is in security terms
A notebook is an interactive document that blends code, output, and explanatory text in one place. In security workflows, that convenience matters because the notebook often becomes a working artifact, not just documentation, so it can carry data, commands, and side effects alongside analysis.
That same format makes notebooks useful for exploration, but it also means the content should be treated as executable material. A notebook can look like a report while still containing active code that will run with the permissions of the person opening it or the attached runtime identity.
Why notebooks create security exposure
The main security issue is that notebooks collapse analysis, execution, and sharing into a single file. Credentials can be pasted into cells, secrets can appear in saved outputs, and a notebook imported from an external source can execute code during load or run time. If the notebook is connected to a cloud workspace or AI platform, those effects can extend into broader infrastructure access.
For AI and data teams, notebooks often sit close to sensitive assets such as model training jobs, data stores, and infrastructure APIs. That is why notebook handling should be treated as part of AI Infrastructure Workload Identity Guide thinking: the notebook is not just a file, it is an execution surface that can inherit powerful access.
Common failure modes
Notebook risk usually shows up in a few repeatable ways. Hard-coded credentials remain in cells after testing, rendered output preserves tokens or connection strings, and copied notebooks keep sensitive responses that were never meant for distribution. Untrusted notebooks are especially dangerous because the code may be hidden in cells that are easy to overlook during review.
There is also a trust problem. People often assume a notebook is safe because its prose looks benign, but the execution layer can be separate from what is visually obvious. That gap is what makes notebook sharing, notebook rendering, and notebook execution materially different from sharing a static document.
How organisations should handle notebook safety
Notebook safety is mostly about controlling what can execute, what can be exposed, and what should never be retained. Use secret scanning on notebook files and exported artefacts, strip outputs before sharing, and prefer short-lived scoped credentials over long-lived tokens embedded in analysis environments. Where notebooks are part of AI or data pipelines, align them with the same identity and runtime controls used for the surrounding platform.
For teams that need a broader reference point, AML.T0011 User Execution is a useful reminder that unsafe artefacts and malicious loading behaviour are security problems in their own right, even when the file format appears familiar.
Risk and Threat Considerations
Notebooks create a concentrated risk because they combine human-readable content with executable behaviour and often circulate across teams, tools, and environments. A notebook that contains embedded secrets, hidden code, or preserved outputs can expose data directly and can also provide an attacker with a ready-made execution path if it is opened or run without inspection.
Failure mechanism: The notebook file retains sensitive material or executes unexpected code when it is loaded, rendered, or run, allowing disclosure, credential abuse, or further compromise through the attached runtime.
Impact: The result can be secret leakage, unauthorized access to connected systems, poisoned analysis, or compromise of downstream cloud, data, or AI workloads that trust the notebook environment.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 and MITRE ATT&CK address the attack and risk surface, while NIST SP 800-53 Rev 5 sets the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev 5 | IA-5 — Authenticator Management | Notebook secrets and short-lived credentials depend on credential lifecycle control. |
| AC-6 — Least Privilege | Notebook runtimes should only have the access needed for their analysis tasks. | |
| Recommendation — Manage notebook credentials with IA-5 to rotate, protect, and retire secrets promptly. Apply AC-6 to limit notebook permissions to the minimum required. | ||
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | Notebooks can expose credentials in cells, outputs, and saved artefacts. |
| NHI-07 — Long-Lived Secrets | Notebook workflows are safer when they avoid durable embedded credentials. | |
| Recommendation — Scan notebook files for secret leakage before storage or sharing. Replace long-lived notebook secrets with scoped, short-lived credentials. | ||
| MITRE ATT&CK | T1218 — System Binary Proxy Execution | Untrusted notebooks can execute code through trusted local runtimes and tooling. |
| Recommendation — Inspect notebook execution paths for trusted-process abuse before running unknown files. | ||
Practitioner Guidance
Why practitioners should care: A notebook is both a collaboration artefact and an execution vehicle, so governance has to cover file content, runtime permissions, and sharing behaviour together. If those layers are managed separately, teams tend to miss the most obvious leakage paths.
Practitioner takeaway: Treat notebooks as active workloads, not passive documents, and apply the same discipline you would use for any code that can reach sensitive credentials or production-connected identities.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
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.
Reviewed and updated by the NHIMG editorial team on November 26, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org