Repository navigation
Fix security finding acf_22c53f09bdd70500269c0fd5baf38f83 - #2013
Closed
mluck-openai wants to merge 1 commit into
Closed
mluck-openai wants to merge 1 commit into
mluck-openai wants to merge 1 commit into
Conversation
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.
Static verification passed. The POST /api/imports route passes parsed JSON to importInvoice; imports.mjs now performs an exact lookup for the documented schemaVersion "1" and rejects missing, unsupported, and coercion-equivalent versions before store.invoices.set. Reviewer exceptions propagate before persistence, and only review.approved === true reaches the persistence sink. The regression test source verifies that over-limit version 1 imports, unsupported version "2", and numeric version 1 are rejected without changing the invoice count. Legitimate behavior remains: documented version "1" imports still use checkAmount, and the existing normal-import test asserts a 201 response with an affirmative review. The final diff was inspected and git diff --check passed. Per static verification mode, builds, tests, reproducers, and the application were not run.
Patch verification: fixed
Static assessment of the current checkout: the authenticated POST /api/imports route still passes caller-controlled JSON to importInvoice (examples/invoice-desk/app/server.mjs:118-125,199-204), but the working-tree fix closes the original fail-open path. importInvoice now performs an exact lookup for the supported schema key, rejects a missing reviewer with HTTP 422, invokes the reviewer without a fail-open catch, and requires review.approved === true (examples/invoice-desk/app/imports.mjs:35-44). Unsupported values such as "2" or numeric 1 therefore fail before the persistence sink at lines 48-64. Any reviewer exception propagates to the server error handler at server.mjs:257-264 and cannot resume execution at store.invoices.set. The only reviewer is module-local checkAmount, which approves only amounts at or below the workspace limit (imports.mjs:4-10); the documented and UI-generated legitimate schema is string "1" (app/README.md:24-37; app/views.mjs:82-97), so supported under-limit imports still reach persistence. The focused regression test source rejects an over-limit supported document, unsupported string and numeric schema versions, and asserts the invoice count is unchanged (examples/invoice-desk/qa/app.test.mjs:155-176). No equivalent importInvoice caller or reviewer path exists in the sample. This was static verification only; builds, tests, reproducers, and the application were not run.
Verification applies to this saved patch. It does not mark the finding fixed on the target branch.
acf_22c53f09bdd70500269c0fd5baf38f83arp_5f1dfb12ccdd9da12d4bc9985788ee8028a18608984edbc5b849dc60fb3da20af948c5ae430277d1f9a0542bd108c65497555326a32784176b6a62ee023f5eaa8d947461