IP Library › Granted Patent US 12,045,609
Granted Patent B1
US 12,045,609 · App. 17/850,583 · Granted Jul 23, 2024

Rule creation for code analysis

Inventors: Neela Sawant (Bangalore, IN); Pranav Garg (Secaucus, NJ)
Assignee: Amazon Technologies, Inc.
G06F8/75G06F8/71G06F40/20
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 12,045,609
App. No.
17/850,583
Granted
Jul 23, 2024
Kind
B1
Abstract

Techniques for generating custom rules are described. For example, a system to receive at least one request to create rules based on a policy and code repository files stored by the storage service; analyze the policy to generate a collection of rule candidates; analyze the code repository files to identify labeled code examples that either conform or do not conform to the rule candidates; receive a selection of the labeled code examples; and synthesize at least one rule that includes a precondition that specifies applicability to the selected labeled code examples and a postcondition that expresses a check to be performed contingent on the precondition being satisfied is at least described.

Claims (50)

1. A computer-implemented method comprising:

receiving at least one request to create rules based on a policy and code repository documents;

analyzing the policy to generate a collection of rule candidates in a natural language form;

analyzing the code repository documents to identify labeled code examples that either conform or do not conform to the rule candidates;

receiving a selection of the labeled code examples;

synthesizing at least one rule that includes a precondition that specifies applicability to the selected labeled code examples and a postcondition that expresses a check to be performed contingent on the precondition being satisfied; and

receiving an edit to the at least one rule via a visual query language modification to a graph representing the rule.

2. The computer-implemented method of claim 1 , wherein the request includes one or more of an indication of a location one or more policy documents; an indication of a location a code repository; one or more policy documents; an indication of how to provide generated rules; or an indication of a type of user able to generate rules.

3. The computer-implemented method of claim 1 , further comprising:

receiving labeled code examples to be used the synthesizing of at least one rule.

4. A computer-implemented method comprising:

receiving at least one request to create rules based on a policy and code repository files;

analyzing the policy to generate a collection of rule candidates;

analyzing the code repository files to identify labeled code examples that either conform or do not conform to the rule candidates;

receiving a selection of the labeled code examples; and

synthesizing at least one rule that includes a precondition that specifies applicability to the selected labeled code examples and a postcondition that expresses a check to be performed contingent on the precondition being satisfied.

5. The computer-implemented method of claim 4 , further comprising:

presenting the collection of rule candidates; and

receiving an edit to at least one of the rule candidates.

6. The computer-implemented method of claim 4 , wherein rule candidates are in a natural language format.

7. The computer-implemented method of claim 4 , wherein analyzing the code repository files to identify labeled code examples that either conform or do not conform to the rule candidates comprises generating embeddings for code in the code repository files and embeddings for the candidate rules to determine matching embeddings.

8. The computer-implemented method of claim 4 , further comprising:

receiving labeled code examples to be used the synthesizing of at least one rule.

9. The computer-implemented method of claim 4 , wherein the synthesizing of at least one rule comprises:

aligning graphs of violating examples and extracting a common pattern as a precondition; and

determining examples that satisfy the precondition, aligning graphs of violating examples, and extracting a common pattern as a postcondition.

10. The computer-implemented method of claim 4 , further comprising:

generating examples of positive recommendations based on the synthesized rules.

11. The computer-implemented method of claim 4 , further comprising:

receiving labeled detections and refining the at least one rule.

12. The computer-implemented method of claim 4 , further comprising:

receiving edit for a rule via a graphical user input on a graph structure.

13. The computer-implemented method of claim 4 , wherein the request includes one or more of an indication of a location one or more policy documents; an indication of a location a code repository; one or more policy documents; an indication of how to provide generated rules; or an indication of a type of user able to generate rules.

14. The computer-implemented method of claim 4 , wherein the collection of rule candidates is determined by applying at least one of a natural language classifier and a few shot learning classifier on examples not previously covered by the policy.

15. A system comprising:

a first one or more electronic devices to implement a storage service in a multi-tenant provider network to store a code repository; and

a second one or more electronic devices to implement a code reviewer service in the multi-tenant provider network, the code reviewer service including instructions that upon execution cause the code reviewer service to:

receive at least one request to create rules based on a policy and code repository files stored by the storage service;

analyze the policy to generate a collection of rule candidates;

analyze the code repository files to identify labeled code examples that either conform or do not conform to the rule candidates;

receive a selection of the labeled code examples; and

synthesize at least one rule that includes a precondition that specifies applicability to the selected labeled code examples and a postcondition that expresses a check to be performed contingent on the precondition being satisfied.

16. The system of claim 15 , wherein rule candidates are in a natural language format.

17. The system of claim 15 , wherein the code reviewer service is further configured to:

present the collection of rule candidates; and

receive an edit to at least one of the rule candidates.

18. The system of claim 15 , wherein to analyze the code repository files comprises to identify labeled code examples that either conform or do not conform to the rule candidates comprises generating embeddings for code in the code repository files and embeddings for the candidate rules to determine matching embeddings.

19. The system of claim 15 , wherein the request includes one or more of an indication of a location one or more policy documents; an indication of a location a code repository; one or more policy documents; an indication of how to provide generated rules; or an indication of a type of user able to generate rules.

20. The system of claim 15 , wherein the code reviewer service is further to:

receive edit for a rule via a graphical user input on a graph structure.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 28, 2022
From: SAWANT, NEELA; GARG, PRANAV
To: AMAZON TECHNOLOGIES, INC.
Reel/Frame 060338/0148 →
Cited By (3)
US 12,493,452 US 12,640,982 US 12,659,228