Repository navigation
fix(invoke): tolerate invalid headers across runtimes - #19481
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughInvoke header parsing now handles empty, invalid, unsupported, and non-object inputs without raising errors. Python preserves dictionary handling and variable substitution. Go adds equivalent tolerant parsing and logging tests. ChangesInvoke header handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: Merge Risk: ⚪ Minimal · up to Invoke header parsing now ignores malformed configurations instead of failing execution while retaining valid headers and Python variable interpolation. The covered behavior is ready to merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit checks each header’s shape, Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #19481 +/- ##
=======================================
Coverage 37.29% 37.29%
=======================================
Files 54 54
Lines 15354 15354
Branches 119 119
=======================================
Hits 5727 5727
Misses 9601 9601
Partials 26 26 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
wangq8
left a comment
There was a problem hiding this comment.
This is an AI review comment.
Summary: Tolerates invalid/malformed headers by ignoring them (with a WARNING log) instead of failing the invoke, across both the Python and Go runtimes. Good test coverage, and the tests explicitly guard against leaking raw header values (secrets) into logs.
Verified:
- Python:
None/empty string →{}; a dict is now accepted directly (with string values interpolated via_resolve_header_text); invalid JSON → warn +{}; non-object JSON (array/scalar/null) → warn +{}; unsupported type → warn +{}.json/loggingare imported, and the warning only logs line/column — never the payload. - Go: nil/empty/unsupported type/invalid JSON/non-object → warn + nil (no error). Secret payload is never logged (
TestInvokeHeadersDoesNotLogRawPayload). - Tests cover malformed JSON, empty, array, scalar, null, unsupported type, object, and direct map, plus interpolation and secret-leak checks in Python.
Points to consider (non-blocking):
- Behavior change: previously invalid headers caused the invoke to fail with a clear error; now they are silently dropped (server-side WARNING only). A user with a malformed
Authorizationheader will now send an unauthenticated request and likely hit a confusing downstream 401/403 rather than an immediate config error. Consider surfacing the warning to the canvas user (e.g. a warning output channel) instead of only the server log — or confirm this silent tolerance is the intended UX. - In Go,
invokeHeaderscan no longer return a non-nil error, so theif err != nil { return nil, err }branch at the call site is now effectively dead code. Minor — consider dropping the error return (or leave for symmetry). TestInvokeHeadersDoesNotLogRawPayloadmutates the global logger viazap.ReplaceGlobals(restored in cleanup). Fine today since no test in this package usest.Parallel(), but it's global state — be mindful if parallelism is introduced later.
Overall LGTM — no security regressions; the secret-logging guard is a nice touch.
This is an AI review comment.
Summary
Invalid or malformed headers are now ignored safely. Valid headers and variable interpolation continue to work.
based on #19184