|
73 | 73 |
|
74 | 74 | --- |
75 | 75 |
|
76 | | -### 1. ❌ API returns HTTP 200 even with empty or invalid request body |
| 76 | +### 1. ❌ API returns HTTP 200 even with invalid data text |
77 | 77 |
|
78 | | -- **Title**: Empty input accepted as valid |
| 78 | +- **Title**: invalid data input accepted as valid |
79 | 79 | - **Environment**: `/api/rfq/upload-url-html` |
80 | 80 | - **Steps to Reproduce**: |
81 | | - 1. Send empty JSON `{}` or empty `"url": ""` |
| 81 | + 1. Send invalid data in text JSON |
82 | 82 | - **Actual Result**: HTTP 200 OK, `isSuccess: true` but no useful result |
83 | 83 | - **Expected Result**: HTTP 400 Bad Request with error details |
84 | 84 | - **Severity**: High |
85 | 85 | - **Priority**: High |
86 | 86 |
|
87 | 87 | --- |
88 | 88 |
|
89 | | -### 2. ❌ Invalid URLs do not return error |
| 89 | +### 2. ❌ API accepts requests without required headers and returns HTTP 200 |
90 | 90 |
|
91 | | -- **Title**: Invalid URL strings processed without validation error |
92 | | -- **Environment**: `/api/rfq/upload-url-html` |
93 | | -- **Steps to Reproduce**: |
94 | | - 1. Send `"url": "htp://invalid-url"` |
95 | | -- **Actual Result**: 200 OK, vague response |
96 | | -- **Expected Result**: HTTP 400 with descriptive error |
97 | | -- **Severity**: Medium |
98 | | -- **Priority**: Medium |
| 91 | +- **Title**: Missing authentication headers not rejected properly |
| 92 | +- **Environment**: All protected API endpoints |
| 93 | +- **Steps to Reproduce**: |
| 94 | + 1. Send a request to any protected endpoint (e.g. `/api/rfq/upload-free-text`) |
| 95 | + 2. Omit both `Authorization` and `ApiKey` headers |
| 96 | +- **Actual Result**: |
| 97 | + - The API responds with `HTTP 200 OK` |
| 98 | + - Response may include a vague "unauthorized" message or even `isSuccess: true` |
| 99 | +- **Expected Result**: |
| 100 | + - API should return `HTTP 401 Unauthorized` |
| 101 | + - Response body should contain a clear error message like `Missing or invalid authentication headers` |
| 102 | +- **Severity**: High |
| 103 | +- **Priority**: High |
99 | 104 |
|
100 | 105 | --- |
101 | 106 |
|
102 | | -### 3. ❌ Missing required fields do not trigger validation errors |
| 107 | +### 3. ❌ API treats request with both `ApiKey` and `Authorization` headers as authorized, but rejects request with only `ApiKey` |
103 | 108 |
|
104 | | -- **Title**: Missing `text` or `url` field accepted silently |
105 | | -- **Environment**: `/upload-free-text` and `/upload-url-html` |
106 | | -- **Steps to Reproduce**: |
107 | | - 1. Send request without `text` or without `url` |
108 | | -- **Actual Result**: `isSuccess: true` but no data processed |
109 | | -- **Expected Result**: Validation error and HTTP 400 response |
110 | | -- **Severity**: High |
111 | | -- **Priority**: High |
| 109 | +- **Title**: API requires `Authorization` header format, ignores or rejects `ApiKey` header alone |
| 110 | +- **Environment**: All endpoints requiring authentication |
| 111 | +- **Steps to Reproduce**: |
| 112 | + 1. Send request with header: |
| 113 | + `ApiKey: a7a91f48-0371-4680-b69d-7928d9c1c9ad` |
| 114 | + → API returns HTTP 200 with unauthorized message (not authorized) |
| 115 | + 2. Send request with both headers: |
| 116 | + `ApiKey: a7a91f48-0371-4680-b69d-7928d9c1c9ad` |
| 117 | + `Authorization: ApiKey a7a91f48-0371-4680-b69d-7928d9c1c9ad` |
| 118 | + → API returns HTTP 200 and treats user as authorized |
| 119 | +- **Actual Result**: API accepts only requests with `Authorization` header in format `ApiKey <key>`. Requests with only `ApiKey` header are rejected as unauthorized, but when both headers are sent, API treats request as authorized. |
| 120 | +- **Expected Result**: Consistent authentication handling. Either accept `ApiKey` header alone or clearly reject and document that only `Authorization` header with `ApiKey` prefix is accepted. Do not mix behaviors depending on presence of both headers. |
| 121 | +- **Severity**: Medium |
| 122 | +- **Priority**: Medium |
112 | 123 |
|
113 | 124 | --- |
114 | 125 |
|
115 | | -### 4. ❌ Malformed JSON accepted with HTTP 200 |
| 126 | +### 4. ❌ API returns HTTP 200 OK for oversized request payload |
116 | 127 |
|
117 | | -- **Title**: Invalid JSON not rejected |
118 | | -- **Environment**: Any endpoint |
119 | | -- **Steps to Reproduce**: |
120 | | - 1. Send request with broken JSON syntax |
121 | | -- **Actual Result**: 200 OK, empty or null response |
122 | | -- **Expected Result**: HTTP 400 with JSON parse error |
123 | | -- **Severity**: Medium |
124 | | -- **Priority**: Medium |
| 128 | +- **Title**: API does not reject overly large `text` input |
| 129 | +- **Environment**: `/api/rfq/upload-free-text` |
| 130 | +- **Steps to Reproduce**: |
| 131 | + 1. Send POST request with `text` field containing very large string (e.g., 2MB of characters) |
| 132 | +- **Actual Result**: HTTP 200 OK returned, request accepted silently without error |
| 133 | +- **Expected Result**: HTTP 413 Payload Too Large or HTTP 400 Bad Request with descriptive error message |
| 134 | +- **Severity**: Medium |
| 135 | +- **Priority**: Medium |
125 | 136 |
|
126 | 137 | --- |
127 | 138 |
|
128 | | -### 5. ❌ API key header is case-sensitive causing unauthorized errors |
| 139 | +### 5. ❌ API accepts `topK` as a string without validation |
129 | 140 |
|
130 | | -- **Title**: Header name must be exactly `ApiKey` |
131 | | -- **Environment**: All API endpoints |
| 141 | +- **Title**: `topK` parameter accepts string values silently |
| 142 | +- **Environment**: `/api/rfq/upload-url-html`, `/api/rfq/upload-free-text` |
132 | 143 | - **Steps to Reproduce**: |
133 | | - 1. Send API key header as `apikey` or `Authorization` |
134 | | -- **Actual Result**: Unauthorized error with 200 status |
135 | | -- **Expected Result**: Clear documentation or case-insensitive header handling, plus HTTP 401 status |
136 | | -- **Severity**: Medium |
137 | | -- **Priority**: Medium |
| 144 | + 1. Send request with `topK` as a string: |
| 145 | + ```json |
| 146 | + { |
| 147 | + "url": "https://www.webstaurantstore.com/choice-24-x-18-x-1-2-green-polyethylene-cutting-board/40724185GN.html", |
| 148 | + "topK": "3", |
| 149 | + "threshold": 0.8, |
| 150 | + "enablePrivateLabelRanking": false, |
| 151 | + "enableStockProductRanking": false, |
| 152 | + "enableVendorRanking": false |
| 153 | + } |
| 154 | + ``` |
| 155 | +- **Actual Result**: |
| 156 | + - API returns `HTTP 200 OK` |
| 157 | + - `isSuccess: true` |
| 158 | + - No validation error, even though `topK` is a string instead of a number |
| 159 | +- **Expected Result**: |
| 160 | + - API should return `HTTP 400 Bad Request` |
| 161 | + - Error message like: "`topK` must be a number" |
| 162 | +- **Severity**: Medium |
| 163 | +- **Priority**: Medium |
0 commit comments