Repository navigation
Security fixes from a review of the server (#133 @umputun). See Upgrading for the changes affecting existing deployments.
Security
- SSE prefix subscribers received events naming keys their ACL could not read, secrets included, because the subscription check used a dummy key under the prefix. Every connection gets its own topic now, and each published key is checked against that subscriber's credentials before delivery.
- The token middleware checked the raw request path, so an
app/*token was denied on/kv/history/app/configand/kv/subscribe/app/*. The ACL key comes from the matched route now. GET /kv/{key}served caller-controlled values under a format content type with no restrictions, so an XML value with an XHTML namespace ran script on the stash origin in a browser with a valid session. Value responses carryContent-Security-Policy: sandboxandX-Content-Type-Options: nosniff.- Secret values were committed to git history in plaintext while the database held ciphertext. The git store encrypts them with the master key under a
$ENC$envelope and decrypts for history, revisions and restore. ZK blobs pass through unchanged. - Git writes and deletes go through
os.Root, so a symlink planted in a checkout cannot redirect them outside the repository. Restore skips symlinked entries. - Forwarded-IP headers were accepted from any peer, so a direct client could pick its own address for the rate limiter and the audit log. The new
--server.trusted-proxieslists the peers whose headers count. restoreaccepted a repository holding secrets without--secrets.key, cleared the database, then skipped every secret it could not write. It refuses before clearing now.- A write-only grant returned the current value through the edit form and the conflict view, so
wimplies read now.
Other
- Three
errors.Ascall sites useerrors.AsType, and golangci-lint is pinned so a tag build cannot float onto a linter version the commit was never checked against (5884b90). - Twelve dependency updates across the Go, JavaScript and Rust modules and the CI workflows (#113, #114, #119, #120, #122, #123, #124, #125, #126, #127, #130, 42a05e3).
Upgrading
- Behind a reverse proxy, set
--server.trusted-proxiesto the proxy IPs or CIDRs, comma-separated. Otherwise clients behind that proxy share one rate-limit bucket and audit entries record the proxy address. Forwarded private IPs are ignored; when the forwarded headers hold no accepted public address, stash uses the connecting peer's address. - Restoring a revision that contains any secret-path key requires
--secrets.key. History and revision reads of$ENC$-encrypted values need the same master key they were written with; ZK blobs pass through unchanged. - A
wgrant reads too now, through the API and the list as well as the UI.