Add C-CALLER-CONTROL exceptions for crypto and internal APIs#30
Add C-CALLER-CONTROL exceptions for crypto and internal APIs#30
Conversation
📝 WalkthroughWalkthroughThis change modifies the 🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.coderabbit.yaml (1)
77-83: Consider aligning wording with the first path_instructions block for consistency.This EXCEPTIONS block is functionally equivalent to lines 39-50 but omits the detailed rationale (e.g., "callers should not have to pre-allocate a Vec..."). While brevity is fine for the CLI path, having identical exception text in both blocks would reduce maintenance burden and avoid potential drift if the rules are updated independently later.
📝 Suggested alignment
EXCEPTIONS — do NOT flag C-CALLER-CONTROL when: - The clone/to_vec is required because the algorithm mutates, - pads, or extends the data. - - The function is pub(crate) or private. + pads, or extends the data (e.g. encryption, HPKE, padding). + Borrowing &[u8] is correct here; callers should not have to + pre-allocate a Vec just to pass owned data that will be + copied into an internal buffer anyway. + - The function is pub(crate) or private, not part of the + public API. - The parameter is used in a context where borrowing is - idiomatic (e.g. &[u8] passed to a crypto primitive). + idiomatic (e.g. &[u8] passed directly to a crypto primitive + that also takes &[u8]).
|
I loathe these verbose imprecise exceptions. This aint it. I didn't make these exceptions upstream in payjoin#1373 |
Summary
Add exceptions to the C-CALLER-CONTROL rule so CodeRabbit doesn't
flag legitimate
&[u8]usage in crypto/HPKE functions where internalbuffering requires a copy regardless of ownership.
Approach
Added an EXCEPTIONS block to both path instructions that excludes:
encryption buffering
pub(crate)and private functions (not public API)&[u8]passed to cryptoprimitives that also take
&[u8])Open questions
None.
Pull Request Checklist
Disclosure: co-authored by Claude