GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - aws-samples/sample-security-radar: Security Radar: from security headlines to the exact line in your code — trigger for AWS Security Agent and AWS Continuum, with AWS WAF / DNS Firewall mitigation until the patch ships

BranchesTags
Open more actions menu

Latest commit

 

History

28 Commits
28 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
docs
docs
 
 
infra
infra
 
 
integrations
integrations
 
 
schemas
schemas
 
 
scripts
scripts
 
 
src/radar
src/radar
 
 
tests
tests
 
 
ui
ui
 
 
.gitignore
.gitignore
 
 
.gitleaks.toml
.gitleaks.toml
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
NOTICE
NOTICE
 
 
README.md
README.md
 
 
README_CN.md
README_CN.md
 
 
SECURITY.md
SECURITY.md
 
 
mutations.txt
mutations.txt
 
 
pyproject.toml
pyproject.toml
 
 
uv.lock
uv.lock
 
 

Repository files navigation

Security Radar logo

Security Radar

The trigger for AWS Security Agent and AWS Continuum: a security headline from the outside world →
the exact line in your code → a validated patch delivered as a pull / merge request —
and, until that patch ships, a virtual patch at the edge with AWS WAF and Route 53 Resolver DNS Firewall.

License: MIT-0 AWS CDK Preview

中文说明

Preview notice. This sample calls AWS Continuum code scanning, which is in public preview. APIs and behaviour may change. Use a non-production AWS account.

What's new in v1.6

Full list in CHANGELOG.md. A walkthrough deck: https://aws-samples.github.io/sample-security-radar/.

Area What changed
Briefs Rewritten only when a fact the code decided changed (severity, exploitation, CVEs, amount): ~203 → ~10 a day on a 7-day replay
Summaries A brief sentence that contradicts the code's CVEs, exploitation or amount does not become the summary or the P0 notice line
Duplicate judge Candidates that can be duplicates only (51,404 → 599); quality measured without labelling — the labelled corpus and delayed truth — on #/ops
GitHub advisories A GHSA id is an identifier: a P0 is sent with it before a CVE exists, and the GHSA event is linked to the CVE's (global, repository and unreviewed advisories)
Sources VulnCheck, ProjectDiscovery, CERT/CC, ZDI advisories, GreyNoise, Tenable Research (225 in all)

What it is

Attacks on exchanges and DeFi protocols move fast: hot-wallet key leaks and contract exploits are often used within minutes of disclosure. AWS Security Agent and AWS Continuum can review code, prove exploitability and write patches — but they do not know what just happened outside, which line of your code it touches, or when a paid scan is worth it.

Security Radar is the source of that chain. It tracks the outside security world — more than 200 public sources: CISA KEV and CSAF advisories, the CVE List itself, vendor PSIRTs and CERTs, AWS security bulletins, security and crypto media, Web3 incident databases, exchange announcement boards, public Telegram channel previews and WeChat official-account feeds (an X source is available but off by default) — decides in code what is real and what is urgent, and when an event matches your code it pulls the trigger:

  1. AWS Security Agent — the radar writes the event as a security requirement in the requirement pack, which your own code reviews use (the radar starts no review per event by default, and a review never fixes on its own).
  2. AWS Continuum — the radar submits a finding pinned to the file and line and asks for validation; once Continuum proves the issue exploitable it produces a patch and opens a native pull request (GitHub) or merge request (GitLab).
  3. A human reviews and merges.

Patching takes hours to days; exploitation of a fresh disclosure can take minutes. So the radar also mitigates what it located, on resources it owns, in a non-blocking mode until a human promotes it (see Fast path below).

Respond loop: radar → AWS Security Agent + AWS Continuum

What it looks like

Security Radar wall: radar sweep, live feed and Web3 losses

