IP Library Granted Patent US 12694096
Granted Patent B2
US 12694096 · App. 18/758,243 · Granted Jul 28, 2026

Auto generate security SDK code injections into custom application for run time LLM protection

Inventors: Krishnan Shankar Narayan (San Jose, CA); Srikumar Narayan Chari (Cupertino, CA)
Assignee: Palo Alto Networks, Inc.
G06F21/54G06F2221/033
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12694096
App. No.
18/758,243
Granted
Jul 28, 2026
Kind
B2
Abstract

The present application discloses a method, system, and computer system for securing code. The method includes (i) obtaining a code sample, (ii) detecting a call flow associated with the code sample, (iii) determining whether to inject a software development kit (SDK) to the code sample based at least in part on the call flow, and (iv) in response to determining to inject the SDK to the code sample: (a) automatically injecting the SDK to the code sample to obtain an SDK-injected code sample, and (b) providing the SDK-injected code sample.

Claims (58)

1 . A system for securing code, comprising:

one or more processors configured to:

obtain a code sample;

detect a call flow associated with the code sample;

determine whether to inject a software development kit (SDK) to the code sample based at least in part on the call flow; and

in response to determining to inject the SDK to the code sample,

automatically inject the SDK to the code sample to obtain an SDK-injected code sample; and

provide the SDK-injected code sample; and

a memory coupled to the one or more processors and configured to provide the one or more processors with instructions.

2 . The system of claim 1 , wherein automatically injecting the SDK to the code sample to obtain an SDK-injected code sample comprises:

querying a large language model (LLM) for the SDK-injected code sample.

3 . The system of claim 2 , wherein querying the LLM for the SDK-injected code sample comprises:

prompting the LLM based at least in part on the code sample and the SDK to be injected.

4 . The system of claim 3 , wherein querying the LLM for the SDK-injected code sample comprises:

generating a prompt to send to the LLM; and

providing the prompt to the LLM.

5 . The system of claim 4 , wherein the prompt comprises the code sample and the SDK to be injected.

6 . The system of claim 4 , wherein the prompt comprises the code sample and an indication of the SDK to be injected.

7 . The system of claim 4 , wherein the prompt comprises the code sample, an indication of the SDK to be injected, and a software language according to which the SDK is to be injected.

8 . The system of claim 2 , wherein the LLM refactors code comprised in the code sample to inject the SDK.

9 . The system of claim 2 , wherein:

the LLM determines whether to translate the SDK to inject the SDK into the code sample; and

in response to determining to translate the SDK, injecting the SDK to the code sample in a manner that configures the SDK according to a native language of the code sample.

10 . The system of claim 1 , wherein the SDK is a lightweight SDK.

11 . The system of claim 1 , wherein the SDK causes the SDK-injected code sample to perform an authentication with a security service, and querying a cloud service to perform a workload associated with the code sample in response to determining the authentication with the security service is successful.

12 . The system of claim 11 , wherein causing the SDK-injected code sample to perform the authentication with the security service comprises causing the SDK-injected code sample to communicate a token to the security service.

13 . The system of claim 1 , wherein the SDK is determined to be injected to the code sample based at least in part on one or more predefined rules.

14 . The system of claim 1 , wherein the SDK is determined to be injected to the code sample based at least in part on a user input.

15 . The system of claim 1 , wherein obtaining the code sample and detecting the call flow associated with the code sample comprises:

obtaining a codebase;

detecting a set of call flows in the codebase; and

identify the code sample based at least in part on a particular call flow of the set of call flows.

16 . The system of claim 1 , wherein determining whether to inject the SDK to the code sample comprises:

obtaining the call flow associated with the code sample;

providing results to a client system associated with a user; and

receiving a user input from the client system, the user input comprises an indication of whether to inject the SDK to the code sample.

17 . The system of claim 1 , wherein providing the SDK-injected code sample comprises storing the SDK-injected code sample in a codebase repository.

18 . The system of claim 1 , wherein providing the SDK-injected code sample comprises:

validating the SDK-injected code sample; and

in response to determining that SDK-injected code sample is validated, storing the SDK-injected code sample in a codebase repository.

19 . The system of claim 1 , wherein the call flow is determined based at least in part on analyzing the code sample based at least in part on an abstract syntax tree (AST).

20 . The system of claim 4 , wherein the prompt further comprises one or more few-shot examples illustrating how to integrate the SDK into code samples, and wherein the LLM generates the SDK-injected code sample based at least in part on the few-shot examples to ensure contextual integration of the SDK with the call flow of the code sample.

21 . The system of claim 1 , wherein determining whether to inject the SDK to the code sample comprises applying one or more heuristics including language support for the code sample and dynamic dependency injection feasibility, and wherein the injection is performed only if the code sample passes the one or more heuristics to enable scalable use of the LLM across a codebase.

22 . The system of claim 18 , wherein validating the SDK-injected code sample comprises performing a static analysis to confirm that the SDK-injected code sample functions as intended without introducing vulnerabilities, and wherein storing the SDK-injected code sample in the codebase repository comprises creating a dedicated branch and initiating a pull request for review.

23 . A method for securing code, comprising:

obtaining a code sample;

detecting a call flow associated with the code sample;

determining whether to inject a software development kit (SDK) to the code sample based at least in part on the call flow; and

in response to determining to inject the SDK to the code sample,

automatically injecting the SDK to the code sample to obtain an SDK-injected code sample; and

providing the SDK-injected code sample.

24 . A computer program product embodied in a non-transitory computer readable medium and comprising computer instructions for:

obtaining a code sample

detecting a call flow associated with the code sample;

determining whether to inject a software development kit (SDK) to the code sample based at least in part on the call flow; and

in response to determining to inject the SDK to the code sample,

automatically injecting the SDK to the code sample to obtain an SDK-injected code sample; and

providing the SDK-injected code sample.