Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions api_tests/products_get_others.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
id,name,description,price
1,Chips,Uncle Chips,120.0
2,Cookies,Oreo Cookies,99.99
3,Soap,Lifebuoy,50.0
4,Shampoo,Head & Shoulders,180.5
5,Chocolate,Cadbury Dairy Milk,85.25
6,Milk,Amul,55.0
7,Butter,Amul Butter,110.75
8,Maggi,Maggi Masala,15.0
9,Bread,Harvest,40.5
10,Eggs,Fresh Eggs,60.0
76 changes: 76 additions & 0 deletions api_tests/products_get_others.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# ********RoostGPT********

# Test generated by RoostGPT for test dm-new-elastic using AI Type Azure Open AI and AI Model roostgpt-4-32k
#
# ================================VULNERABILITIES================================
# Vulnerability: Exposure of sensitive product information
# Issue: The product details including the 'id', 'name', 'description' and 'price' are being logged publicly and can be exposed to unauthorized personnel. Refer to the log line timestamps '22-06-2023 06:16:52.660' and '22-06-2023 06:16:54.972'.
# Solution: Consider redacting or using data anonymization techniques for product information in logs to protect from unauthorized exposure. Use configurable log levels to control the type of information that gets logged in different environments.
#
# Vulnerability: GDPR non-compliance - unnecessary data retention
# Issue: Log entries indicate that all product information is being retained indefinitely including the 'id', 'name', 'description', and 'price', which could potentially violate GDPR principles.
# Solution: Establish and enforce a data retention policy that includes deleting the logs after a specified duration, anonymizing the data, or moving the log data to secure storage.
#
# ================================================================================
# Test generated for /products_get for http method type GET in artillery framework
# RoostTestHash=ed0d766b50
#
#

# ********RoostGPT********
config:
target: "{{ $processEnvironment.API_HOST }}"
phases:
- duration: 60
arrivalRate: 20
payload:
path: "products_get_others.csv"
fields:
- "id"
- "name"
- "description"
- "price"
plugins:
expect: {}

scenarios:
- name: "Failure cases, edge cases, and error handling"
flow:
- get:
url: "/unexisting"
headers:
Authorization: "Bearer {{ $processEnvironment.AUTH_TOKEN }}"
expect:
- statusCode: 404
- think: 1
- get:
url: "/products/error"
headers:
Authorization: "Bearer {{ $processEnvironment.AUTH_TOKEN }}"
expect:
- statusCode: 500
- hasHeader: "Content-Type"
- think: 1
- post:
url: "/products"
json:
id: "#{{ id }}"
name: "{{ name }}"
description: "{{ description }}"
price: "{{ price }}"
headers:
Authorization: "Bearer {{ $processEnvironment.AUTH_TOKEN }}"
expect:
- statusCode: 400
- hasHeader: "Content-Type"
- hasProperty: "errors[0].message"
- think: 1
- get:
url: "/products/{id}"
headers:
Authorization: "Bearer {{ $processEnvironment.AUTH_TOKEN }}"
expect:
- statusCode: 400
- hasHeader: "Content-Type"
- hasProperty: "error"
- think: 1
11 changes: 11 additions & 0 deletions api_tests/products_get_success.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
id,name,description,price
1,Apple,Fresh Apples,100
2,Chips,Delicious Potato Chips,50
3,Soda,Refreshing Cola Soda,60
4,Pizza,Cheesy Pepperoni Pizza,200
5,Water,Refreshing Mineral Water,30
6,Milk,Nutritious Cow Milk,70
7,Orange,Fresh Oranges,80
8,Cheese,Dairy Farm Cheese,120
9,Bread,Whole Wheat Bread,40
10,Oats,Healthy Breakfast Oats,90
45 changes: 45 additions & 0 deletions api_tests/products_get_success.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# ********RoostGPT********

# Test generated by RoostGPT for test dm-new-elastic using AI Type Azure Open AI and AI Model roostgpt-4-32k
#
# ================================VULNERABILITIES================================
# Vulnerability: None
# Issue: No issues identified based on the provided logs.
# Solution: Consider keeping debug or error logs to potentially spot hidden issues or vulnerabilities.
#
# ================================================================================
# Test generated for /products_get for http method type GET in artillery framework
# RoostTestHash=ed0d766b50
#
#

