api

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2020 License: BSD-3-Clause Imports: 2 Imported by: 0

README

Gateway with SQL injection attack defense

This recipe is a gateway with SQL injection attack defense.

Installation

  • Install Go

Setup

git clone https://github.com/project-flogo/microgateway
cd microgateway/activity/sqld/examples/api

Testing

Start the gateway:

go run main.go

and test below scenarios.

Payload without SQL injection attack

Run the following command:

curl -H "Content-Type:application/json" http://localhost:9096/pets --upload-file payload.json

You should see the following response:

{
 "category": {
  "id": 0,
  "name": "string"
 },
 "id": 1,
 "name": "cat",
 "photoUrls": [
  "string"
 ],
 "status": "available",
 "tags": [
  {
   "id": 0,
   "name": "string"
  }
 ]
}
Payload with SQL injection attack
curl -H "Content-Type:application/json" http://localhost:9096/pets --upload-file attack-payload.json

You should see the following response:

{
 "attackValues": {
  "content": {
   "category": {
    "name": 0
   },
   "name": 99.97982025146484,
   "photoUrls": [
    0
   ],
   "status": 0,
   "tags": [
    {
     "name": 0
    }
   ]
  }
 },
 "error": "hack attack!"
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL