recon patch
This commit is contained in:
@@ -20,3 +20,17 @@ This reconciliation adds Context System 1.0 and Workflow 2.0 documentation only.
|
|||||||
## Known limitations of this record
|
## Known limitations of this record
|
||||||
|
|
||||||
Application behavior, deployment, and local database state have not been verified. Record confirmed issues here when supported by evidence; do not turn unverified concerns into accepted tasks.
|
Application behavior, deployment, and local database state have not been verified. Record confirmed issues here when supported by evidence; do not turn unverified concerns into accepted tasks.
|
||||||
|
|
||||||
|
## Static-source review: potential security/functionality gaps (2026-11-04)
|
||||||
|
|
||||||
|
These observations are based on the supplied ZIP source, **not runtime exploit tests**:
|
||||||
|
|
||||||
|
- `api/routes/user_routes.py`: GET list/detail check admin, but POST create, PATCH update, and DELETE do not check `is_admin`; any authenticated account may be able to modify accounts. Treat as release-blocking until verified/fixed. `get_user` also lacks a missing-user guard.
|
||||||
|
- `api/routes/file_routes.py`: POST `/api/file` accepts client-supplied `path` and `filename`, without an explicit user-root containment check; this risks unauthorized file download. This endpoint must not be exposed as-is.
|
||||||
|
- `api/models/user.py`: `get_file_list()` and the admin root listing expose absolute/server paths in tree data; the configured root is formed by string concatenation, without demonstrated canonical containment checks. Symlink handling and filesystem boundaries need review.
|
||||||
|
- `api/auth.py` / `api/models/user.py` / `api/routes/token_routes.py`: disabled-account/token-refresh behavior needs explicit security tests. Review refresh-cookie `Secure` and `SameSite` settings and token revocation on disable/delete.
|
||||||
|
- `react/src/components/FileBrowser/FileBrowser.jsx`: download icon is rendered but has no click handler; `apiBaseUrl` is hard-coded to a development URL and unused. End-to-end download flow is unverified.
|
||||||
|
- `api/routes/file_routes.py`: a nested-quote f-string in the 404 handler may cause a syntax error on some supported Python versions; run syntax/import checks early.
|
||||||
|
- Tests and production deployment are still unverified. The ZIP is not a live Git repository; its HEAD/branch are historical snapshot metadata.
|
||||||
|
|
||||||
|
No source-code security fixes or runtime validation are part of this reconciliation patch.
|
||||||
|
|||||||
@@ -31,3 +31,40 @@ No merge or release convention is documented in the pre-existing repository. The
|
|||||||
3. Release/deployment branch: use `main` only if Captain confirms it as the release source; otherwise define a separate release branch before any release workflow.
|
3. Release/deployment branch: use `main` only if Captain confirms it as the release source; otherwise define a separate release branch before any release workflow.
|
||||||
|
|
||||||
Until approved, brief the concrete convention choice before creating later task branches/worktrees or merging. Do not infer deployment authorization from a branch choice. Record Captain's decision here and preserve any later superseded decision.
|
Until approved, brief the concrete convention choice before creating later task branches/worktrees or merging. Do not infer deployment authorization from a branch choice. Record Captain's decision here and preserve any later superseded decision.
|
||||||
|
|
||||||
|
## PRD-001: Private media-share purpose and V1 boundaries
|
||||||
|
|
||||||
|
- Status: Accepted from Captain's explicit requirements, 2026-11-04.
|
||||||
|
- FolderShare serves selected friends authenticated to a Raspberry Pi-hosted application accessing the existing video library via a mounted/shared directory. This is not a public registration or upload service.
|
||||||
|
- V1 scope: admin-created accounts, per-user folder access, folder browsing and individual read-only file downloads. No write, upload, rename or delete access to media.
|
||||||
|
- The media mount/container binding must be read-only. API authorization is required independently of UI restrictions; deny access by default.
|
||||||
|
|
||||||
|
## PRD-002: Folder permissions for first release
|
||||||
|
|
||||||
|
- Status: Accepted as V1 simplification from current discussion, 2026-11-04; revisit before implementing multi-root support.
|
||||||
|
- Use **one assigned root directory per user** and permit descendants only, with an unassigned root granting no media access. Do not grant access to ancestors, siblings, or paths outside the configured media root.
|
||||||
|
- Admin manages assignments. Do not rely on user-supplied filesystem paths or raw string-prefix checking. Resolve/canonicalize paths, reject traversal and symlink escapes, and recheck access at every listing and download request.
|
||||||
|
- A future multiple-independent-folder permission model is outside V1 scope.
|
||||||
|
|
||||||
|
## PRD-003: Opaque single-file download requests
|
||||||
|
|
||||||
|
- Status: Accepted from Captain's explicit requirement, 2026-11-04.
|
||||||
|
- File names and server filesystem paths must not appear in download URLs. Use non-guessable opaque short-lived download grants (suggested initial lifetime: five minutes to *start* a download), bound to the requesting account and a server-resolved file identity; validate current permission and file existence on use.
|
||||||
|
- Grant URLs must never substitute for authorization. Serve the actual filename through `Content-Disposition` to the authorized downloader; names will remain visible in browsing UI and browser download history.
|
||||||
|
- Large-file streaming and HTTP Range/resume support belong to V1. Ensure grants do not expire mid-stream; define safe behavior for resumed requests. Avoid exposing sensitive tokens in logs and referrers.
|
||||||
|
|
||||||
|
## PRD-004: Deferred batch ZIP downloads
|
||||||
|
|
||||||
|
- Status: Accepted as a future feature concept, **not an authorized implementation task**, 2026-11-04.
|
||||||
|
- Later allow selection of multiple files/folders and downloading a ZIP that preserves folder structure. Reuse centralized server-side authorization; reject symlink escapes and unauthorized members.
|
||||||
|
- Raspberry Pi resource constraints favor streaming/stored ZIP entries rather than recompressing already-compressed videos. Whether to prepare archives as temporary jobs or stream them directly remains an implementation decision for that future release.
|
||||||
|
|
||||||
|
## DEP-001: LAN-hosted Pi and intended URL
|
||||||
|
|
||||||
|
- Status: Partially accepted; **remote access method pending Captain decision**, 2026-11-04.
|
||||||
|
- Host the app on a Raspberry Pi on Captain's LAN; obtain the video library via a mounted network share or local share directory; target `share.roborto.net` or another suitable subdomain. Keep media storage independent of the app host.
|
||||||
|
- Unresolved: external browser access via public HTTPS reverse proxy versus VPN; chosen Pi/service distribution; TLS/DNS routing, authentication hardening, backup/restore, network mount reliability, and deployment container arrangement. Do **not** infer port forwarding or public exposure authorization.
|
||||||
|
|
||||||
|
## Pending: Git integration branch convention
|
||||||
|
|
||||||
|
The 2026-11-04 snapshot references work on `codex` while the existing proposal suggests `main`. There is no evidence that a general integration branch choice was approved. Before creating a task worktree, Codex must inspect live Git state and ask Captain to approve the integration base, worktree path, and eventual merge destination. A task branch is not authority to merge or deploy.
|
||||||
|
|||||||
+17
-13
@@ -1,22 +1,26 @@
|
|||||||
# Foldershare handoff
|
# Foldershare handoff
|
||||||
|
|
||||||
This is a replaceable, supplementary transfer snapshot. Current repository code, Git state, and maintained context documents take precedence if this file becomes stale. Refresh it rather than appending a transcript.
|
This is a replaceable snapshot. Live repository/Git and maintained context take precedence.
|
||||||
|
|
||||||
- Updated: 2026-11-04
|
- Updated: 2026-11-04 (planning reconciliation from `foldershare-20261104-160824-012796.zip`)
|
||||||
- Worktree: `/home/rob/projects/foldershare`
|
- Snapshot documents report `codex` / `767b424` at the earlier inspection; live Git worktree, branch, status and HEAD **have not been checked** in this archive-only reconciliation.
|
||||||
- Branch: `codex`
|
- Files changed by patch: `docs/PROJECT_OVERVIEW.md`, `docs/DECISIONS.md`, `docs/CURRENT_STATE.md`, `docs/TASKS.md`, `docs/HANDOFF.md` only. No application code, no tests executed, no merge or deployment.
|
||||||
- Task files: context documents, root `.gitignore`, `scripts/create_snapshot.py`, and `scripts/README.md`
|
|
||||||
|
|
||||||
## Current work
|
## Current outcome
|
||||||
|
|
||||||
TASK-001 is Complete. Captain ran and accepted the script from the project root on 2026-11-04. ZIPs are written to ignored `docs/snapshots/`. No deployment was performed.
|
Captain defined FolderShare as a private Pi-hosted, read-only browser/download service for named friends. V1: single assigned root per user, admin-controlled accounts, browse and single-file download using opaque filename-free URLs. Future: multi-select ZIP downloads. The patch records PRD-001 through PRD-004 and DEP-001, plus TASK-002 through TASK-006; security/auth fixes must precede exposure.
|
||||||
|
|
||||||
## Validation record
|
## Major static-source risks to address
|
||||||
|
|
||||||
- Sample ZIPs were created. Archive inspection found the required source and six context files, no forbidden paths or file types, and no prior ZIP in the second snapshot. The revised `docs/snapshots/` location was also checked.
|
`POST /api/file` trusts client path; user mutation routes lack admin checks; listing exposes host paths; download click is not wired; token/disabled behavior needs tests. See `CURRENT_STATE.md`. Do not expose this snapshot implementation to untrusted users.
|
||||||
- `git check-ignore` confirmed `docs/snapshots/`, its ZIP files, and `.worktrees/` are ignored.
|
|
||||||
- No frontend, API, runtime, or deployment validation was required for this repository utility.
|
|
||||||
|
|
||||||
## Decisions and next action
|
## Next Codex action
|
||||||
|
|
||||||
No active accepted implementation task is recorded. A general merge and release policy remains pending in `docs/DECISIONS.md`.
|
1. In the **live repository**, read AGENTS/context documents and inspect branch, HEAD, git status, worktrees and existing changes before applying this patch. Check patch with `git apply --check`; do not overwrite later edits.
|
||||||
|
2. Apply documentation-only patch, review diff and report conflicts. Do **not** quietly replace newer state or start any implementation task.
|
||||||
|
3. Ask Captain to select TASK-002 as first implementation task and approve concrete integration branch/worktree conventions (live `codex` vs proposal `main`). Keep TASK-006 blocked pending remote access and target Pi choice.
|
||||||
|
4. Once authorized, create one isolated worktree for TASK-002, implement/test there, and submit a Captain-validation handoff. Do not merge or deploy without authority.
|
||||||
|
|
||||||
|
## Validation
|
||||||
|
|
||||||
|
Patch was generated from the exact supplied ZIP. No live Git or application validation can be claimed from the archive alone.
|
||||||
|
|||||||
@@ -29,3 +29,7 @@ Local environment files and runtime data under `api/` are ignored by Git. Their
|
|||||||
- Durable decisions and pending convention proposals: `docs/DECISIONS.md`
|
- Durable decisions and pending convention proposals: `docs/DECISIONS.md`
|
||||||
- Accepted implementation work: `docs/TASKS.md`
|
- Accepted implementation work: `docs/TASKS.md`
|
||||||
- Replaceable transfer snapshot: `docs/HANDOFF.md`
|
- Replaceable transfer snapshot: `docs/HANDOFF.md`
|
||||||
|
|
||||||
|
## Product direction accepted 2026-11-04 (requirements; not verified implementation)
|
||||||
|
|
||||||
|
FolderShare is intended as a private, read-only, authenticated file browser and downloader for selected friends, hosted on a Raspberry Pi on Captain's LAN. The Pi will access an existing video library through a shared/mounted folder. Captain administers accounts and each account's accessible folder. An intended hostname is `share.roborto.net` (subject to DNS/network-access design). V1 permits browsing and single-file downloads; multi-select file/folder ZIP downloads are deferred. These are product requirements, not claims that the current application implements them safely.
|
||||||
|
|||||||
@@ -28,3 +28,71 @@ Create a numbered `TASK-###` only for an accepted scope. Record its objective, s
|
|||||||
- **Blocked**: work cannot proceed; state the blocking decision or dependency.
|
- **Blocked**: work cannot proceed; state the blocking decision or dependency.
|
||||||
|
|
||||||
Do not mark a task Complete solely because automated checks pass. Keep each task's code, tests, and context changes on its dedicated branch; do not combine unrelated numbered tasks.
|
Do not mark a task Complete solely because automated checks pass. Keep each task's code, tests, and context changes on its dedicated branch; do not combine unrelated numbered tasks.
|
||||||
|
|
||||||
|
## Accepted V1 planning tasks (2026-11-04)
|
||||||
|
|
||||||
|
The scopes below translate Captain's explicit product requirements into implementation-sized tasks. **Accepted here means scope recorded for planning, not permission to implement, merge, or deploy without the required workflow preflight and task selection.** Take one task per branch/worktree; prioritize the security gate. Task IDs follow the snapshot's completed TASK-001.
|
||||||
|
|
||||||
|
### TASK-002: Enforce authorization and safe filesystem boundaries
|
||||||
|
|
||||||
|
- Status: Accepted; not started. **Release blocker; first implementation priority.**
|
||||||
|
- Objective: Make user management and media access deny-by-default, including existing endpoints.
|
||||||
|
- Scope: Require admin for create/update/delete user; block privilege escalation and self-service root changes; ensure disabled/deleted accounts cannot keep using access/refresh credentials; centralize server-side canonical media root/assigned-root containment; reject path traversal, symlinks escaping the media tree, malformed roots and missing files; remove client-controlled download path trust or disable old route pending TASK-004; ensure no server absolute paths leak in ordinary browsing responses.
|
||||||
|
- Non-goals: New media UI, multi-root authorization, ZIP downloads or internet deployment.
|
||||||
|
- Acceptance: Anonymous and normal users receive appropriate 401/403 for admin mutations; disabled users cannot authenticate or refresh; unassigned users see/download no media; traversal, absolute/encoded paths, sibling-prefix tricks and symlink escapes are denied; valid assigned descendants remain accessible; regression tests demonstrate outcomes; old unsafe routes inaccessible.
|
||||||
|
- Relevant areas: `api/auth.py`, `api/models/user.py`, `api/routes/{file,user,token}_routes.py`, `api/settings.py`, new API tests.
|
||||||
|
- Dependencies: Verify live config/runtime behavior and decide API response contract. Retain one-root permission model (PRD-002).
|
||||||
|
- Validation: API syntax/import check, automated endpoint/path-security tests with temporary fixtures and user roles, inspect returned error messages for path leaks. Review diff; no real media used in tests.
|
||||||
|
- Recommended specialist: Webapp Debug followed by Webapp Feature and Code Review.
|
||||||
|
|
||||||
|
### TASK-003: Secure folder browsing for assigned users
|
||||||
|
|
||||||
|
- Status: Accepted; not started.
|
||||||
|
- Objective: Provide a usable browser rooted in each user's authorized directory without exposing real server paths.
|
||||||
|
- Scope: Replace/adjust browsing API to return virtual paths or opaque IDs, list only authorized child folders/files and their safe metadata; wire navigation/breadcrumbs, empty/error states, and denied/unavailable-share behavior. Retain existing visual patterns unless specifically approved to redesign.
|
||||||
|
- Non-goals: Upload, rename, delete, global search, multiple roots, ZIP selection.
|
||||||
|
- Acceptance: Assigned user can navigate root/descendants but not climb above root or access siblings; no-root user sees a no-access state; admin can inspect available assignable folders via admin-only API; no host absolute paths in client payloads; unavailable NFS/share is handled without broken/infinite UI.
|
||||||
|
- Relevant areas: API file routes/model; React FileBrowser and user-facing views.
|
||||||
|
- Dependencies: TASK-002 shared authorization utilities; API shape documented during task.
|
||||||
|
- Validation: API tests plus `npm run lint`, `npm run build`, manual navigation for admin/standard/no-root users.
|
||||||
|
- Recommended specialist: Webapp Feature, Frontend Visual QA, Code Review.
|
||||||
|
|
||||||
|
### TASK-004: Opaque single-file downloading with resume
|
||||||
|
|
||||||
|
- Status: Accepted; not started.
|
||||||
|
- Objective: Let an authorized user download one selected file through an opaque filename-free URL.
|
||||||
|
- Scope: File-selection/download action, short-lived unguessable user-bound grants, server-side resolution and reauthorization, safe streaming, original filename in response headers, large-file/range support, error states, and prevention of source-path or token logging leaks where feasible.
|
||||||
|
- Non-goals: Multi-select, ZIPs, media transcoding or streaming-player UI.
|
||||||
|
- Acceptance: URL contains neither original filename nor physical path; unauthorized, expired, revoked, swapped-user, deleted-file and outside-root downloads are rejected; valid downloads preserve original filename; tested range/resume behavior; large files are not fully loaded in server memory; click handler actually triggers download.
|
||||||
|
- Relevant areas: API file/download routes, auth and authorization service, React browser/download integration, API tests.
|
||||||
|
- Dependencies: TASK-002 and browsing identifier/contract from TASK-003. Decide durable grant state vs signed token and resume semantics during design.
|
||||||
|
- Validation: API integration/security tests including Range/206/416 handling where supported; frontend lint/build; manual large-file and interrupted-download verification using test data.
|
||||||
|
- Recommended specialist: Webapp Feature and Code Review.
|
||||||
|
|
||||||
|
### TASK-005: Admin account and folder-assignment workflow
|
||||||
|
|
||||||
|
- Status: Accepted; not started.
|
||||||
|
- Objective: Make the existing admin UI reliable for managing invited friends and a single permitted root per account.
|
||||||
|
- Scope: Create accounts only as admin, assign/unassign valid roots, enable/disable accounts, reset/change passwords administratively, review/delete users with guardrails, and correct UI/API error/confirmation states. Preserve an admin bootstrap method without public registration.
|
||||||
|
- Non-goals: Self-registration, invitations by email, sharing multiple disconnected roots, cosmetic redesign.
|
||||||
|
- Acceptance: Non-admin cannot see or invoke admin management; create/disable/reset/delete operations have tested authorization; assigning a root immediately updates access; unassigning denies media; cannot accidentally remove final admin or disable self without recovery policy; UI accurately handles success/failure.
|
||||||
|
- Relevant areas: `api/routes/user_routes.py`, model/migrations if needed, `react/src/views/{Users,User}`, routes/auth context.
|
||||||
|
- Dependencies: TASK-002; consider overlap with security fixes limited to enforcing current route protections.
|
||||||
|
- Validation: Automated admin/standard user tests, frontend lint/build, Captain's manual account-management review.
|
||||||
|
- Recommended specialist: Webapp Feature, Frontend Visual QA, Code Review.
|
||||||
|
|
||||||
|
### TASK-006: Raspberry Pi deployment and operational safeguards
|
||||||
|
|
||||||
|
- Status: Blocked pending Captain's remote-access and target-Pi decisions; no deployment authorized.
|
||||||
|
- Objective: Package and operate the app safely on a Pi accessing an existing media share.
|
||||||
|
- Scope: Resource-conscious service/container configuration, read-only bind mount of media, resilient mount/dependency behavior, secure secrets, TLS via selected entrypoint, restart/logging strategy, backup/restore for account data, and a documented non-destructive deployment/rollback procedure.
|
||||||
|
- Non-goals: Port forwarding or public release without explicit approval, moving the media library, ZIP preparation.
|
||||||
|
- Acceptance: Tests/health checks handle absent share; a restarted app retains user metadata; media cannot be written by app process; TLS/auth and exposure model tested; documented recovery and rollback; Captain accepts before live launch.
|
||||||
|
- Relevant areas: New deployment files/docs (not yet present); API settings/config.
|
||||||
|
- Dependencies: TASK-002 through TASK-005; DEP-001 external-access choice, Pi host allocation, network share source, DNS/TLS route.
|
||||||
|
- Validation: Build/start/stop on target Pi, mount failure simulation, authorization smoke tests, backup/restore rehearsal, manual access review.
|
||||||
|
- Recommended specialist: Production Readiness Review and Deployment Check.
|
||||||
|
|
||||||
|
## Future feature concept (no numbered task yet)
|
||||||
|
|
||||||
|
- Batch file/folder selection and prepared or streamed ZIP download (PRD-004). Scope a task only when Captain schedules it. ZIP entries must reuse V1 path/permission protections; no compression-heavy default for large existing videos.
|
||||||
|
|||||||
Reference in New Issue
Block a user