# ********RoostGPT********
config:
target: "{{ $processEnvironment.API_HOST }}"
plugins:
expect: {}
payload:
path: "products_get_success.csv"
fields:
- "id"
- "name"
- "description"
- "price"
skipHeader: true
http:
headers:
Authorization: "{{$processEnvironment.AUTH_TOKEN}}"

scenarios:
- name: "GET all products"
flow:
- think: 3
- get:
url: "/products"
expect:
- statusCode: 200
- hasProperty: "name"
- hasProperty: "id"
- hasProperty: "description"
- hasProperty: "price"
- think: 3
11 changes: 11 additions & 0 deletions api_tests/products_post_others.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
id,name,description,price
1,Apple,Red apple,50
2,Banana,Yellow Banana,30
3,Grapes,Green Grapes,100
4,Guava,Green Guava,70
5,null,Mango,90
6,Watermelon,Watermelon,150
7,Apricot,Apricot,120
8,Tomato,Red Tomato,40
abn,Squash,Orange Squash,180
10,Cabbage,Green Cabbage,
70 changes: 70 additions & 0 deletions api_tests/products_post_others.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# ********RoostGPT********

# Test generated by RoostGPT for test dm-new-elastic using AI Type Azure Open AI and AI Model roostgpt-4-32k
#
# ================================VULNERABILITIES================================
# Vulnerability: Exposed product data
# Issue: The logs are showing the detail information about products (like id, name, description, price) on lines: 1 and 3. Although this is not a security flaw in a strict sense, it might give valuable information about the internal workings of the application to a potential attacker.
# Solution: Implement logging policies to minimize exposure of unnecessary system and product details. Remove or anonymize potentially sensitive data.
#
# ================================================================================
# Test generated for /products_post for http method type POST in artillery framework
# RoostTestHash=2c080099fd
#
#

# ********RoostGPT********
config:
target: "{{ $processEnvironment.API_HOST }}"
plugins:
expect: {}
payload:
path: "products_post_others.csv"
fields: ["id", "name", "description", "price"]
skipHeader: true
environments:
dev:
target: "http://localhost:5000"

scenarios:
- name: "Add new product with wrong details"
flow:
# Scenario with missing product ID
- post:
url: "/products"
json:
id: "{{ id }}"
name: "{{ name }}"
description: "{{ description }}"
price: "{{ price }}"
expect:
- statusCode: 400
- think: 2

# Scenario with wrong auth token and valid product details
- post:
url: "/products"
json:
id: 10
name: "apple"
description: "description of the product"
price: 20
headers:
Authorization: "Bearer WrongTokenValue"
expect:
- statusCode: 401
- think: 2

# Scenario with valid product details but wrong URL
- post:
url: "/wrong/url/path"
json:
id: 10
name: "apple"
description: "description of the product"
price: 20
headers:
Authorization: "Bearer {{$processEnvironment.AUTH_TOKEN}}"
expect:
- statusCode: 404
- think: 2
11 changes: 11 additions & 0 deletions api_tests/products_post_success.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
id,name,description,price
1,Apple,Delicious red apple,100
2,Orange,Sweet and sour orange,80
3,Banana,Yellow ripe banana,50
4,Chips,Crispy Potato Chips,120
5,Bread,Freshly baked bread,200
6,Milk,Nutritious cow's milk,130
7,Eggs,Fresh farm eggs,90
8,Cheese,Delicious cheddar cheese,170
9,Butter,Creamy salted butter,140
10,Ham,Smoked and sliced ham,180
57 changes: 57 additions & 0 deletions api_tests/products_post_success.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# ********RoostGPT********

