{
  "name": "Trend Vision One - MinIO Simple Workflow",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "minio-scan",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "webhook",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "method": "GET",
        "url": "=http://{{ $env.MINIO_ENDPOINT || 'localhost:9000' }}/{{ $json.bucket_name }}/{{ $json.object_name }}",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "httpBasicAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=AWS {{ btoa($env.MINIO_ACCESS_KEY + ':' + $env.MINIO_SECRET_KEY) }}"
            }
          ]
        },
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "id": "download-minio",
      "name": "Download from MinIO",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $env.TREND_VISION_ONE_BASE_URL || 'https://api.trendmicro.com' }}/v1/file/scan",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $env.TREND_VISION_ONE_API_KEY }}"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "file",
              "value": "={{ $binary.data }}"
            }
          ]
        },
        "options": {
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        }
      },
      "id": "scan-file",
      "name": "Scan with Trend Vision One",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        680,
        300
      ],
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "check-malicious",
              "leftValue": "={{ $json.malicious || $json.data?.malicious || false }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "true"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "check-result",
      "name": "Is Malicious?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        900,
        300
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $env.MINIO_ENDPOINT || 'localhost:9000' }}/{{ $env.QUARANTINE_BUCKET || 'quarantine-bucket' }}/quarantine/{{ $now.format('YYYY-MM-DD') }}/{{ $('Webhook').item.json.object_name }}",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "httpBasicAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=AWS {{ btoa($env.MINIO_ACCESS_KEY + ':' + $env.MINIO_SECRET_KEY) }}"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "file",
              "value": "={{ $binary.data }}"
            }
          ]
        },
        "options": {}
      },
      "id": "quarantine",
      "name": "Quarantine File",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        1120,
        200
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ { \"status\": \"malicious\", \"file\": $('Webhook').item.json.object_name, \"threats\": $json.threats || $json.data?.threats || [] } }}"
      },
      "id": "response-malicious",
      "name": "Response (Malicious)",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1340,
        200
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ { \"status\": \"clean\", \"file\": $('Webhook').item.json.object_name } }}"
      },
      "id": "response-clean",
      "name": "Response (Clean)",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1120,
        400
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Download from MinIO",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download from MinIO": {
      "main": [
        [
          {
            "node": "Scan with Trend Vision One",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scan with Trend Vision One": {
      "main": [
        [
          {
            "node": "Is Malicious?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Malicious?": {
      "main": [
        [
          {
            "node": "Quarantine File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Response (Clean)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Quarantine File": {
      "main": [
        [
          {
            "node": "Response (Malicious)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [],
  "triggerCount": 1,
  "updatedAt": "2024-01-01T00:00:00.000Z",
  "versionId": "1"
}