~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

A label's `val`, `rule`, `cid` and a resolve's `note` go unchecked

Closed
Closed chadtmiller.com opened this issue 0 comments

What happened

applyLabel/negateLabel take any non-empty val, any string as rule, and any string as a strongRef's cid, and write them into an fyi.opensocial.label record in the group's space. A 10 000-byte val, "rule": "not a uri", or "cid": "x" with a URI in the group's space is accepted and published, though label.json says val is at most 128, rule is an at-uri, and cid a CID: a reader that validates the record rejects it. The test itself sends "rule": "at://x/y/z" (tests/moderation.rs:159), whose authority x is neither a DID nor a handle. resolveSubject keeps a note of any length in the queue, against the lexicon's 3000 bytes / 300 graphemes. Only moderators holding label/mod.resolve can do this.

How to see it

Read against docs/fresh at 4636e6d, the code at: crates/group-host/src/moderation.rs:239-240 (val), 267-269 (rule), 205-213 (subject.cid), 448 (note). Paths are under crates/group-host/src unless they say otherwise. Severity: low.

What you expected

Refuse InvalidRequest for a val over 128 bytes, a rule that is not an at-uri (syntax has the checks), a cid that does not parse, and a note over 3000 bytes or 300 graphemes; add the cases to the refusals test at tests/moderation.rs:230-260.

Where

The host, as built from 4636e6d. Found while checking the docs against the code.