# Test generated by RoostGPT for test dm-new-elastic using AI Type Azure Open AI and AI Model roostgpt-4-32k
#
# ================================VULNERABILITIES================================
# Vulnerability: Insufficient Log Details
# Issue: The given logs do not provide adequate information about system interactions, database connections, or transaction states. This could limit the ability to detect and diagnose issues or security incidents. Current logs primarily represent success states of 'Product Creation' and do not mention any errors or exceptions.
# Solution: Increase the verbosity of the logs where applicable, especially around database connections, transaction states, and client-system interactions. Ensure that error and exception logs are appropriately captured and stored.
#
# Vulnerability: Lack of Unique Identifier for Requests
# Issue: Non-existence of unique identifiers for the requests in the system prevents adequate tracking of actions performed on the system.
# Solution: Integrate a unique identifier (such as a UUID) for each incoming request. This can be done by attaching these identifiers to the logging context, making it possible to identify actions linked with specific requests across log entries.
#
# ================================================================================
# Test generated for /products_post for http method type POST in artillery framework
# RoostTestHash=2c080099fd
#
#

# ********RoostGPT********
config:
target: "{{ $processEnvironment.API_HOST }}"
environments:
env:
variables:
AUTH_TOKEN: "{{ $processEnvironment.AUTH_TOKEN }}"
plugins:
expect: {}
payload:
path: "products_post_success.csv"
fields:
- "id"
- "name"
- "description"
- "price"
skipHeader: true

scenarios:
- name: "Product creation sequence"
flow:
# Create product and expect successful response
- post:
url: "/products"
headers:
Content-Type: "application/json"
Authorization: "Bearer {{ AUTH_TOKEN }}"
json:
id: "{{ id }}"
name: "{{ name }}"
description: "{{ description }}"
price: "{{ price }}"
expect:
- statusCode: 200
- hasProperty: ["id", "name", "description", "price"]
- contentType: "application/json"
- think: 1

11 changes: 11 additions & 0 deletions api_tests/products_productId_delete_others.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
productId
2
3
15
29
75
1000
2001
darknight
667.89
222222222222222
72 changes: 72 additions & 0 deletions api_tests/products_productId_delete_others.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# ********RoostGPT********

# Test generated by RoostGPT for test dm-new-elastic using AI Type Azure Open AI and AI Model roostgpt-4-32k
#
# ================================VULNERABILITIES================================
# Vulnerability: Not Detected
# Issue: No issues or vulnerabilities detected in the provided logs.
# Solution: No action required based on the provided logs.
#
# ================================================================================
# Test generated for /products/{productId}_delete for http method type DELETE in artillery framework
# RoostTestHash=47d9fe845f
#
#

# ********RoostGPT********
config:
target: "{{ $processEnvironment.API_HOST }}"
plugins:
expect: {}
payload:
path: "products_productId_delete_others.csv"
fields:
- "productId"
skipHeader: true

scenarios:
- name: "Failure/Edge/Error Case: DELETE /products/{productId}"
flow:
- think: 1
- delete:
url: "/products/{{ productId }}"
headers:
content-type: "application/json"
Authorization: "{{ $processEnvironment.AUTH_TOKEN }}"
expect:
- statusCode: 404
- hasProperty: 'message'
- equals:
message: "Error: Product not found"
- think: 1
- delete:
url: "/products/"
headers:
content-type: "application/json"
Authorization: "{{ $processEnvironment.AUTH_TOKEN }}"
expect:
- statusCode: 405
- hasProperty: 'message'
- equals:
message: "Error: Invalid request. Please provide a valid product ID"
- think: 1
- delete:
url: "/products/{{ productId }}"
headers:
content-type: "application/json"
expect:
- statusCode: 403
- hasProperty: 'message'
- equals:
message: "Error: Unauthorized. Please provide a valid Authorization token"
- think: 1
- delete:
url: "/invalidpath/{{ productId }}"
headers:
content-type: "application/json"
Authorization: "{{ $processEnvironment.AUTH_TOKEN }}"
expect:
- statusCode: 404
- hasProperty: 'message'
- equals:
message: "Error: Invalid URL path"
11 changes: 11 additions & 0 deletions api_tests/products_productId_delete_success.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
productId
1
2
3
4
5
6
7
8
9
10
Loading