Repository navigation
Description
Problem
PR #357 filters server-internal sidecars (`.idp`, `.quota.json`, etc.) out of the LDP `ldp:contains` listing body. Caught by Copilot but deferred from that PR: the ETag for the same container is still computed from the unfiltered directory state.
Concretely:
- `src/handlers/resource.js` derives container ETag from `stats.etag` (the directory's mtime/size as seen by the OS — includes hidden children)
- `src/db/index.js` uses `entries.length` against the unfiltered set
So when an internal sidecar churns — e.g. `.idp/sessions/...` writes during login, or `.quota.json` updates after PUT — the container's ETag changes even though its body (`ldp:contains`) is identical. Cache validators leak backend activity:
```
client GET /pod/ → 200, ETag "x"
(server: idp session refresh writes .idp/sessions/abc.json)
client GET /pod/ If-None-Match "x" → 200 (not 304), same body, new ETag "y"
```
The 200-vs-304 difference fingerprints internal write activity through the public listing endpoint, even though the contents of `.idp` are auth-protected.
Why this matters
- Side-channel: timing/frequency of 200 responses on a static-looking listing reveals server-internal state mutation (logins, payments, quota recompute)
- Cache thrashing: clients re-fetch identical bodies every time anything in the directory changes — wasteful, and on a busy pod every internal write invalidates client caches
- Inconsistent with the listing filter: if the public surface intentionally hides sidecars, the validators that gate that public surface should align
Proposed fix
Compute the container ETag from the same filtered set that produces the body. Hash inputs would be the post-filter `(name, isDirectory, mtime, size)` tuples for visible entries only — not directory stats that include hidden children.
Touchpoints:
- `src/handlers/resource.js`: container-GET / HEAD path — replace `stats.etag` with a hash over the filtered entries list
- `src/db/index.js`: same pattern for the DB-backed `/db/` route
- Share a helper (e.g. `computeContainerEtag(entries)`) so both paths stay in lockstep with the filter in `src/ldp/container.js`
Acceptance
- Container ETag does not change when an entry hidden by the listing filter is added / modified / removed
- Container ETag still changes when a visible child is added / modified / removed
- Both filesystem (`src/handlers/resource.js`) and DB-backed (`src/db/index.js`) listings use the same filtered ETag
- Integration tests: `If-None-Match` returns 304 across hidden-sidecar churn; returns 200 across visible-child mutation
Out of scope
- The sidecar-naming / namespace concern itself — tracked at Move internal server state out of .well-known/ namespace #358 (move JSS internal state out of `.well-known/`)
- Changing the listing filter — handled in ldp: hide server-internal sidecars from container listings (#350) #357
Context
Surfaced during Copilot review on #357. The listing-body fix is correct and merging; this issue captures the parallel concern at the validator layer so it doesn't get lost.
Activity
ldp: fix .well-known auth-model comment — public-by-design, not WAC (PR
ldp: hide server-internal sidecars from container listings (#350) (#357)