-
Notifications
You must be signed in to change notification settings - Fork 359
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
Prism proxy modifying files #2349
Comments
@Freeshnik , thanks for your report. At this time, Prism doesn't support binary data in either mock or proxy mode. However, we agree that it should and welcome PRs, especially for the easier proxy case. |
This ticket has been labeled jira. A tracking ticket in Stoplight's Jira ( |
Hi @EdVinyard is there any progress on the above issue. |
Hi people I do face the same issue. So in our setup we have prism validation proxy running to validate traffic against the Open API contract. However there is one endpoint for downloading pdf files. Unfortunately the pdf file is being modified when passing through the proxy. This is a huge drawback since it makes it unusable for us. I would expect the proxy to pass binary data or even the whole request and response the way it originally was (except custom validation headers). This does not seem to be the case. I also removed the endpoint definition from my open api contract to avoid validation in assumption that the file is not being modified. However this did not fix it so it must be an issue with the proxying mechanism. Is there a current work around for this problem? It would be massively helpful to fix this issue. |
Hi @adrianburkard I had the same issue a few months back and we tried Schemathesis Hooks and it's working as expected. If you are testing your Open Api specifications against your API Endpoint Schemathesis could be an alternative tool. Check the below link whether it works for your requirements. |
Inb4 thank you for great tool!
Issue Description:
When using the Prism proxy to proxy requests to another backend, it has been observed that the library is modifying files during the proxy process.
This behavior is unexpected and can lead to validation errors.
Steps to Reproduce:
Expected Behavior:
The library should act as a transparent proxy, forwarding requests to the target backend without altering the content of the files being proxied.
The files received from the backend should remain unchanged and identical to the original files.
Actual Behavior:
During the proxy process, the library is modifying the content of the files being proxied.
File comparison functions (utilizing PHP's built-in functions) indicate disparate hashes between files. Moreover, methods for retrieving Mime-Type yield distinct outcomes. For instance, the original file, characterized by the Mime-Type 'application/vnd.ms-excel' (denoting an .xls file), undergoes a transformation during proxying, resulting in a Mime-Type alteration to 'application/octet-stream'.
Additionally, there is a discrepancy in file sizes. In the original context, the file has a size of 7680 bytes, whereas after passing through the Prism proxy, its size increases to 10942 bytes.
Impact:
Additional Information:
Workaround:
At this time, there is no known workaround to prevent the library from modifying files during the proxy process.
Users are advised to avoid using the proxy functionality of the affected library until the issue is resolved.
Proposed Solution:
Investigate the codebase of the library to identify the root cause of the file modifications during the proxy process. Implement a fix that ensures the content of proxied files remains unchanged when passed through the proxy.
Environment:
OS Ubuntu 20.04
PHP programming language to validate hash values and ascertain Mime-Types.
The text was updated successfully, but these errors were encountered: