-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Copy WIP from #16708 #20380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Copy WIP from #16708 #20380
Conversation
|
I see you updated files related to
|
- Add 'strings' package for log message searching - Add 'gomega' package for Eventually pattern to wait for transmissions
- Add search for 'Created primary transaction' log message - Add search for 'Created secondary transaction' log message - These are the actual log messages emitted by the dual contract transmitter - Improve secondary transmission detection patterns
- Remove reset of primaryFound/secondaryFound inside Eventually loop - Once found, keep the state true to avoid false negatives - This ensures the test correctly detects both transmissions
- Use exact match for 'Created primary transaction' log message - Use exact match for 'Created secondary transaction' log message - Remove broader patterns that could match false positives - These are the specific DEBUG logs emitted by OCR2DualContractTransmitter
This reverts commit c39ea1e.
|
|
||
| // Return success response | ||
| w.WriteHeader(http.StatusOK) | ||
| w.Write([]byte(fmt.Sprintf(`{"status": "success", "txHash": "%s"}`, txHash))) |
Check warning
Code scanning / CodeQL
Reflected cross-site scripting Medium
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 9 hours ago
The correct fix is to ensure that all user-supplied data interpolated into responses is sanitized/escaped, particularly for contexts like HTML or JavaScript but also for JSON if not using safe methods. In Go, the safest way to construct a JSON response is to use json.Marshal to encode a struct/map, which takes care of necessary escaping automatically. For this file, replace the manual fmt.Sprintf with a standard struct containing status and txHash, and marshal it using json.Marshal. On error, fall back to a safe error response. No changes are needed outside this file. You only need to import the well-known encoding/json package (already imported).
-
Copy modified lines R191-R200
| @@ -188,5 +188,14 @@ | ||
|
|
||
| // Return success response | ||
| w.WriteHeader(http.StatusOK) | ||
| w.Write([]byte(fmt.Sprintf(`{"status": "success", "txHash": "%s"}`, txHash))) | ||
| resp := map[string]string{ | ||
| "status": "success", | ||
| "txHash": txHash, | ||
| } | ||
| jsonBytes, err := json.Marshal(resp) | ||
| if err != nil { | ||
| w.Write([]byte(`{"status": "success", "txHash": ""}`)) | ||
| return | ||
| } | ||
| w.Write(jsonBytes) | ||
| } |
|




Requires
Supports