Skip to content

Add AI-powered IP reputation analysis using Cloudflare Workers AI (Llama 3.1 70B)#13

Merged
devnomadic merged 17 commits into
mainfrom
copilot/update-cloudflare-worker-ai
Nov 25, 2025
Merged

Add AI-powered IP reputation analysis using Cloudflare Workers AI (Llama 3.1 70B)#13
devnomadic merged 17 commits into
mainfrom
copilot/update-cloudflare-worker-ai

Conversation

Copilot AI commented Oct 28, 2025

Copy link
Copy Markdown
Contributor

Integrates Cloudflare Workers AI to generate intelligent risk assessments for IP addresses using the Llama 3.1 70B Instruct model, analyzing real-time data from AbuseIPDB and Cloudflare Radar APIs.

Changes

Worker Configuration

  • wrangler.toml: Added AI binding for Workers AI access

Worker Implementation

  • cloudflare-worker.template.js:
    • New generateAIReputation() function calls Llama 3.1 70B with structured prompt
    • Analyzes abuse scores, report counts, ISP, country, and ASN data
    • Returns risk level (low/medium/high/critical), trust score (0-100), summary, and recommendations
    • Runs sequentially after parallel AbuseIPDB/Radar calls complete
    • Graceful degradation on AI service failures
    • Updated event handlers to pass env parameter for binding access

Service Models

  • AbuseIPDBService.cs:
    • New AIReputation class with success, error, analysis, model, and timestamp fields
    • New AIAnalysis class with risk level, trust score, summary, and recommendations
    • Updated AbuseIPDBApiResponse to include AIReputation field

Response Format

{
  "data": { /* AbuseIPDB data */ },
  "asnInfo": { /* Cloudflare Radar ASN data */ },
  "aiReputation": {
    "success": true,
    "analysis": {
      "riskLevel": "medium",
      "trustScore": 65,
      "summary": "IP from US datacenter with 15 abuse reports. Moderate risk profile.",
      "recommendations": [
        "Review abuse report patterns",
        "Consider rate limiting for API access"
      ]
    },
    "model": "@cf/meta/llama-3.1-70b-instruct",
    "timestamp": "2025-10-28T04:45:00.000Z"
  }
}

Notes

  • Maintains backward compatibility; existing response structure unchanged
  • AI failures don't break worker; returns success: false with error message
  • Temperature set to 0.3 for consistent factual responses
  • All 41 existing tests pass; no regressions
Original prompt

This section details on the original issue you should resolve

<issue_title>AI Reputation Check</issue_title>
<issue_description>Update the Cloudflare worker to call the Cloudflare workers AI REST API to generate an IP reputation report using real-time sources:

https://developers.cloudflare.com/workers-ai/models/llama-3.1-70b-instruct/</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Update Cloudflare worker for AI reputation report Add AI-powered IP reputation analysis using Cloudflare Workers AI (Llama 3.1 70B) Oct 28, 2025
Copilot AI requested a review from devnomadic October 28, 2025 04:50
@github-actions

github-actions Bot commented Oct 28, 2025

Copy link
Copy Markdown

🚀 PR Status Dashboard

📊 Workflow Status

CI: success (view)
Deploy: success (view)

🌐 Preview Environments

SPA Preview: https://copilot-update-cloudflare-worker-ai.albatross-5kt.pages.dev
Worker Preview: https://abuseipdb-preview.devnomadic.workers.dev

📝 PR Details

Branch: copilot/update-cloudflare-worker-ai
Commit: f60182b7
Author: @Copilot
Target: main
Last Updated: 2025-11-25T13:41:15.540Z


This comment is automatically updated by the PR Update workflow

@github-actions

Copy link
Copy Markdown

🚀 PR Status Dashboard

📊 Workflow Status

CI: success (view)
Deploy: not deployed

🌐 Preview Environments

SPA Preview: https://copilot-update-cloudflare-worker-ai.albatross-5kt.pages.dev
Worker Preview: https://abuseipdb-preview.devnomadic.workers.dev

📝 PR Details

Branch: copilot/update-cloudflare-worker-ai
Commit: b48a4c70
Author: @Copilot
Target: main
Last Updated: 2025-10-28T05:01:10.945Z


This comment is automatically updated by the PR Update workflow

Copilot AI and others added 5 commits October 28, 2025 15:06
Co-authored-by: devnomadic <14085319+devnomadic@users.noreply.github.com>
Co-authored-by: devnomadic <14085319+devnomadic@users.noreply.github.com>
Co-authored-by: devnomadic <14085319+devnomadic@users.noreply.github.com>
Co-authored-by: devnomadic <14085319+devnomadic@users.noreply.github.com>
@devnomadic devnomadic force-pushed the copilot/update-cloudflare-worker-ai branch from b48a4c7 to 740a3fa Compare October 28, 2025 05:11
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 28, 2025

Copy link
Copy Markdown

Deploying albatross with  Cloudflare Pages  Cloudflare Pages

Latest commit: f60182b
Status: ✅  Deploy successful!
Preview URL: https://2ff427d7.albatross-5kt.pages.dev
Branch Preview URL: https://copilot-update-cloudflare-wo.albatross-5kt.pages.dev

View logs

…emove manual construction for property order
…minor docs/date updates

- Home.razor: remove static ascii image and render an inline pixel matrix using AsciiArtPixelMatrix, BuildAsciiArtPixelMatrix and GetPixelShadeClass; add matrix dimensions/constants and wire up markup
- wwwroot/css/app.css: add pixel-matrix styles and responsive pixel sizing; reduce JSON/code font-size and remove redundant wide-screen font-size overrides for inputs
- cloudflare-worker.template.js: expand eventsSummary comment to include targeted services and longer summary guidance
- wwwroot/sitemap.xml: update lastmod timestamps to 2025-10-31
… + aspect-ratio, enforce square pixels, set container width/max-width and responsive widths; center IP input text/placeholder
…3, tighten container padding, and normalize img width attribute quoting
…me.razor, modify AbuseIPDBService and Cloudflare worker to support AI analysis, and update sitemap and index.html for SEO improvements.
@devnomadic devnomadic marked this pull request as ready for review November 25, 2025 13:51
@devnomadic devnomadic merged commit 202304e into main Nov 25, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI Reputation Check

2 participants