Skip to content

artifact.search silently stops on lines over 1 MiB and drops the scanner error #51

Description

@loraldx

artifactSearch (artifact.go:130) scans each artifact with scanner.Buffer(make([]byte, 4096), 1024*1024) and never checks scanner.Err() after the loop (it ends with _ = f.Close()). A single line over 1 MiB triggers bufio.ErrTooLong, silently aborting the scan for that artifact with no error and no truncation signal — the search reports a clean "no match".

This is reachable and load-bearing: audit.events_tail and agent.messages_tail spill single-line JSON blobs to artifacts, and those lines routinely exceed 1 MiB, so searching the audit/message history can silently return false negatives. (The same class of bug was fixed for file.search in #37 by iterating the in-memory buffer.)

Fix: adopt the unified scanner pattern (8 MiB buffer aligned with events.go/agent.go and a checked scanner.Err()), or iterate the bounded in-memory content directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions