| title | Platform Engineering DevSecOps Advisor | |||||||
|---|---|---|---|---|---|---|---|---|
| emoji | 🛡️ | |||||||
| colorFrom | blue | |||||||
| colorTo | indigo | |||||||
| sdk | gradio | |||||||
| python_version | 3.10 | |||||||
| app_file | app.py | |||||||
| fullWidth | true | |||||||
| short_description | AI security advisor for platform engineering and SRE. | |||||||
| tags |
|
🔗 https://huggingface.co/spaces/Tukue/platform-eng-agent-advisor
Permanent portfolio demo hosted on Hugging Face Spaces. No setup required — works immediately in browser.
| What You'll See | Where to Look |
|---|---|
| Security advisor with retrieval-assisted classification and remediation guidance | Architecture |
| Responsible AI practices: 6-layer prompt injection defense, PII masking, output filtering | AI Agent Features |
| Clean, modular codebase with separation of concerns | Repository Structure |
| Comprehensive test suite (110 tests) covering all modules | tests/ |
| Observability built-in: structured logging, in-app metrics, health checks | Observability |
| Live deployment on HF Spaces and local Docker support; multi-cloud deployment configs are planned | Roadmap |
Quick talking points for interviews:
- Built a security advisor with hybrid classification: rule-based for known patterns + ensemble zero-shot for novel findings
- Implemented 6-layer input validation (prompt injection, encoding evasion, multilingual, separators, PII, rate limiting)
- Designed retrieval-assisted pipeline with TF-IDF + keyword hybrid search, query expansion, and category/severity reranking
- Added structured decision explanation — step-by-step reasoning rendered from Python templates — for transparent, auditable classification decisions
- Built session memory with risk summaries and context-aware recommendations
- Comprehensive output filtering: PII masking, unsafe advice blocking, heuristic checks for overconfident language
- Observability built in: structured logging, in-app metrics, health checks (Prometheus/Grafana export planned)
- Modular Python architecture: UI ↔ validation ↔ retrieval ↔ classification ↔ memory ↔ explanation ↔ filtering
A lightweight AI-assisted advisor that helps Platform Engineering and Site Reliability Engineering (SRE) teams turn infrastructure security findings into consistent, actionable remediation guidance.
The application accepts a finding, classifies it across common platform-security domains, assigns a severity, recommends a remediation path, and identifies the responsible platform team. It is advisory only: it does not modify infrastructure, deploy changes, or make access-control decisions.
Modern engineering organizations operate across cloud infrastructure, Kubernetes, CI/CD systems, identity platforms, and data services. This scale creates a continuous stream of security findings, many of which are difficult to prioritize and route correctly.
Without clear context, teams face predictable problems:
- Slower delivery: Developers pause work to interpret security alerts or wait for specialist review.
- Inconsistent remediation: Similar issues are fixed differently across teams, creating operational and audit risk.
- Alert fatigue: High volumes of low-context findings hide the issues that could affect customer data, availability, or revenue.
- SRE overload: Reliability teams spend time triaging misconfigurations rather than improving resilience and service health.
- Security bottlenecks: Central security teams become the default router for routine platform questions.
This advisor standardizes the first response to infrastructure risk. It gives teams an immediately understandable explanation and a practical next action, helping them resolve issues earlier in the delivery lifecycle.
Platform Engineering teams build the paved roads that enable product teams to ship safely. The advisor supports that mission by:
- Embedding guardrails in workflows: It can be used alongside pull requests, infrastructure-as-code reviews, CI/CD checks, and platform support tickets.
- Improving secure defaults: Recommendations reinforce least privilege, network segmentation, non-root containers, secret rotation, and encryption.
- Standardizing ownership: Each finding is routed to a relevant platform domain such as Cloud Platform, Container Platform, Data Platform, or Platform Security.
- Accelerating self-service: Developers receive repeatable guidance before escalating routine questions to platform specialists.
- Supporting platform adoption: Clear, consistent advice makes paved-road patterns easier for teams to understand and follow.
SRE teams balance reliability, operational risk, and engineering velocity. The advisor contributes by:
- Reducing toil: It provides a standardized initial assessment for common configuration and security findings.
- Protecting service reliability: It identifies risky patterns—such as publicly exposed services, privileged workloads, and weak identity controls—that can lead to incidents.
- Supporting risk-based prioritization: High and critical findings are flagged for human review, allowing experts to focus on material risk.
- Improving incident readiness: Its remediation advice can be used to create consistent runbook steps and escalation paths.
- Strengthening service ownership: Recommended owners make it easier to route follow-up work to the team best positioned to resolve it.
| Area | Advisor behavior | Example guidance |
|---|---|---|
| Identity and Access Management (IAM) | Detects risky permission and authentication patterns. | Apply least privilege, remove wildcard permissions, and require Multi-Factor Authentication (MFA). |
| Network security | Identifies overly broad ingress and segmentation gaps. | Limit ports and Classless Inter-Domain Routing (CIDR) ranges; add workload segmentation and Kubernetes NetworkPolicies. |
| Container security | Reviews dangerous workload configurations. | Use patched minimal images, run as non-root, drop capabilities, and scan in CI. |
| Secrets management | Detects exposed or hard-coded credentials. | Revoke and rotate the secret, remove it from history, and use a managed store. |
| Data protection | Identifies encryption and access-control gaps. | Encrypt data, restrict access, enable auditing, and protect backups. |
- Term Frequency-Inverse Document Frequency (TF-IDF) + keyword hybrid search over a 20-entry security knowledge base
- Query expansion with category and finding synonyms for better retrieval
- Reranking with category boosting and severity weighting
- Returns relevant remediation guidance from the knowledge base alongside the classification
- Retrieved entries are cited in the response payload; classification and remediation text come from rules and templates — the app produces no generative LLM answer from retrieved context
- Step-by-step explanation of how the finding was classified, rendered from Python templates (deterministic text assembly, not an LLM response)
- Shows which method was used (rule-based detection vs. ensemble)
- Explains severity assessment with specific reasons
- Reports human review requirements and recommended owner
- Activated via the "Analyze with decision explanation" button
- Session-based memory tracks previous findings in a conversation
- Provides risk summary across the session (severity distribution, categories covered)
- Relates new findings to previous ones for context-aware recommendations
- Configurable session limits and history depth
- Rule-based classification with deterministic pattern matching (reported as fixed high confidence; a rule match does not guarantee the classification is correct)
- Zero-shot classification using multiple transformer models when rules don't apply
- Weighted ensemble voting across models
- Agreement tracking — flags when models disagree for human review
- Pattern detection: Detects instruction override, role hijack, exfiltration attempts
- Encoding evasion: Blocks base64, rot13, unicode escape attempts
- Multilingual injection: Prompt injection security fix implemented for English and non-English languages
- Separator injection: Blocks special tokens like
[INST],<|system|>,---END OF SYSTEM PROMPT--- - PII detection: Catches credit cards, SSNs, emails, AWS keys before processing
- Rate limiting: Prevents abuse with per-client request throttling
- PII masking: Redacts sensitive data from responses
- Unsafe advice blocking: Prevents dangerous recommendations (run as root, disable firewall, commit secrets)
- Heuristic checks for overconfident language: Flags phrases like "guaranteed" or "100% secure" (keyword heuristics only — they do not verify factual accuracy)
- Prompt leakage detection: Prevents the model from revealing system instructions
- Remediation quality validation: Checks that responses include relevant security guidance
flowchart TB
User([User submits\nsecurity finding])
subgraph INPUT["Input Layer"]
V[Input Validation\n6-Layer Defense]
RL[Rate Limiter]
end
subgraph RAG["Retrieval-Assisted Context"]
QE[Query Expansion\nSynonym Loading]
TFIDF["Term Frequency-Inverse\nDocument Frequency Search"]
KW["Keyword Index\nExact Lookup"]
HS["Hybrid Score\n60% TF-IDF + 40% Keyword"]
RR["Reranker\nCategory + Severity Boost"]
KB[("Security Knowledge Base\n20 Entries")]
end
subgraph CLASSIFY["Classification Layer"]
RULE["Rule-Based\nPattern Detector"]
ENSEMBLE["Multi-Model\nEnsemble Classifier"]
SEV["Severity\nAssessor"]
end
subgraph MEMORY["Session Memory"]
MEM[("Conversation Memory\nSession History")]
CTX["Context Builder\nPrevious Findings"]
end
subgraph REASON["Reasoning Layer"]
COT["Decision Explanation\nTemplate-Generated Steps"]
owner["Owner Resolver\nTeam Assignment"]
end
subgraph OUTPUT["Output Layer"]
OF["Output Filter\nPII Mask + Safety Check"]
RESP["Response Builder\nJSON Output"]
end
User --> V
V -->|valid| RL
V -->|invalid| ERR([Error Response])
RL -->|allowed| QE
RL -->|throttled| ERR
QE --> KB
KB --> TFIDF
KB --> KW
TFIDF --> HS
KW --> HS
HS --> RR
RR --> RAG_OUT([Retrieved Context\nTop 3-5 Entries])
RAG_OUT --> RULE
User --> RULE
RULE -->|detected| SEV
RULE -->|alternative path| ENSEMBLE
ENSEMBLE --> SEV
SEV --> COT
RAG_OUT --> COT
MEM --> CTX
CTX --> COT
COT --> OF
OF --> RESP
RESP --> RESULT([Security Assessment\nCategory + Severity + Remediation])
flowchart LR
subgraph QUERY["Query Processing"]
Q[User Query] --> EXP[Query Expansion]
EXP --> |"original + synonyms"| VEC[Vector Encoding]
end
subgraph RETRIEVAL["Hybrid Retrieval"]
VEC --> TFIDF2["TF-IDF Search\nCosine Similarity"]
VEC --> KW2["Keyword Search\nExact Lookup"]
TFIDF2 --> COMBINE["Score Combiner\n0.6 x TF-IDF + 0.4 x Keyword"]
KW2 --> COMBINE
end
subgraph RERANK["Reranking"]
COMBINE --> RR2["Reranker"]
RR2 --> |"category boost"| FINAL["Top-K Results"]
RR2 --> |"severity boost"| FINAL
RR2 --> |"title overlap"| FINAL
end
subgraph CONTEXT["Context Assembly"]
FINAL --> CTX2["Context Builder"]
CTX2 --> |"KB entries"| OUT["Retrieved Context"]
CTX2 --> |"session history"| OUT
end
OUT --> LLM["Ensemble Classifier\nRule Detection or Zero-Shot"]
LLM --> RESULT2["Classification + Remediation"]
flowchart TD
INPUT([User Input])
L1["Layer 1: Pattern Detection\nInstruction Override, Role Hijack"]
L2["Layer 2: Encoding Evasion\nBase64, Rot13, Unicode"]
L3["Layer 3: Multilingual Injection\nPrompt Injection Fix: English + Non-English"]
L4["Layer 4: Separator Injection\nSpecial Tokens, System Prompt Breaks"]
L5["Layer 5: PII Detection\nCredit Cards, SSN, Email, AWS Keys"]
L6["Layer 6: Rate Limiting\nPer-Client Throttling"]
VALID([Valid Input\nProceed to retrieval])
BLOCKED([Blocked\nError Response])
INPUT --> L1
L1 -->|pass| L2
L1 -->|fail| BLOCKED
L2 -->|pass| L3
L2 -->|fail| BLOCKED
L3 -->|pass| L4
L3 -->|fail| BLOCKED
L4 -->|pass| L5
L4 -->|fail| BLOCKED
L5 -->|pass| L6
L5 -->|fail| BLOCKED
L6 -->|pass| VALID
L6 -->|fail| BLOCKED
flowchart TD
INPUT2([Generated Response])
M1["PII Masking\nRedact Sensitive Data"]
M2["Unsafe Advice Blocking\nRun as Root, Disable Firewall"]
M3["Overconfident-Language Check\nFlags: Guaranteed, 100% Secure"]
M4["Prompt Leakage Detection\nSystem Instructions Leak"]
M5["Remediation Quality Check\nCategory-Specific Keywords"]
SAFE([Safe Output\nReturned to User])
FILTERED([Filtered Output\nIssues Flagged])
INPUT2 --> M1
M1 --> M2
M2 --> M3
M3 --> M4
M4 --> M5
M5 -->|all pass| SAFE
M5 -->|issues found| FILTERED
flowchart TB
subgraph CURRENT["Current: Single-Agent Gradio App"]
G["Gradio UI"]
A["Agent Core\nRetrieval + Classification"]
KB2[("Local JSON\nKnowledge Base")]
G --> A --> KB2
end
subgraph EXTENDED["Extended: Production Cloud Deployment (planned)"]
direction TB
subgraph INGEST["Ingestion Layer"]
CI["CI/CD Scanner\nGitHub Actions"]
IAC["Infrastructure-as-Code\nScanner"]
TICKET["Ticketing System\nJira, ServiceNow"]
ALERT2["Alert Manager\nPagerDuty, OpsGenie"]
end
subgraph PROCESS["Processing Layer"]
API["API Gateway\nRate Limiting + Auth"]
QUEUE["Message Queue\nSQS, Kafka, RabbitMQ"]
WORKER["Worker Pool\nMultiple Agent Instances"]
end
subgraph STORE["Storage Layer"]
VDB[("Vector Database\nPinecone / Weaviate / pgvector")]
RDB[("Relational Database\nPostgreSQL")]
CACHE2[("Cache\nRedis")]
OBJ[("Object Storage\nS3 / GCS / Azure Blob")]
end
subgraph RETRIEVE["Retrieval Layer"]
EMBED["Embedding Service\nSentence Transformers"]
RAG2["Retrieval Pipeline\nHybrid Search"]
RERANK2["Reranker\nCross-Encoder"]
end
subgraph OUTPUT3["Output Layer"]
DASH["Dashboard\nGrafana / Datadog"]
NOTIFY["Notification Service\nEmail, Slack, Webhook"]
AUDIT["Audit Log\nCompliance Trail"]
end
end
CI --> API
IAC --> API
TICKET --> API
ALERT2 --> API
API --> QUEUE
QUEUE --> WORKER
WORKER --> EMBED
EMBED --> VDB
VDB --> RAG2
RAG2 --> RERANK2
WORKER --> RDB
WORKER --> CACHE2
WORKER --> OBJ
RERANK2 --> DASH
RERANK2 --> NOTIFY
RERANK2 --> AUDIT
style CURRENT fill:#e8f5e9
style EXTENDED fill:#e3f2fd
The targets below are design options. The repository currently ships no Dockerfile, compose file, or cloud deployment artifacts — Hugging Face Spaces is the deployed target.
flowchart LR
subgraph AWS["Amazon Web Services"]
ECS["ECS Fargate\nServerless Containers"]
LAMBDA["Lambda\nEvent-Driven"]
S3AWS["S3\nObject Storage"]
DYNAMO["DynamoDB\nNoSQL"]
SQS["SQS\nMessage Queue"]
SECRETSM["Secrets Manager\nCredential Storage"]
end
subgraph GCP["Google Cloud Platform"]
GKE["GKE Autopilot\nManaged Kubernetes"]
CF["Cloud Functions\nServerless"]
GCS["Cloud Storage\nObject Storage"]
FIRESTORE["Firestore\nNoSQL"]
PUBSUB["Pub/Sub\nMessage Queue"]
SECRETGM["Secret Manager\nCredential Storage"]
end
subgraph AZURE["Microsoft Azure"]
AKS["AKS\nManaged Kubernetes"]
AF["Azure Functions\nServerless"]
BLOB["Blob Storage\nObject Storage"]
COSMOS["CosmosDB\nNoSQL"]
SB["Service Bus\nMessage Queue"]
KV["Key Vault\nCredential Storage"]
end
subgraph AGENT["Agent Deployment"]
GRADIO["Gradio App\nCurrent State"]
DOCKER["Docker Container\nPortable"]
K8S["Kubernetes\nOrchestrated"]
SERVERLESS["Serverless\nAuto-Scaling"]
end
GRADIO --> DOCKER
DOCKER --> K8S
DOCKER --> SERVERLESS
K8S --> ECS
K8S --> GKE
K8S --> AKS
SERVERLESS --> LAMBDA
SERVERLESS --> CF
SERVERLESS --> AF
sequenceDiagram
participant User
participant Validation as Input Validation
participant RAG as Retrieval Pipeline
participant KB as Knowledge Base
participant Classify as Classifier
participant Memory as Session Memory
participant CoT as Decision Explanation
participant Filter as Output Filter
participant Response as Response
User->>Validation: Submit security finding
Validation->>Validation: Layer 1-6 checks
alt Invalid input
Validation-->>User: Error response
else Valid input
Validation->>RAG: Forward finding
RAG->>RAG: Expand query with synonyms
RAG->>KB: TF-IDF + Keyword search
KB-->>RAG: Top 3-5 entries
RAG->>RAG: Rerank with category boost
RAG-->>Classify: Retrieved context
Classify->>Classify: Rule detected?
alt Recognized
Classify->>Classify: Category + Severity
else Alternative path
Classify->>Classify: Multi-model ensemble
end
Classify->>Memory: Store result
Memory-->>Classify: Session context
Classify->>CoT: Classification + Context
CoT->>CoT: Render explanation from templates
CoT-->>Filter: Full assessment
Filter->>Filter: PII mask + safety check
Filter-->>Response: Filtered result
Response-->>User: JSON assessment
end
flowchart TB
subgraph AGENT["Agent Request Processing"]
REQ([Incoming Request])
V["Input Validation"]
RAG2["Retrieval Pipeline"]
CLS["Classifier"]
OUT["Output Filter"]
RESP([Response])
REQ --> V --> RAG2 --> CLS --> OUT --> RESP
end
subgraph OBS["Observability Layer"]
direction LR
subgraph LOGGING["Logging"]
LOG structured["Structured JSON Logs"]
LOG trace["Trace ID per Request"]
LOG perf["Performance Timings"]
end
subgraph METRICS["Metrics Collection"]
M_req["Request Counters\nby Category, Severity, Method"]
M_val["Validation Blocks\nby Reason"]
M_rag["Retrieval Scores"]
M_ens["Ensemble Disagreements"]
M_time["Response Time\nAvg, P95, P99"]
M_err["Error Counters"]
end
subgraph HEALTH["Health Checks"]
H_status["Service Status\nhealthy / degraded / unhealthy"]
H_error["Error Rate Check"]
H_block["Block Rate Check"]
H_perf["Performance Check"]
end
end
subgraph DASHBOARD["Dashboard Layer"]
GRADIO["Gradio UI\nMetrics Panel"]
PROM["Prometheus\nMetrics Export (planned)"]
GRAF["Grafana\nDashboards (planned)"]
ALERT["Alerting\nPagerDuty / Slack (planned)"]
end
V -->|"validation events"| M_val
RAG2 -->|"retrieval scores"| M_rag
CLS -->|"classification results"| M_req
CLS -->|"disagreement events"| M_ens
OUT -->|"filter issues"| M_val
REQ -->|"timing"| M_time
REQ -->|"errors"| M_err
M_req --> GRADIO
M_req --> PROM
M_time --> PROM
M_err --> PROM
PROM --> GRAF
PROM --> ALERT
H_error --> M_err
H_block --> M_val
H_perf --> M_time
style OBS fill:#fff3e0
style DASHBOARD fill:#e8f5e9
sequenceDiagram
participant User
participant Agent
participant Timer as Performance Timer
participant Metrics as Metrics Store
participant Logs as Structured Logger
participant Health as Health Checker
participant Dashboard as Dashboard
User->>Agent: Submit finding
Agent->>Timer: Start timing
Agent->>Agent: Input validation
Agent->>Metrics: Record validation result
Agent->>Agent: Knowledge-base retrieval
Agent->>Metrics: Record retrieval scores
Agent->>Agent: Classification
Agent->>Metrics: Record category, severity, method
Agent->>Agent: Output filtering
Agent->>Metrics: Record filter issues
Agent->>Timer: Stop timing
Timer->>Metrics: Record response time
Timer->>Logs: Log operation + duration
Agent->>Logs: Log full request trace
Agent-->>User: Return assessment
Dashboard->>Metrics: Query metrics
Metrics-->>Dashboard: Return aggregated data
Dashboard->>Health: Check health status
Health->>Metrics: Read error rates, block rates
Health-->>Dashboard: Return health status
| Metric | Type | Description |
|---|---|---|
| requests_total | Counter | Total number of processed findings |
| requests_by_category | Breakdown | Requests grouped by security category (IAM, Network, Container, Secrets, Data) |
| requests_by_severity | Breakdown | Requests grouped by severity (critical, high, medium, low) |
| requests_by_method | Breakdown | Requests grouped by classification method (rule_match, ensemble) |
| validation_blocks_total | Counter | Total input validation rejections |
| validation_blocks_by_reason | Breakdown | Blocks grouped by reason (prompt_injection, pii_detected, rate_limit) |
| output_filter_issues_total | Counter | Total output filter issues found |
| output_filter_issues_by_type | Breakdown | Issues grouped by label (unsafe advice, overconfident language, prompt leakage) |
| rag_retrievals_total | Counter | Total knowledge-base retrievals performed |
| rag_retrieval_scores | Histogram | Individual retrieval relevance scores |
| ensemble_disagreements_total | Counter | Times ensemble models disagreed |
| human_review_required_total | Counter | Findings flagged for human review |
| errors_total | Counter | Total errors encountered |
| response_times_ms | Histogram | Individual request response times |
| avg_response_time_ms | Gauge | Average response time across all requests |
| p95_response_time_ms | Gauge | 95th percentile response time |
| p99_response_time_ms | Gauge | 99th percentile response time |
flowchart TD
START([Health Check Request]) --> ERR[Calculate Error Rate]
ERR --> ERR_CHECK{Error Rate > 10%?}
ERR_CHECK -->|Yes| DEGRADED1[Status: degraded\nReason: high error rate]
ERR_CHECK -->|No| PERF[Check Response Time]
PERF --> PERF_CHECK{Avg Response Time > 5000ms?}
PERF_CHECK -->|Yes| DEGRADED2[Status: degraded\nReason: slow response time]
PERF_CHECK -->|No| BLOCK[Check Block Rate]
BLOCK --> BLOCK_CHECK{Block Rate > 50%?}
BLOCK_CHECK -->|Yes| DEGRADED3[Status: degraded\nReason: high block rate]
BLOCK_CHECK -->|No| HEALTHY[Status: healthy\nAll checks passed]
DEGRADED1 --> RESULT([Return Health Status])
DEGRADED2 --> RESULT
DEGRADED3 --> RESULT
HEALTHY --> RESULT
The advisor evaluates a submitted finding with layered controls:
- Input validation blocks prompt injection, PII, and off-topic inputs before processing.
- Severity rules identify known high-risk indicators, including public exposure, wildcard permissions, root access, privileged containers, and committed secrets.
- Ensemble classification uses rule matching first, then falls back to multi-model zero-shot classification with weighted voting.
- Retrieval-assisted context pulls relevant remediation guidance from the security knowledge base and cites it in the response; no LLM answer is generated from it.
- Output filtering masks PII, blocks unsafe advice, and validates response quality with heuristic checks.
- Structured decision explanation renders a transparent, template-generated explanation for every classification decision.
High- and critical-severity results, and results below the confidence threshold, require human review. Rule matching is deterministic, but a deterministic match does not guarantee a correct classification, and confidence values are heuristics rather than accuracy guarantees. Automation is disabled by design. Teams must validate recommendations against their environment, change-management process, and approved security policies before acting.
- An engineer submits: “The production security group allows SSH from
0.0.0.0/0.” - The advisor categorizes the issue as Network, marks it critical, assigns it to Cloud Platform, and recommends restricting ingress to approved, trusted access paths.
- The assigned team validates the exposure, remediates through infrastructure-as-code, and runs the normal deployment and verification process.
- The result is recorded in the ticket or change record, including the decision and evidence of remediation.
- Shorter mean time to classify and remediate platform-security findings.
- Fewer production risks caused by insecure infrastructure defaults.
- Lower interruption load on Platform Engineering, SRE, and Security teams.
- More consistent remediation evidence for audits and compliance reviews.
- Better developer experience through clear self-service security guidance.
- Python 3.10 or later
- Internet access for the initial download of the Hugging Face model
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
python app.pyOpen the local Gradio address shown in the terminal, normally http://127.0.0.1:7860.
docker compose up --buildOpen http://127.0.0.1:7860. The image and Compose service run as UID/GID
10001:10001. Compose drops Linux capabilities, prevents privilege escalation,
and uses a read-only root filesystem. Temporary uploads use /tmp; model caches
use a writable named volume. AWS credentials and local exports are excluded from
the build context and do not need to be mounted.
The first build downloads Python dependencies and CPU-only PyTorch; model
fallback may download large model weights on first use. Dependencies currently
follow requirements.txt and are not locked to exact versions.
Verify the runtime identity with docker compose exec advisor id. Stop with
docker compose down; the model cache remains for the next run.
Open Upload scanner export (JSON), select security_hub, and upload the
JSON output of aws securityhub get-findings. Use Preview import scope to
review accounts, regions, finding states, and rejected rows before analysis.
AWS evidence and native severity are retained separately from advisor results.
No cloud credentials are required by the app.
Try the sanitized sample export, then follow the AWS import guide for export commands, status handling, limits, and coverage caveats. Limits are 1 MB and 500 source records; existing per-finding validation and rate limits still apply.
pip install pytest
python -m pytest tests/ -v.
├── app.py # Gradio UI and Hugging Face Space entrypoint
├── requirements.txt # Runtime dependencies
├── data/
│ └── security_kb.json # Security knowledge base (20 entries)
├── src/
│ ├── __init__.py
│ ├── ensemble.py # Multi-model ensemble classifier
│ ├── retriever.py # TF-IDF + keyword hybrid retriever
│ ├── memory.py # Conversation memory and session state
│ ├── chain_of_thought.py # Template-based decision explanation generator
│ ├── input_validation.py # 6-layer prompt injection defense
│ ├── output_filter.py # PII masking, unsafe advice blocking, language heuristics
│ └── observability.py # Logging, metrics, tracing, health checks
├── tests/
│ ├── test_pipeline.py # Unit tests across all modules
│ └── test_assessment_integration.py # End-to-end tests through the Gradio UI
└── .github/workflows/ # CI/CD workflows
- Lock container dependencies and add automated image vulnerability scanning.
- Export metrics in Prometheus format and ship Grafana dashboards.
- Multi-cloud deployment templates (AWS, GCP, Azure) beyond the current HF Spaces deployment.
- Add policy-as-code and approved organizational standards as grounded context.
- Integrate with CI/CD, infrastructure-as-code scanners, ticketing, and alert-management tools.
- Include asset criticality, environment, and service ownership in risk prioritization.
- Add test suites and evaluation datasets to measure recommendation accuracy and false positives.
- Create audit-ready records for findings, approvals, exceptions, and remediation outcomes.
- Keep infrastructure access read-only by default.
- Do not expose secrets or sensitive customer data to the model.
- Require human approval for production changes and risk exceptions.
- Log recommendations, decisions, and policy sources for traceability.
- Review accuracy, false positives, and security controls before expanding adoption.