# Security policy

`pi-news-api` is a Pi extension that fetches news from the Currents News API
and injects a hidden research prompt when the user selects a story.

## Security posture

This package aims to stay:

- explicit about what it does
- free of hard-coded secrets
- conservative about persistence
- honest about API and runtime limitations

## What this package does

Security-relevant behavior:

- calls the Currents News API (`https://api.currentsapi.services`) over HTTPS
  using a key read from the `CURRENTS_API_KEY` environment variable
- sends the key only as an `Authorization: Bearer <key>` header, never as a
  URL query parameter
- stores enabled-category, language, and bounded interest-aggregate state in
  `~/.config/pi-news-api/config.json`, with legacy Pi custom session entries
  used only for migration/fallback
- stores search topic/count/timestamp and inferred-category aggregates for
  personalization, but not raw article history, titles, URLs, or API keys
- never uploads raw topic history, counts, timestamps, or interest weights as a
  profile; explicit search queries and the resulting category filters still go
  to Currents as required for API requests
- keeps detailed topic history out of agent-tool results; users inspect it
  locally through `/news_interests`
- injects a hidden user-style message when `/news_menu` or `/news_search` is
  used to queue a deep-dive research turn
- renders a live widget above the editor in Pi

## What this package does not do

- three documented LLM-callable news tools with no shell or filesystem access
- no shell execution
- no local file writes outside normal npm/package files except
  `~/.config/pi-news-api/config.json` for category/language/interest preferences
- never writes `CURRENTS_API_KEY` to disk, config files, or logs
- no telemetry or analytics

## Reporting a vulnerability

If you discover a security issue, report it privately to the maintainer
before opening a public issue. Include:

- package version
- Pi version
- affected command or code path
- reproduction steps (omit your `CURRENTS_API_KEY`)
- impact assessment

## Areas worth reviewing carefully

- category/language persistence in `~/.config/pi-news-api/config.json`
- interest-profile minimization, retention bounds, and clear/disable controls
- `CURRENTS_API_KEY` handling in the HTTP client (`callCurrentsApi`) — it
  must never end up in a URL, log line, or persisted file
- hidden prompt injection for deep-dive workflows
- agent-tool result handling for untrusted article titles, summaries, authors,
  categories, and URLs
- Currents JSON response parsing for malformed or unexpected payloads
- package-install trust signals and published file set

## Secrets handling expectations

- do not commit tokens, cookies, or API keys
- do not add telemetry or analytics without explicit documentation
- keep the package dependency surface small and review changes before
  publishing
