HarperFast / HarperFast/harper

AI Issue: Guard filesystem-backed management operations against read-only mode

Open
#475 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
89
Forks
10
Avg merge
2d 2h
Merged PRs (30d)
205

Description

Follow-up from #450 (Read-only mode).

## Problem

`isReadOnlyMode()` currently gates RocksDB writes plus analytics/audit writes, but management operations that mutate filesystem state outside the database are not guarded:

- **Component deployments** — `components/operations.js` (writes the components directory).
- **Config updates** — `config/configUtils.js` (writes `harperdb-config.yaml`).
- **Roles/users** — `security/role.js`, `security/user.ts` (system-level identity changes).

A read-only Harper instance can still accept these operations and partially mutate filesystem state, which is inconsistent with the "read-only" contract.

## Proposed change

Add `isReadOnlyMode()` guards at each management entrypoint. Reject with a clear error (HTTP 405) before any filesystem write.

## Benefit

Coherent read-only contract across the database *and* the surrounding application config/assets. Prevents partial state mutations on instances callers expect to be inert.

---

🤖 Identified by Gemini CLI during review of #450; relayed by Claude.

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing isReadOnlyMode() gates and the management entrypoints in components/operations.js, config/configUtils.js, security/role.js, and security/user.ts. Done means each listed operation rejects with HTTP 405 before writing filesystem state, while the existing database, analytics, and audit protections remain intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
backend, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.