fix: scan inline XML/PDF MIME parts, not only attachment disposition #18
No reviewers
Labels
No labels
dep-scan
dep-scan
dep-scan
dep-scan
dep-scan
dep-scan
dep-scan
dep-scan
dep-scan
dep-scan/ignore
dep-scan/ignore
dep-scan/ignore
dep-scan/ignore
dep-scan/ignore
dep-scan/ignore
dep-scan/ignore
dep-scan/ignore
dep-scan/ignore
finding
mod-nag
mod-nag
mod-nag
mod-nag
mod-nag/ignore
mod-nag/ignore
mod-nag/ignore
mod-nag/ignore
bug
doc
duplicate
enhancement
help wanted
invalid
question
security
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
IUS/xr-invoiced!18
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/11-inline-mime-parts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #11
Relaxes the
Walkdisposition guard to also process parts with inline or missing disposition when they have an invoice-relevant content-type or filename. Also extracts filename from Content-Typenameparameter.Review findings (ai:codex)\n\nLow: internal/scanner/attachment.go:62\nThe new inline-part predicate treats any MIME part with a filename as invoice-like, even when it is not an attachment and has a non-invoice content type such as image/png; name="logo.png" or Content-Disposition: inline; filename="logo.png". That broadens Walk from invoice-relevant inline XML/PDF parts to common inline assets, which can add noisy verbose/debug attachment output and read unrelated inline bodies into memory. A negative test for an inline non-XML/PDF named part would catch this; the non-attachment case should likely require XML/PDF content type or a .xml/.pdf filename.\n\nVerification: go test ./internal/scanner ./internal/xrechnung passed on the PR branch.
Review: fix/11-inline-mime-parts
The change is correct and well-scoped.
Observations
Redundant filter: The
isInvoiceLikecondition appears twice — as the early-continue guard and again before callingfn. Whendisposition == "attachment", a non-invoice-like part passes the first guard, its body is read into memory, then discarded at the bottom. Consider collapsing both checks into one gate beforeio.ReadAll.Filename-bearing text/plain parts now processed: A
text/plain; name="notes.txt"inline part will reachfn()becausefilename != ""makesisInvoiceLiketrue. Downstream detection rejects non-XML/PDF, so harmless in practice, but a slight behavioural broadening.multipart/alternative safety: HTML-body parts appear with
text/html, no filename, no attachment disposition — correctly skipped.Test coverage suggestions
text/plainbody (no filename, no attachment) must NOT be processedapplication/pdfwithContent-Disposition: inlineContent-Type nameparam (noContent-Dispositionat all)Logic is sound, no regressions expected.
— reviewed by ai:claude
Pull request closed