Skip to content

Conversation

@fafk
Copy link
Contributor

@fafk fafk commented Feb 3, 2026

Description

For the integration with Euler we want to skip balance checks, because the order will get the necessary funds from wrapper execution. This PR skip balance checks where wrappers are defined, mirroring what we do for flash loans with flash loan hints.

Signature checks are skipped for all 1271 orders, but kept for presign/Eip712 as these should always be valid independent of prehooks/wrappers. We have been running this way in prod for a while and I just cleaned up the flags.

Changes

  • Skip balance validation for ordres with wrappers
  • A cache so we don't keep parsing appdata for every auction
  • Nuked disable_1271_order_sig_filter and disable_1271_order_balance_filter config flags - 1271 now just always skips these checks

How to test

Unit tests.

@fafk fafk requested a review from a team as a code owner February 3, 2026 12:04
@fafk fafk marked this pull request as draft February 3, 2026 12:06
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a mechanism to bypass signature and balance checks for orders from specified applications using an appCode. However, the implementation has several security vulnerabilities: it allows regular ECDSA orders to bypass critical security checks, the appCode is user-controlled and can be spoofed, and an unbounded cache could lead to a Denial of Service. Additionally, there is a race condition in the appCode caching logic that can lead to redundant work. It is recommended to restrict the bypass to EIP-1271 orders, verify the app_data hash, and use a bounded cache.

@fafk fafk changed the title Skip checks for defined apps Skip checks for defined appCodes Feb 3, 2026
@fafk fafk force-pushed the skip-checks-for-defined-apps branch from f30e6c2 to 417b044 Compare February 4, 2026 08:46
@fafk fafk requested a review from kaze-cow February 4, 2026 10:47
@fafk fafk force-pushed the skip-checks-for-defined-apps branch from d277f7d to 05c1b38 Compare February 4, 2026 12:38
@fafk fafk marked this pull request as ready for review February 4, 2026 12:38
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a feature to bypass balance and signature checks for orders from specified appCode sources. However, the current implementation introduces significant security vulnerabilities, including an unauthenticated filter bypass where the user-provided appCode can be easily spoofed, and a potential Denial of Service due to unbounded cache growth that could lead to memory exhaustion. Additionally, the implementation in AppCodeBypass::build_bypass_set contains critical syntax errors where if let is incorrectly combined with a boolean condition using &&, which will cause compilation to fail.

@fafk fafk force-pushed the skip-checks-for-defined-apps branch from 9b8cc52 to c8eb853 Compare February 5, 2026 13:55
@fafk fafk force-pushed the skip-checks-for-defined-apps branch 2 times, most recently from c4d143f to 3ce6a12 Compare February 9, 2026 13:44
Copy link
Contributor

@MartinquaXD MartinquaXD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks alright to me. Regarding the issue with the attack vector:
This change is only supposed to unlock certain complicated order setups ASAP. IMO in the long term we should refactor the balance checking logic to be compatible with all the feature we offer. But this will be quite a bit more work.

Comment on lines 481 to 471
if order.app_data.flashloan().is_some() {
// If an order requires a flashloan we assume all the necessary
// sell tokens will come from there. But the receiver must be the
// settlement contract because that is how the driver expects
// the flashloan to be repaid for now.
return order.receiver.as_ref() == Some(settlement_contract);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also remove this part while you are at it. Since the redesign of Aave's repayment flow this is requirement is no longer correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to

            if let Some(fetched_app_data) = app_data.get(&order.app_data.hash()) {
                order.app_data = fetched_app_data.clone().into();
                if order.app_data.flashloan().is_some() {
                    return true;
                }
            }

Copy link
Contributor

@kaze-cow kaze-cow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't actually carefully reviewed the code itself. But I was able to incorporate these changes into the feat/playground-use-staging branch and verified that after adding the necessary environment variable settings to indicate Euler appcode as an exclusion, the orders are succeeding to process. Any further changes in that branch are just log changes, etc.

Thanks @fafk !

@fafk fafk marked this pull request as draft February 10, 2026 11:56
@fafk fafk marked this pull request as ready for review February 10, 2026 12:31
@fafk fafk force-pushed the skip-checks-for-defined-apps branch from e3dc70c to f87553f Compare February 10, 2026 12:31
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a mechanism to bypass balance checks for certain orders and removes some now-obsolete configuration flags. However, the implementation of the balance check bypass is currently unrestricted, allowing any user to bypass these checks by including a wrapper in their AppData, posing a high risk of Denial of Service (DoS). The removal of EIP-1271 signature validation in the autopilot service also reduces defense-in-depth. Additionally, a critical logic issue was found in the new caching implementation, and there's a discrepancy between the intended appCode filtering and the actual wrappers-based implementation. It is recommended to implement the restricted appCode filtering, retain signature validation, and resolve the caching logic.

Copy link
Contributor

@squadgazzz squadgazzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fafk could you update the PR description? I assume it doesn't reflect the changes anymore, so it's hard to understand the reasoning behind.

@fafk
Copy link
Contributor Author

fafk commented Feb 11, 2026

@fafk could you update the PR description? I assume it doesn't reflect the changes anymore, so it's hard to understand the reasoning behind.

Done, thanks! I reworked the whole PR and forgot to update the desc. 🙇

@fafk fafk force-pushed the skip-checks-for-defined-apps branch 2 times, most recently from 18c0223 to 70ab1cd Compare February 11, 2026 17:50
Copy link
Contributor

@MartinquaXD MartinquaXD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks okay to me.

Resolve conflicts: take NativePriceUpdater rename from main,
keep signature_validator removal from branch, remove unused IndexSet.
@fafk fafk force-pushed the skip-checks-for-defined-apps branch from 70ab1cd to d5716be Compare February 12, 2026 08:07
@fafk fafk enabled auto-merge February 12, 2026 08:15
@fafk fafk added this pull request to the merge queue Feb 12, 2026
Merged via the queue into main with commit d72d91d Feb 12, 2026
19 checks passed
@fafk fafk deleted the skip-checks-for-defined-apps branch February 12, 2026 08:38
@github-actions github-actions bot locked and limited conversation to collaborators Feb 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants