-
Notifications
You must be signed in to change notification settings - Fork 5
Clear signing 3 #282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clear signing 3 #282
Conversation
|
Claude finished @llbartekll's task —— View job Code Review CompleteTasks
Review SummaryReviewed PR adding Uniswap Permit2 support, interpolated intents, and address book functionality to clear signing system. Identified several issues requiring attention. Issues FoundIssue 1: Missing Error Handling in Address Formatting (eip712.rs:391-393)File: crates/yttrium/src/clear_signing/eip712.rs:391-393 Issue: When let bytes = match hex::decode(cleaned.trim_start_matches("0x")) {
Ok(bytes) => bytes,
Err(_) => return address, // Returns potentially malformed input
};Recommendation: Return Issue 2: Recursive Merge Without Depth Limit (eip712.rs:224-241, engine.rs)Files:
Issue: fn merge_include(target: &mut Value, include: Value) {
if let (Value::Object(target_map), Value::Object(include_map)) = (target, include) {
for (key, value) in include_map {
match target_map.get_mut(&key) {
Some(existing) => {
if existing.is_object() && value.is_object() {
merge_include(existing, value); // Unbounded recursion
}
}
// ...Recommendation: Add depth limit parameter to prevent stack overflow from deeply nested structures. Issue 3: External URL in Metadata (uniswap-common-eip712.json:29)File: crates/yttrium/src/clear_signing/assets/descriptors/uniswap/uniswap-common-eip712.json:29 Issue: Descriptor contains external URL to https://uniswap.org/ which is not an approved company domain (reown.com, walletconnect.com, walletconnect.org). "info": {
"legalName": "Uniswap Labs",
"deploymentDate": "2021-12-14T00:00:00Z",
"url": "https://uniswap.org/"
}Recommendation: Verify this external dependency is intentional for protocol integration purposes. Consider documenting trusted third-party protocol URLs. Issue 4: Nested Address Book Structure Lacks Validation (engine.rs:680-686)File: crates/yttrium/src/clear_signing/engine.rs:680-686 Issue: serde_json::Value::Object(nested) => {
for (inner_key, inner_label_value) in nested {
if let Some(inner_label) = inner_label_value.as_str() {
map.entry(normalize_address(inner_key))
.or_insert_with(|| inner_label.to_string());
}
}
}Recommendation: Document expected structure format and consider adding depth/size limits for address book entries. Issue 5: Silent Failure on Include Processing (resolver.rs:396-434)File: crates/yttrium/src/clear_signing/resolver.rs:396-434 Issue: Value::Array(items) => {
for item in items {
let name = item.as_str().ok_or_else(|| {
ResolverError::DescriptorParse(
"includes entries must be strings".to_string(),
)
})?;
// ... but no validation of what happens with empty strings or whitespaceRecommendation: Add validation for empty/whitespace-only include names before lookup. Issue 6: Inconsistent Checksum Address Calculation (engine.rs:736-761)File: crates/yttrium/src/clear_signing/engine.rs:736-761 Issue: Checksum calculation manually reconstructs string with uppercase chars but doesn't validate the algorithm matches EIP-55 spec for all edge cases (e.g., addresses with no alphabetic chars). Recommendation: Add test cases covering edge cases: all-numeric addresses, addresses with mixed case input, zero address. Issue 7: Missing Tests for Interpolated IntentsFile: crates/yttrium/tests/clear_signing.rs Issue: New Recommendation: Add tests covering:
Issue 8: Test Coverage for Permit2 DescriptorsIssue: PR adds Uniswap Permit2 EIP-712 descriptors ( Recommendation: Add test case using actual Permit2 typed data to validate descriptor resolution and formatting. Issue 9: Large Swift File RegenerationFile: platforms/swift/Sources/Yttrium/yttrium.swift Issue: 2997 line deletion suggests full UniFFI regeneration. While likely auto-generated, should verify regeneration used correct uniffi-bindgen version and that breaking changes aren't introduced to Swift API surface. Recommendation: Verify Swift platform bindings still compile and existing Swift consumers won't break. Consider noting uniffi version in commit message for traceability. External Domain URLsNo blocking external domain issues found beyond Issue 3 (Uniswap URL in metadata, which is expected for protocol integration). Positive Observations
|
|
@claude review |
|
Claude finished @llbartekll's task —— View job 🔄 Incremental Review Tasks
Validation SummaryValidated previous review findings against current codebase state. All 9 previously identified issues remain present in current code. Validated Issues (Still Present)Issue 1: Missing Error Handling in Address Formatting (eip712.rs:367-369) Hex decode failure returns raw input without validation. Could display malformed addresses to users. let bytes = match hex::decode(cleaned.trim_start_matches("0x")) {
Ok(bytes) => bytes,
Err(_) => return address, // Returns potentially malformed input
};Issue 2: Recursive Merge Without Depth Limit (resolver.rs:647-664)
fn merge_include_value(target: &mut Value, include: Value) {
if let (Value::Object(target_map), Value::Object(include_map)) = (target, include) {
for (key, value) in include_map {
match target_map.get_mut(&key) {
Some(existing) => {
if existing.is_object() && value.is_object() {
merge_include_value(existing, value); // Unbounded recursionRecommendation: Add depth limit parameter to prevent stack overflow. Issue 3: External URL in Metadata (uniswap-common-eip712.json:29) Descriptor contains https://uniswap.org/ which is not an approved domain (reown.com, walletconnect.com, walletconnect.org). Expected for protocol integration but should be documented as trusted third-party URL. Issue 4: Nested Address Book Structure Lacks Validation (resolver.rs:519-543)
serde_json::Value::Object(nested) => {
for (inner_key, inner_label_value) in nested {
if let Some(inner_label) = inner_label_value.as_str() {
map.entry(normalize_address(inner_key))
.or_insert_with(|| inner_label.to_string());
}
}
}Recommendation: Document expected structure and consider depth/size limits. Issue 5: Silent Failure on Include Processing (resolver.rs:415-454)
Value::Array(items) => {
for item in items {
let name = item.as_str().ok_or_else(|| {
ResolverError::DescriptorParse(
"includes entries must be strings".to_string(),
)
})?;Recommendation: Add validation for empty/whitespace-only names. Issue 6: Inconsistent Checksum Address Calculation (engine.rs:617-642) Checksum calculation doesn't validate EIP-55 edge cases (all-numeric addresses, zero address). Recommendation: Add test cases for edge cases. Issue 7: Missing Tests for Interpolated Intents Test file has two existing interpolated_intent assertions but no dedicated tests for:
Issue 8: Test Coverage for Permit2 Descriptors Test file has one Permit2 test (eip712_uniswap_permit2_formats_allowance) but no tests validating descriptor loading or calldata formatting with actual Permit2 typed data. Issue 9: Large Swift File Regeneration UniFFI regeneration reduced file from ~3000 lines to ~200 lines. Should verify Swift bindings still compile. 🔒 External Domain URL Detected (Non-blocking) External dependency for protocol integration. Verify intentional. |
crates/yttrium/src/clear_signing/assets/descriptors/common-test-router.json
Outdated
Show resolved
Hide resolved
crates/yttrium/src/clear_signing/assets/descriptors/erc20_usdc.json
Outdated
Show resolved
Hide resolved
crates/yttrium/src/clear_signing/assets/descriptors/erc20_usdt.json
Outdated
Show resolved
Hide resolved
crates/yttrium/src/clear_signing/assets/descriptors/uniswap_v3_router_v1.json
Outdated
Show resolved
Hide resolved
Co-authored-by: Chris Smith <[email protected]>
01ca8e5 to
357ebdf
Compare
No description provided.