Added checks to prevent SSRF and used pinned url. Also removed appVersion for docsum, chatqna-core #1518
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added checks to prevent SSRF and used pinned url. Also removed appVersion for docsum, chatqna-core
Description
Added few checks to prevent SSRF
DNS rebinding Avoided: Instead of directly using the user provided url, we validate it, resolve to ip address and use it instead of url with hostname as shown in example below
Example:
Resolve Hostname:
Input URL: https://malicious.com/
Resolved IP: 203.0.113.45 (public IP)
Validate Resolved IP:
Confirm 203.0.113.45 is a public IP.
Pin URL to Resolved IP:
Pinned URL: https://203.0.113.45/
Hostname malicious.com is preserved in the Host header.
DNS Rebinding Attempt:
Attacker changes malicious.com to resolve to 192.168.1.100 (private IP).
Prevent Rebinding:
HTTP request is sent to the pinned IP 203.0.113.45, ignoring the re-resolved private IP.
DNS rebinding attack is mitigated.
Fixes # https://github.com/open-edge-platform/edge-ai-libraries/security/code-scanning/1624
https://jira.devtools.intel.com/browse/ITEP-82266
Any Newly Introduced Dependencies
Please describe any newly introduced 3rd party dependencies in this change. List their name, license information and how they are used in the project.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist:
I agree to use the APACHE-2.0 license for my code changes.
I have not introduced any 3rd party components incompatible with APACHE-2.0.
I have not included any company confidential information, trade secret, password or security token.
I have performed a self-review of my code.