Skip to content

docs: document yara and small crates (Refs #362) - #369

Merged
SherlockOmss merged 2 commits into
mainfrom
docs/362-yara-misc
Nov 26, 2026
Merged

SherlockOmss merged 2 commits into
mainfrom
docs/362-yara-misc

Conversation

@SherlockOmss

Copy link
Copy Markdown
Contributor

Removes 22 #[allow(missing_docs)] // #362 markers (yara, inventory, response, sinks, tamper, transport, updater, verdict) and documents the fields and variants behind them. Comments only: no behavior change, no key or signing logic touched.

Checks: cargo +nightly fmt --all, cargo check --all-targets and cargo doc --no-deps with -D warnings on these crates: clean.

Stacked on #363 (base docs/172-missing-docs); retarget to main once it merges.

🤖 Generated with Claude Code

@SherlockOmss

Copy link
Copy Markdown
Contributor Author

Pushed 12314f7: 14 files (yara access/lib/memory/queue, inventory, response kill/quarantine, sinks, tamper, transport error/detection_upload, updater content/error, verdict). Docs only, 22 markers removed. Checks: nightly fmt, cargo check --all-targets and cargo doc --no-deps with -D warnings on the 8 crates: clean.

@SherlockOmss

Copy link
Copy Markdown
Contributor Author

Force-pushed (with lease) cda763c6: same tree, commit now signed off (git rebase --signoff) to satisfy the dco check. No file change. Checks to re-run: dco.

@SoFrexs SoFrexs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed cda763c6.

The removals are complete (23 markers; the description says 22), and most docs check out: Requester (uid 0 short-circuits, only the primary gid in permits), RotationDoesNotApply::role, Unsendable::count, Verdict::severity (max fold), the PackageChange None cases. Clippy and rustdoc -D warnings clean for inventory, response, sinks, tamper and verdict on the composed stack. CI was still running at review time (lint pending), so this assumes it goes green.

  • [should-fix] AlertRecord::technique "ATT&CK technique the detection maps to": alerts.ndjson also carries RESPONSE-ESCALATE (apps/agent/src/sink/mod.rs:168), BAYES, Sigma and the watchdog's SELF-PROTECTION (apps/watchdog/src/supervise.rs:688). "ATT&CK id or internal finding label".
  • [should-fix] AlertRecord::timestamp_ns "Time of the detection, in nanoseconds": both writers stamp the write time (now_ns() in apps/agent/src/alerts.rs:110, nanos_since_epoch() in the watchdog), and the epoch is missing. "When the record was written, in nanoseconds since the UNIX epoch."
  • [nit] TransportError::ServerError::message: a log reader would want to know control and bidi characters are stripped, the body is capped at 2 KiB, and an empty body becomes "http status: N" (client.rs:254-265).
  • [nit] ScanStats now says the dropped sentence twice (type doc from #363 and this field); drop the type-level one.

🤖 Generated with Claude Code

Comment thread crates/sinks/src/lib.rs Outdated
pub struct AlertRecord {
/// Time of the detection, in nanoseconds.
pub timestamp_ns: u64,
/// ATT&CK technique the detection maps to.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[should-fix] Not only ATT&CK: RESPONSE-ESCALATE, BAYES, Sigma and the watchdog's SELF-PROTECTION are written here too.

Comment thread crates/sinks/src/lib.rs Outdated
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[allow(missing_docs)] // #362
pub struct AlertRecord {
/// Time of the detection, in nanoseconds.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[should-fix] The write time (now_ns() in apps/agent/src/alerts.rs:110 and the watchdog), not the detection's, in nanoseconds since the UNIX epoch.

Comment thread crates/yara/src/queue.rs
pub struct ScanStats {
/// Scans fully handled: the match callback, when there was a match, has returned.
pub scanned: u64,
/// Requests that could not be queued because the queue was full or closed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] Now that the field says this, drop the same sentence from the ScanStats type doc (#363).

@SherlockOmss

Copy link
Copy Markdown
Contributor Author

Pushed 2e684ad4 for the cda763c review: AlertRecord::technique is an ATT&CK id or an internal label (RESPONSE-ESCALATE, BAYES, Sigma, SELF-PROTECTION); timestamp_ns is the write time since the UNIX epoch; ServerError::message documents its sources, the 2 KiB cap, stripped control/bidi characters and the http status: N fallback; the duplicate dropped sentence is gone from the ScanStats type doc. Checks: nightly fmt, clippy and rustdoc -D warnings on sinks, yara, transport, tools/check-docs.py.

🤖 Generated with Claude Code

@SoFrexs SoFrexs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 2e684ad4 (diff since cda763c6).

All four points are fixed. AlertRecord::technique lists the internal labels, timestamp_ns is the write time since the epoch, and ScanStats no longer says the same thing twice.

  • [nit] TransportError::ServerError::message says "else the response body". In error_reason (client.rs), a body that parses as a JSON object but has none of error, message or reason returns None, so it becomes http status: N, not the body. Something like "..., else the plain-text body, else http status: N (an empty body, or a JSON object without those keys)" would be exact. Not blocking.

CI was still running at review time, so this approval assumes it goes green.

🤖 Generated with Claude Code

SherlockOmss and others added 2 commits November 26, 2026 14:04
Removes the #[allow(missing_docs)] // #362 markers from yara, inventory,
response, sinks, tamper, transport, updater and verdict. Comments only.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: SherlockOmss <[email protected]>
…#362)

Review of cda763c:
- AlertRecord::technique is an ATT&CK id or an internal finding label
  (RESPONSE-ESCALATE, BAYES, Sigma, SELF-PROTECTION).
- AlertRecord::timestamp_ns is the write time, since the UNIX epoch.
- TransportError::ServerError::message says where the text comes from, the
  2 KiB read cap, the stripped control/bidi characters and the empty-body
  fallback.
- ScanStats: drop the dropped sentence from the type doc, the field says it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: SherlockOmss <[email protected]>
@SherlockOmss
SherlockOmss changed the base branch from docs/172-missing-docs to main November 26, 2026 13:07
@SherlockOmss
SherlockOmss merged commit 23551bf into main Nov 26, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants