fix: cora scan security findings (traversal, byte-slice panic, header inject, orphan file)#95
Merged
Merged
Conversation
…eader inject, orphan file) - storage: resolve_path checks Path components (ParentDir/absolute) instead of naive substring; allows legit '..' filenames, blocks traversal - oauth: char-safe body preview (was &body[..200] → panic on multibyte UTF-8) - attachment: sanitize Content-Disposition filename (CR/LF/quote/ctrl) - attachment: clean up orphaned storage file when DB insert fails - tests: preview multibyte + sanitize_filename
🔍 Cora AI Code Review🟡 Warning (1)
Review powered by cora-cli · BYOK · MIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses the valid security/robustness findings from a
cora scan(v0.6.2) of the codebase. Triaged 59 findings down to 4 real issues; false positives left untouched.Fixed
storage.rscontains("..")— both weaker than needed and rejects legit filenames with..Pathcomponents (ParentDir/ absolute) insteadoauth.rs(×2)&body[..200]panics on multibyte UTF-8 in provider error bodiespreview()helperattachment_routes.rsContent-Disposition: inline; filename="\{user_input\}"— CR/LF → header injection,"→ broken headersanitize_filename()(neutralize CR/LF/quote/ctrl, fallback todownload)attachment_routes.rsTriaged as false positives (not changed)
store.rsMAX()in UPDATE — SQLite scalarmax(a,b), tests passstore.rsON CONFLICT— SQLite supports it, tests passstore.rsFTS5p.rowid— valid implicit rowid column, tests passauth_routes.rscookie suffix injection — the=is included in the prefix check, which is the correct mitigationstorage_key&id[..0]— empty slice is valid, no panicDockerfilebinary name — the binary is built asrungu([[bin]] name = "rungu")Out of scope (separate concerns)
web/) XSS/path-traversal findings — different layer, separate PRlib.rsPG multi-statement migration — pre-existing infra, affects feat: perf + correctness fixes (user_voted N+1, rate limiting, pg FTS, slug cache) #94's PG FTS; tracked thereChecklist