Skip to content

Add modular browser-based AI threat message detection dashboard#2

Open
codezji wants to merge 1 commit intomainfrom
codex/build-ai-threat-message-detection-prototype
Open

Add modular browser-based AI threat message detection dashboard#2
codezji wants to merge 1 commit intomainfrom
codex/build-ai-threat-message-detection-prototype

Conversation

@codezji
Copy link
Copy Markdown
Owner

@codezji codezji commented Feb 12, 2026

Motivation

  • Provide a self-contained browser prototype that simulates a realistic AI moderation engine for detecting threat intent with explainability for hackathon/demo use cases.
  • Prioritize layered reasoning and transparent outputs instead of simple keyword matches to make alerts believable and reviewable by humans.

Description

  • Add a responsive dashboard UI in index.html with panels for input, results, explainability, recent scans, sample messages, and a status badge.
  • Implement a cyber-security themed stylesheet in style.css with dark palette, accent colors, risk meter, and responsive layout.
  • Add analysisEngine.js implementing a multi-layer scoring engine (keyword signals, context analysis, behavioral indicators, safety offsets, aggregation, classification, and confidence calculation) with detailed indicator objects for explainability.
  • Add uiController.js and main.js to wire UI updates, render explainability and history, support debounced real-time analysis, sample scenarios, and a simulated 1s AI processing delay.

Testing

  • Run a JavaScript syntax check using `node -e

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c12f0d26e8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +174 to +180
return {
riskScore: 0,
category: 'Safe',
threatLevel: 'LOW',
confidence: 0,
indicators: []
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Include layer scores in empty analysis result

When the input is blank, analyze() returns an object without layers, but UIController.renderResult() always reads result.layers.keywordScore; clicking Analyze Message on an empty/whitespace textarea therefore throws a runtime TypeError and breaks rendering for that run. Keep the return shape consistent (or guard the UI read) so empty input does not crash the dashboard.

Useful? React with 👍 / 👎.

const ThreatAnalysisEngine = (() => {
const keywordSignals = [
{ pattern: /\bkill|shoot|stab|murder\b/gi, weight: 18, type: 'Violence verb' },
{ pattern: /\bbomb|explode|detonate|blast\b/gi, weight: 24, type: 'Explosive reference' },
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Scope keyword regexes to whole words

This alternation applies word boundaries only to the first and last branch, so tokens like bomb can match inside benign words (for example, bombastic), which inflates risk scoring and creates false alerts. The same pattern shape appears in several signal regexes, so wrapping alternatives (e.g., \b(?:...)\b) is needed to preserve detection accuracy.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant