Skip to content

Commit

Permalink
Merge pull request #28 from f5devcentral/class4-api
Browse files Browse the repository at this point in the history
api-validation
  • Loading branch information
MattDierick authored Nov 22, 2023
2 parents b44a3ac + c4d8fe2 commit 5f989c7
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
Binary file modified docs/class4/module2/.DS_Store
Binary file not shown.
36 changes: 35 additions & 1 deletion docs/class4/module2/lab1/lab1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,39 @@ Update your API Load Balancer

* SAVE your Load Balancer

.. note:: We do not test now our configuration. We must enable API Discovery first, in order to have a full protection and visibility.
Make a quick test of API Validation
-----------------------------------

* The OpenAPI Spec file, specify the type of data expected by the API Endpoint. Let's say we want to delete an entry for /adjectives.
* The OAS spec file specify the type is ``integer``

.. code-block:: yaml
:emphasize-lines: 11
delete:
description: delete an adjective
tags:
- adjectives
parameters:
- name: id
in: path
required: true
description: id of the adjective to retrieve
schema:
type: integer
* Let send a wrong request where we replace the ID (integer) by a string

.. code-block:: bash
curl --location --request DELETE 'http://sentence-re-$$makeId$$.workshop.emea.f5se.com/api/adjectives/beautiful'
.. note:: Here we replace the ID such as ``4``, by a string ``beautiful``

* Don't expect to see any outcome from the command as we did not set ``Block`` in our settings. We set ``Report``.
* Go to Security Dashboard and check your logs (can take up to 1min to be displayed). You can see a violation ``Request Path Parameter Violation``

.. image:: ../pictures/validation-log.png
:align: center

.. note:: We sent an ID with a string instead of an integer. F5XC can validate Request and Response body payload.
Binary file added docs/class4/module2/pictures/validation-log.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5f989c7

Please sign in to comment.