Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
assets/** binary
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.webp binary
*.ico binary
*.woff binary
*.woff2 binary
*.ttf binary
*.otf binary
*.pdf binary
*.zip binary
*.tgz binary
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 5
groups:
dev-dependencies:
dependency-type: "development"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
5 changes: 5 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,11 @@ Every PR MUST have a corresponding devlog entry in `devlog/{YYYY-MM-DD_short-tit
- `WORKLOG.md` should be updated **DURING** and **AFTER** implementation
- Devlog files are committed alongside code changes — not as a separate afterthought

**Bot-managed branches** (e.g., `dependabot/*`) are exempt from the branch-naming and
devlog requirements above — they cannot follow human conventions, so
`scripts/ci/check-pr.sh` skips those checks for them. The changelog/version check
still applies.

See `devlog/README.md` for templates and naming conventions.

### 5.1.3 Problem Discovery & Fix Reporting (MANDATORY)
Expand Down
42 changes: 42 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Security Policy

`opencode-acp` is an OpenCode plugin that manages conversation context for the model.
Because the plugin runs inside an OpenCode session, a defect here could affect any session
that loads it, so we take reports seriously.

## Supported Versions

We apply security fixes to the current npm release lines:
[`opencode-acp@stable`](https://www.npmjs.com/package/opencode-acp) (the recommended
install per the README) and [`opencode-acp@latest`](https://www.npmjs.com/package/opencode-acp).
Older releases receive critical security fixes only when they can be backported cleanly.

## Reporting a Vulnerability

Please do **not** report security vulnerabilities through public GitHub issues or pull
requests.

Report a suspected vulnerability privately using one of the following:

- **GitHub Security Advisory** (preferred): open a private report at
<https://github.com/ranxianglei/opencode-acp/security/advisories/new>.
- **Contact the maintainer**: reach out to [ranxianglei](https://github.com/ranxianglei)
on GitHub.

### What to include

- A short description of the issue and its potential impact.
- Steps to reproduce, or a minimal proof-of-concept, where possible.
- The affected version(s) and how you identified them.

We aim to acknowledge receipt within **two business days** and to share a timeline for a
fix. We will credit the reporter in the public advisory unless you prefer to remain
anonymous.

## Scope

This policy covers the `opencode-acp` plugin in this repository, including its runtime
behavior inside an OpenCode session. Please report issues belonging to the upstream
[OpenCode](https://opencode.ai) host or the original
[opencode-dcp](https://github.com/Tarquinen/opencode-dynamic-context-pruning) project to
those projects instead.
42 changes: 42 additions & 0 deletions devlog/2026-09-11_scan-remediation/REQ.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# REQ — Add security & dependency-hygiene files (HOL scan remediation)

## Background

`opencode-acp` was nominated for inclusion in
[hashgraph-online/awesome-ai-plugins](https://github.com/hashgraph-online/awesome-ai-plugins)
(see [issue #387](https://github.com/ranxianglei/opencode-acp/issues/387)). The catalog's HOL
centralized scanner scored `opencode-acp` at **79/100**, one point below the required
**≥ 80** pass threshold (0 critical / 0 high / 13 medium / 2 low).

The gap is driven largely by missing best-practice artifacts rather than by defects in the
plugin code.

## Goal

Raise the repository's HOL scan score to ≥ 80 by adding the standard, genuinely-useful
artifacts the scanner expects — without changing any plugin behavior.

## Changes

| File | Purpose | Scanner rule addressed |
| ---- | ------- | ---------------------- |
| `SECURITY.md` | Private vulnerability-reporting policy | `SECURITY_MD_MISSING` (security, medium) |
| `.github/dependabot.yml` | Weekly npm + GitHub Actions update PRs | `DEPENDABOT_MISSING` (operational-security, low) |
| `.gitattributes` | Explicitly mark binary assets | general repository hygiene |

Note: `.gitattributes` deliberately sets **no global text rule** — only explicit binary
markings — so it cannot re-normalize line endings of already-committed files.

## Non-goals

- No changes under `lib/`, `index.ts`, or `tests/` — behavior is untouched, so no dual-agent
code review is required.
- No `version` bump (this is not a release PR).
- No changes to existing CI workflow action versions (kept out of scope to avoid churning the
release pipeline; a follow-up if the score needs more margin).

## Acceptance criteria

- `npm run typecheck`, `npm run test`, and `npm run format:check` all pass.
- New files present and correctly formatted.
- PR references issue #387.
61 changes: 61 additions & 0 deletions devlog/2026-09-11_scan-remediation/WORKLOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# WORKLOG — Add security & dependency-hygiene files

## Investigation

- Confirmed via the awesome-list PR (#275) CI that the HOL "Scan PR" check failed for
`opencode-acp` at **79/100** (needs ≥ 80); findings: 0 critical / 0 high / 13 medium /
2 low.
- Read the scanner source (`hashgraph-online/hol-guard`, `src/codex_plugin_scanner/`) to
understand scoring: final score = `round(Σ check.points / Σ check.max_points × 100)`.
Findings group by category (security, operational-security, best-practices, marketplace,
…); each failing check forfeits its points. Rules live in `rules/registry.py`.
- Audited this repo against the fixable rules. **Missing:** `SECURITY.md`,
`.github/dependabot.yml`, `.gitattributes`. **Already present/passing:** `README.md`,
`LICENSE` (+ `license` field), `package-lock.json`, `tests/`, `CONTRIBUTING.md`.

## Implementation

- Added `SECURITY.md` — private vulnerability-reporting policy (GitHub Security Advisory +
maintainer contact via GitHub profile), scoped to this plugin.
- Added `.github/dependabot.yml` — weekly npm + github-actions update PRs, dev-deps grouped.
- Added `.gitattributes` — explicit binary-asset marking only (no global text rule, to avoid
re-normalizing existing files).

## Verification

- `npm run typecheck` — PASS
- `npm run test` — PASS
- `npm run format:check` — PASS
- New text files formatted with the repo's Prettier config.

## Review round 1 (2026-09-12)

Review of PR #388 found one blocking issue plus two wording issues; all fixed directly
on this branch:

- **Blocking — dependabot vs pr-validation**: `scripts/ci/check-pr.sh` enforces branch
naming (`YYYY-MM-DD_short-title`) and devlog existence; dependabot branches
(`dependabot/npm_and_yarn/...`) violate both, so every future dependabot PR would fail
the required `pr-validation` check and be unmergeable. Fix: exempt `dependabot/*`
branches from checks 1–3 (check 4, changelog/version, still applies); exemption
documented in AGENTS.md §5.1.2.
- **SECURITY.md — maintainer contact**: pointed at the `author` field in package.json,
which contains no email address → now points at the maintainer's GitHub profile.
- **SECURITY.md — supported versions**: covered only `opencode-acp@latest`, but the README
installs `@stable` and both dist-tags exist on npm → policy now covers both lines.

Re-verification after fixes:

- `bash scripts/ci/check-pr.sh dependabot/npm_and_yarn/example-1.0.0 origin/master` — PASS
(skips checks 1–3 with warning)
- `bash scripts/ci/check-pr.sh bad-branch-name origin/master` — FAILS as before
(human branches still fully enforced)
- `npm run format:check` — PASS

## Notes / follow-ups

- Final score confirmation requires re-running the HOL scanner (`plugin-scanner verify .`),
which cannot be executed in the agent sandbox (no PyPI egress). To be confirmed by the
awesome-list maintainers' re-scan.
- Optional follow-up if more score margin is needed: pin CI actions to immutable SHAs and
review the scanner's code-policy findings (e.g. dynamic-execution patterns in auto-update).
21 changes: 18 additions & 3 deletions scripts/ci/check-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
# 4. If package.json version changed, CHANGELOG.md or CHANGELOG.zh-CN.md
# must be modified AND contain the new version in changelog
#
# Bot-managed branches (dependabot/*) are exempt from checks 1-3 — they cannot
# follow human branch-naming/devlog conventions (see AGENTS.md Section 5.1.2).
# Check 4 still applies to them.
#
# Usage: ./scripts/ci/check-pr.sh [branch-name] [base-branch]
# branch-name defaults to $GITHUB_HEAD_REF or current branch
# base-branch defaults to "origin/master"
Expand All @@ -17,6 +21,11 @@ set -euo pipefail
BRANCH="${1:-${GITHUB_HEAD_REF:-$(git branch --show-current)}}"
BASE="${2:-origin/master}"

BOT_BRANCH=false
case "$BRANCH" in
dependabot/*) BOT_BRANCH=true ;;
esac

RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
Expand All @@ -34,7 +43,9 @@ echo ""

# ── Check 1: Branch name convention ──────────────────────────
echo "── Branch name convention ──"
if echo "$BRANCH" | grep -qE '^[0-9]{4}-[0-9]{2}-[0-9]{2}_[a-z0-9.-]+$'; then
if [ "$BOT_BRANCH" = true ]; then
warn "Branch '$BRANCH' is bot-managed — skipping branch-name & devlog checks"
elif echo "$BRANCH" | grep -qE '^[0-9]{4}-[0-9]{2}-[0-9]{2}_[a-z0-9.-]+$'; then
pass "Branch name matches YYYY-MM-DD_short-title"
else
fail "Branch name '$BRANCH' does not match YYYY-MM-DD_short-title (e.g., 2026-07-11_compress-baseline-fix)"
Expand All @@ -45,13 +56,17 @@ echo ""
# ── Check 2 & 3: Devlog exists ───────────────────────────────
echo "── Devlog entry ──"
DEVLOG_DIR="devlog/$BRANCH"
if [ -f "$DEVLOG_DIR/REQ.md" ]; then
if [ "$BOT_BRANCH" = true ]; then
: # devlog requirement waived for bot-managed branches (AGENTS.md Section 5.1.2)
elif [ -f "$DEVLOG_DIR/REQ.md" ]; then
pass "devlog/$BRANCH/REQ.md exists"
else
fail "devlog/$BRANCH/REQ.md is missing (required by AGENTS.md Section 5.1.2)"
fi

if [ -f "$DEVLOG_DIR/WORKLOG.md" ]; then
if [ "$BOT_BRANCH" = true ]; then
: # devlog requirement waived for bot-managed branches (AGENTS.md Section 5.1.2)
elif [ -f "$DEVLOG_DIR/WORKLOG.md" ]; then
pass "devlog/$BRANCH/WORKLOG.md exists"
else
fail "devlog/$BRANCH/WORKLOG.md is missing (required by AGENTS.md Section 5.1.2)"
Expand Down
Loading