The wall (#/wall): radar sweep of the last 24 h, the live feed, what needs a human now, Web3 losses by protocol and chain. Captured from the author's deployment on 2026-10-28, before v1.2.0 (UI text is Chinese; every page also has a light theme).

Home — posture, NOW, lifecycleWeb3 incidents
Home pageWeb3 incidents page
Event detail — in your environment: located to the line, Security Agent + Continuum timelineSources — health of every collector
Event detail, in your environmentSources page

Key mechanisms

Mechanism What it means
Decisions in code, not in an LLM De-duplication, independent-source counting, verification level V0–V4, severity P0–P2, version comparison and IOC matching are deterministic code. An LLM (Amazon Bedrock) only writes sentences, each with citations that code checks (citation exists, every number appears in the cited text).
Located to the line A pinned vulnerable version or an IOC (address, key) found in your repository becomes a finding with file and line, e.g. Dockerfile:1, composer.json:8, .gitlab-ci.yml:2. When the version cannot be compared, the radar says so and leaves it to Security Agent.
On-chain evidence For Web3 incidents the attack transaction is checked on a public RPC node (eth_getTransactionReceipt); a successful transaction raises the event to corroborated. Young incidents are reconstructed from public JSON-RPC (ERC-20 outflows, issuer freezes), and each verified attack transaction is broken down per token.
Clustering that is measured One incident, many reports: reports are merged by hard links (CVE, transaction, cited article) and by the victim's name — a name is evidence for the event it names, not for every event whose coverage mentions it. A single misplaced report can be moved (scripts/move_item.py) and stays where it was put.
It reports its own mistakes An event that changes shape within one cycle, a station that fails every run or stopped running, a source that is not collected or went quiet are items on the ops page; five Amazon CloudWatch alarms notify the owner through Amazon SNS. Published → held and became P0 → push latency are measured every cycle.
One response decision table Every response action (review, finding, scan, patch delivery, notification, mitigation) is decided by one table in code; each event page shows the outcome, the reason code and the time, and "not evaluated" looks unlike "not fired".
Three code hosts, one chain Each target lives in exactly one Continuum environment: S3 (patch artifacts), GitHub (native PRs) or GitLab (native MRs). Adding a host is one row in respond.REPO_CHANNELS, one adapter in scripts/sync-fleet.py and one integration.
Cost guardrails A scan is requested only to validate radar findings that were submitted successfully, at most once per environment per 24 h, with scheduled scans off. A daily budget line is flagged on the ops page, never silently enforced.
Operator view Daily 08:00 HKT digest (code picks and counts, the LLM writes cited sentences), advisory "possible duplicate" hints, an ops page listing what needs a human, search over every event ever published, and an exchange announcement board.
Notifications Subscriptions per channel (Slack channel / DM, Lark chat / DM, a signed webhook) with filters and message kinds, sent by their own station after Publish; Atom / JSON feeds of the published events. Configure with scripts/set-notify.sh, or let a token client register its own webhook (below).

Fast path: mitigate until the patch ships

A mitigate station runs after the respond step. It acts only on targets the radar or the AWS agents found affected and only writes resources the radar created (IAM scopes every write to them). A mitigation is not a fix — every surface says so.

Channel Where the plan comes from (code) What the radar does What a human does
AWS WAF The AWS Managed Rules changelog parsed into CVE → rule group / rules / minimum version; then the product (PHP, WordPress); then the weakness class (CWE — advisory only) Adds the managed rule group to the radar's web ACL with the rules in Count, and checks it (group overridden to Count? pinned to a version that predates the CVE?) scripts/promote.py waf … to Block — the promotion records the rules it approves, and the rule keeps blocking exactly those; what later events add stays in Count and is reported. The radar never demotes
Route 53 Resolver DNS Firewall Domain indicators written in defanged form in the evidence (evil[.]com) + the AWS-managed threat lists; major platforms are never blocked Writes the radar's domain list; rules in ALERT promote.py dns … to BLOCK — an approved rule keeps its approved domains; later ones wait in ALERT
Amazon Inspector Target lockfiles → CycloneDX SBOM → ScanSbom (stateless, nothing enabled in the account, at most once per target per day) Per-target dependency baseline; intersects event CVEs with it Upgrade through the PR / MR channel
AWS Security Hub (opt-in) One ASFF finding per event × affected target, with the fix version and every mitigation's state Imports on change, archives when no longer affected Triage next to GuardDuty / Inspector findings

For each event the radar also builds a WAF rule pack: custom rules taken from verbatim features of a pinned nuclei template or of an evidence sentence, checked by an offline matcher, with the capacity read from the read-only CheckCapacity call, rendered as wafv2 JSON, CloudFormation, Terraform and AWS CLI text for a human to apply — the radar does not apply a rule pack itself.

Inspector judges language packages, not runtimes (a PHP or Node.js version pin is judged by the radar's own product registry). End-to-end checks: scripts/waf-e2e.py, scripts/dns-e2e.py, scripts/securityhub-check.py.

Agent access and subscriptions

The UI stays read-only. Agents and scripts read the same published documents through a token-gated API; the only write it offers is a subscriber's own webhook rows.

  • Token. The operator issues one Amazon Cognito app client per consumer (client-credentials grant, scope radar/read, one-hour tokens) and hands over the 0600 file it writes — the secret is never printed:
    AWS_PROFILE=<profile> uv run python scripts/radar-token.py create <name> [--subscribe]
    AWS_PROFILE=<profile> uv run python scripts/radar-token.py list
    AWS_PROFILE=<profile> uv run python scripts/radar-token.py revoke <name> --yes
    AWS_PROFILE=<profile> uv run python scripts/radar-token.py usage --days 7   # who read how much
    The file holds RADAR_URL, RADAR_TOKEN_URL (https://<domain-prefix>.auth.<region>.amazoncognito.com/oauth2/token, stack output ApiTokenUrl), RADAR_CLIENT_ID and RADAR_CLIENT_SECRET. A revoked client gets no new token; one it holds expires within the hour.
  • What it reads. GET <site>/api/data/* — CloudFront sends /api/* to an Amazon API Gateway REST API whose Cognito authorizer checks signature, expiry and scope; one Lambda reads data/* of the site bucket. Every document is listed in ui/public/llms.txt and described by schemas/site-data.schema.json.
  • CLI and MCP server (src/radar/agentkit/, standard library only; credentials from the environment, never sent across a redirect):
    set -a; source ~/.config/security-radar/clients/<name>.env; set +a   # the file radar-token.py wrote
    uv run python -m radar.agentkit.cli recent_events --severity P0 --hours 24
    uv run python -m radar.agentkit.cli cve_status --cve CVE-2026-12345
    uv run python -m radar.agentkit.cli --list
    The same tools (recent_events, get_event, search_events, cve_status, rule_pack, health, feeds) as a stdio MCP server — no port is opened:
    {"mcpServers": {"security-radar": {"command": "uv", "args": ["run", "--directory", "<radar checkout>", "python", "-m", "radar.agentkit.mcp"],
      "env": {"RADAR_URL": "https://<your radar site>"}}}}
    The skill for coding agents is integrations/skill/security-radar/SKILL.md.
  • Self-registered webhooks. A client issued with --subscribe (scope radar/subscribe) can list, add and remove its own https webhooks; another client's subscriptions are "not found". The signing secret goes to a 0600 file; verify X-Radar-Signature with it. Kept out of the agent tools — registering an endpoint is a person's decision:
    uv run python -m radar.agentkit.subscriptions add --target https://<your-endpoint> --filters '{"severity": ["P0"], "kinds": ["p0", "update", "digest"]}'
    uv run python -m radar.agentkit.subscriptions list
    uv run python -m radar.agentkit.subscriptions remove --id <id>
  • Message kinds (kinds filter): p0, update (the P0 thread follows the event; one correction when it is merged away or withdrawn), waf, verdict, pr, digest (the daily digest, only when listed). Event filters: severity, domain, cves, exploitation, min_level, min_loss_usd. Operator channels add lark_dm (a person by open_id or e-mail). The #/subscribe page lists feeds, webhooks and agent access.

Architecture

Security Radar architecture

Serverless on AWS, a 5-minute cycle: EventBridge → Step Functions (plan → collect → process → analyze → respond → mitigate → publish → notify) → Lambda + DynamoDB + S3 → CloudFront. Collection is incremental and batched; a cycle that finds the previous one still running skips itself. CloudWatch alarms → SNS → a small Lambda that tells the owner. Agents read through Amazon API Gateway (/api/*, Amazon Cognito tokens). AWS Security Agent runs in the radar's Region; AWS Continuum runs in us-east-1.

Path Content
src/radar/ Parsers and the source registry, pipeline (normalize → cluster → verify → score), analyst, respond / mitigate / notify stations, the response decision table, rule packs, on-chain checks, digest, ops rules, self-monitoring, the read / subscribe API, the agent kit (agentkit/)
scripts/ Deploy / verify / destroy, the deploy guard (preflight.py, site_diff.py), source onboarding, promotion, repair tools (move_item.py, recluster_web3.py), token access (radar-token.py), recovery (restore.py)
infra/ AWS CDK (Python): three stacks — radar + Security Agent + DNS Firewall demo VPC in ap-northeast-1; Continuum side and the WAF demo (a web ACL in front of a CloudFront distribution that refuses every request) in us-east-1
integrations/continuum/targets/ Deliberately vulnerable demo repositories used as scan targets (see below)
ui/ React 18 + Vite + TypeScript; ui/mock-data/ for local development only
tests/, mutations.txt pytest (fixtures recorded once, no network) and a mutation registry proving each guard's test fails when the guard is removed

Deploy

Prerequisites: a non-production AWS account; AWS Continuum code scanning (preview) available in the account; AWS Security Agent in ap-northeast-1; Amazon Bedrock access to Anthropic Claude Sonnet / Haiku; CDK bootstrapped in ap-northeast-1 and us-east-1; uv, Node.js ≥ 22, AWS CLI v2.

git clone https://github.com/aws-samples/sample-security-radar.git && cd sample-security-radar
export AWS_PROFILE=<non-production-profile>
./scripts/deploy-all.sh                          # preflight → build → three CDK stacks → arm the UI gate → upload UI → one cycle → verify → compare the site
STAGE=demo ./scripts/deploy-all.sh               # an isolated copy (every name carries the stage)
STAGE=demo ./scripts/verify.sh                   # PASS/FAIL acceptance + integration coverage
STAGE=demo ./scripts/destroy-stage.sh            # remove that copy

Deleting the stack keeps one role: the Amazon API Gateway CloudWatch Logs role (ReadApi/CloudWatchRole, policy AmazonAPIGatewayPushToCloudWatchLogs). It is an account-level API Gateway setting that other APIs in the same account and Region may rely on; delete it yourself if none does.

Optional channels: GitHub PRs (uv run python scripts/sync-fleet.py --channel github --apply, then authorize the AWS Continuum GitHub App once and set github_repo in infra/cdk.json) and GitLab MRs (--channel gitlab, with a personal access token in ~/.env; set gitlab_project, and gitlab_url for a self-managed instance reachable by Continuum).

Optional notifications: put the bot credentials and channel ids in ~/.env and run scripts/set-notify.sh (it writes one AWS Secrets Manager secret; values never appear on a command line). The alarms use the owner's subscription.

Optional GHSA → CVE linking: create a read-only, fine-grained GitHub token (public repositories, no permissions), put it in ~/.env as GITHUB_ADVISORY_TOKEN and run scripts/set-ghsa-token.sh (it writes the GhsaLookupToken secret; the value never appears on a command line). Without it the step records not_configured and the rest runs as usual.

Optional: AWS Security Hub export with -c security_hub=on (an account-wide service — enabled without any default standards; off by default in this sample).

Costs. AWS Continuum code scanning bills per inference unit — see the AWS Continuum pricing page; scans are the dominant cost, which is why the radar scans only to validate its own findings. Bedrock, Lambda, DynamoDB, S3 and CloudFront costs are small for one deployment. The fast path adds roughly $10–15 a month (web ACL $5 + $1 per rule, ScanSbom $0.03 per call, DNS Firewall $0.60 per million queries). Destroy demo stages when you are done.

⚠️ Deliberately vulnerable demo code

integrations/continuum/targets/ contains small repositories that are vulnerable on purpose (an unpatched PHP runtime, a smart contract that trusts a well-known public test key, a Node.js runtime with a known decompression flaw). They exist only as scan targets for the demo. Do not deploy them, and do not reuse any key or address from them.

Notes on data sources and access

  • Feeds are fetched from their public endpoints and respect each publisher's terms. The X source is off by default: set X_SEARCH_URL and X_API_KEY to a data source you are licensed to use, then enable it in src/radar/registry.py.
  • Every source in the registry was admitted by scripts/source-onboard.py (fetched from the deployment's AWS egress and read by the production parser). Telegram channels are read from their public preview pages; WeChat official-account articles are read through the third-party RSS service wechat2rss.xlab.app — review whether those fit your use before you keep them enabled (python -m radar.registry --explain lists every source).
  • Optional paid fallback: with a FIRECRAWL_API_KEY configured, a blocked feed fetch is retried once through the Firecrawl API — the feed URL is sent to api.firecrawl.dev (capped per source per day) and the source is marked degraded. Without a key nothing is sent there.
  • Test fixtures were recorded once; third-party news text is reduced to title, link, date and one sentence (see NOTICE).
  • The UI is gated with HTTP Basic Auth at CloudFront (credential generated into AWS Secrets Manager). This is a demo gate, not an identity system — for anything beyond a demo, put the site behind Amazon Cognito or AWS IAM Identity Center. /api/* is not behind that gate: it answers only a valid Amazon Cognito token with the right scope.

Security considerations

Before you run this beyond a demo account, review these three points.

  • Access logs hold reader IPs. Amazon CloudFront standard logs (site requests: client IP, user agent, path; no cookies, no headers) go to a private bucket and are deleted after 30 days (ACCESS_LOG_DAYS in infra/stack.py). Amazon API Gateway access logs (client IP, method, path, status) are kept in Amazon CloudWatch Logs for one month. Shorten or extend both to match your own privacy and retention policy, and say so to the people who use the site.
  • Put AWS WAF in front of the site and the API in production. The sample deploys no web ACL of its own. The CloudFront distribution and the API Gateway stage are both reachable from the internet; the execute-api URL can be called directly, not only through CloudFront. Every data route sits behind the same Amazon Cognito authorizer either way, and the stage is throttled (20 requests/s, burst 40), but a web ACL with the AWS managed rule groups and a rate rule on both entry points is the production baseline.
  • Self-service webhooks are off until you turn them on. A signed-in client can register an https webhook, but the notify station sends nothing to it while the notification config says "rollout": "owner_only" (the default); only subscriptions marked owner: true receive messages. The radar checks that a target is https on port 443 with a DNS name that resolves to public addresses — it does not verify that the caller owns that endpoint. Before you set "rollout": "all", decide who may sign in and add an ownership check (for example a confirmation request) if clients outside your team can register.

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file. Third-party test fixtures are listed in NOTICE.

Disclaimer

This is sample code for demonstration and education. It is not intended for production use as is. You are responsible for testing, securing and optimizing it for your own requirements and for complying with the terms of every data source you connect.

About

Security Radar: from security headlines to the exact line in your code — trigger for AWS Security Agent and AWS Continuum, with AWS WAF / DNS Firewall mitigation until the patch ships

Topics

amazon-inspectorawsaws-cdkaws-continuumaws-security-agentaws-security-hubaws-wafroute53-resolver-dns-firewallsample-codesecurityserverlessthreat-intelligenceweb3-security

Resources

Readme
MIT-0 license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

9 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

Generated from amazon-archives/__template_MIT-0
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.