| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…acters
- Replace line.split('=') with indexOf('=') + substring() to split
only on first occurrence of '='
- Preserves full value for base64 certificates and taskd parameters
containing '=' padding characters
- Fixes silent authentication failures for users with self-signed certs
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 926aea5e-e097-403d-b24a-0ac6d19244e8 📥 CommitsReviewing files that changed from the base of the PR and between 23d863a and 65a1d70. 📒 Files selected for processing (2)
📝 Walkthrough WalkthroughRefactors the .taskrc parser to split each line on the first '=' occurrence (using index/substring) instead of splitting on all '=' characters, preserving values that contain '=' (e.g., base64 padding) and returning an explicitly populated map. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem🚥 Pre-merge checks | ✅ 5 ✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches 🧪 Generate unit tests (beta)
Comment @coderabbitai help to get the list of available commands and usage tips. |
Sorry, something went wrong.
There was a problem hiding this comment.
This PR fixes a long-standing parser bug in parse_taskrc.dart where line.split('=') caused silent truncation of values containing = characters (e.g. base64-encoded certificates). The fix replaces the split approach with indexOf+substring to split only on the first =, preserving the full value.
Changes:
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Sorry, something went wrong.
| line.substring(0, line.indexOf('=')).trim(): | ||
| line.substring(line.indexOf('=') + 1).trim(), |
There was a problem hiding this comment.
The core bug fix is correct — using indexOf('=') instead of split('=') properly preserves values containing = characters. However, line.indexOf('=') is called twice on lines 10–11: once to compute the key's end boundary and once to compute the value's start. While the .where filter on line 8 guarantees indexOf will never return -1, calling it twice is a minor inefficiency and a maintainability concern. A local variable such as final sep = line.indexOf('=') should be introduced before the map entry to avoid the repeated call and make the intent clearer.
Sorry, something went wrong.
There was a problem hiding this comment.
Fixed — indexOf('=') result is now stored in a local variable `sep`
to avoid the double call. Regression tests added in the same commit.
Sorry, something went wrong.
| line.substring(0, line.indexOf('=')).trim(): | ||
| line.substring(line.indexOf('=') + 1).trim(), |
There was a problem hiding this comment.
The PR checklist explicitly marks "Tests have been added or updated to cover the changes" as unchecked, and the existing test file (test/utils/taskserver/parse_taskrc_test.dart) has no test case for the exact scenario this fix addresses — a value containing one or more = characters (e.g. a base64-encoded certificate like taskd.certificate=abc123==). Without such a test, a regression could silently reintroduce the original bug. A test case like:
key=value==
expecting {'key': 'value=='} should be added.
Sorry, something went wrong.
There was a problem hiding this comment.
lib/app/utils/taskserver/parse_taskrc.dart (1)🤖 Prompt for all review comments with AI agents2-4: Add a regression test for the documented parser contract.
This behavior is critical to auth correctness; please add tests for values with multiple = (for example certificate padding) and malformed lines without =.
🤖 Prompt for AI AgentsVerify each finding against the current code and only fix it if needed. In `@lib/app/utils/taskserver/parse_taskrc.dart` around lines 2 - 4, Add a regression test exercising the parser in parse_taskrc.dart (the parseTaskrc function) that asserts: 1) a line like "cert=MIIC...==...==" preserves the entire RHS including multiple '=' characters (split only on the first '='), and 2) malformed lines without '=' are handled as documented (either skipped or produce a specific error/empty key depending on current contract). Create test cases for both scenarios, call the parser with multi-line input including normal, padded-certificate, and malformed entries, and assert the returned map/structure matches the documented contract.
Verify each finding against the current code and only fix it if needed. Nitpick comments: In `@lib/app/utils/taskserver/parse_taskrc.dart`: - Around line 2-4: Add a regression test exercising the parser in parse_taskrc.dart (the parseTaskrc function) that asserts: 1) a line like "cert=MIIC...==...==" preserves the entire RHS including multiple '=' characters (split only on the first '='), and 2) malformed lines without '=' are handled as documented (either skipped or produce a specific error/empty key depending on current contract). Create test cases for both scenarios, call the parser with multi-line input including normal, padded-certificate, and malformed entries, and assert the returned map/structure matches the documented contract.
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7cf72e74-918a-4888-8777-d0616247f132
📥 CommitsReviewing files that changed from the base of the PR and between 66aef29 and 23d863a.
📒 Files selected for processing (1)
Sorry, something went wrong.
- Avoid calling indexOf('=') twice by storing result in sep variable
- Add 3 regression tests covering base64 padding, multiple = chars,
and taskd.trust value preservation
| Back | FazBrowse Home | New Git URL |
Description
The .taskrc parser in lib/app/utils/taskserver/parse_taskrc.dart
was using line.split('=') to parse key-value pairs and blindly
extracting pair[0] and pair[1]. This caused silent data truncation
for any parameter whose value contains one or more = characters —
which is common in base64-encoded certificates and taskd parameters
with padding.
The fix replaces split('=') with indexOf('=') + substring() to
split only on the first occurrence of =, preserving the full
value including any trailing = characters.
Before (broken):
After (fixed):
All other logic — newline splitting, comment filtering, \\/
replacement — remains identical with zero unintended side effects.
Fixes #611
Screenshots
N/A — this is a parser logic fix with no UI changes.
Checklist
Summary by CodeRabbit
Bug Fixes
Tests