Task Description
In this task, your system must be extended to ensure that every added link is scanned for inappropriate content. To perform this, an external API will be used:
api.scan-link/v1/scan?url={url}&callback={url2}
The external service does not provide an immediate response. Instead, it sends a POST request to the callback URL within 2 hours. The response will contain a JSON object with the following format:
{isFine: true/false}
If the scan result indicates that the link is not appropriate (isFine: false), the link should be blocked and no longer accessible.
Bonus Points:
When calling the external API, your system must only do so from a specific static IP address to increase security.
Task Requirements
- The system must call the external API to initiate the scan for each added link.
- The API request to
api.scan-link/v1/scan?url={url}&callback={url2}must include Basic Authentication and must be made from a specific static IP address. - The callback URL should be prepared to receive a POST request containing the scan results (
isFine: true/false). - If the
isFinevalue isfalse, the link should be marked as blocked and must not be accessible anymore.
Technical Requirements
- API Integration – The system must call the external API after a link is added. The API should be invoked using the format:
api.scan-link/v1/scan?url={url}&callback={url2}- Replace
{url}with the added link and{url2}with your system’s callback endpoint.
- Basic Authentication – The request to the external API should use Basic Authentication for added security.
- Asynchronous Handling – The system must handle the delayed response (within 2 hours) from the external service. Upon receiving the response, the system should evaluate the
isFinefield and take the appropriate action. - Blocking inappropriate links – If the scan result indicates that the content behind the link is not appropriate (
isFine: false), the link should be blocked. Blocked links should not be accessible to users.
Bonus Points:
- Ensure that your API requests to
api.scan-link/v1/scanare made only from a specific static IP address.
Task
Draw your solution on paper and use the AWS icons provided for the services you plan to use. Your solution should include:
- The architecture of the extended system, showing how the scanning process is integrated.
- Use case diagrams that demonstrate the steps involved in adding and scanning a link, as well as blocking inappropriate links.
- Data access diagrams, showing how scan results are stored and how blocked links are handled.
- For bonus points: Show how you will ensure that the external API is called only from the allowed static IP address.