-
Notifications
You must be signed in to change notification settings - Fork 11
Release 23.05.2025 #215
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
Release 23.05.2025 #215
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| require('dotenv').config(); | ||
| const { DataTypes } = require('sequelize'); | ||
|
|
||
| async function up({ context: queryInterface }) { | ||
| await queryInterface.removeColumn( | ||
| {schema: process.env.DATABASE_SCHEMA_NAME, tableName: 'sponsorship_policies'}, | ||
| 'IS_PUBLIC', | ||
| { | ||
| type: DataTypes.TEXT, | ||
| allowNull: true | ||
| } | ||
| ); | ||
| } | ||
|
|
||
| async function down({ context: queryInterface }) { | ||
| await queryInterface.addColumn( | ||
| {schema: process.env.DATABASE_SCHEMA_NAME, tableName: 'sponsorship_policies'}, | ||
| 'IS_PUBLIC', | ||
| { | ||
| type: DataTypes.TEXT, | ||
| allowNull: true | ||
| } | ||
| ); | ||
| } | ||
|
|
||
| /** @type {import('sequelize-cli').Migration} */ | ||
| module.exports = {up, down}; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -230,7 +230,7 @@ const paymasterRoutes: FastifyPluginAsync<PaymasterRoutesOpts> = async (server, | |
|
|
||
| // get supported networks from sponsorshipPolicy | ||
| const supportedNetworks: number[] | undefined | null = sponsorshipPolicy.enabledChains; | ||
| if (!supportedNetworks || !supportedNetworks.includes(chainId.chainId)) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.UNSUPPORTED_NETWORK }); | ||
| if ((!supportedNetworks || !supportedNetworks.includes(chainId.chainId)) && !sponsorshipPolicy.isApplicableToAllNetworks) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.UNSUPPORTED_NETWORK }); | ||
|
|
||
| if (txnMode) { | ||
| const signerAddress = await signer.getAddress(); | ||
|
|
@@ -255,11 +255,13 @@ const paymasterRoutes: FastifyPluginAsync<PaymasterRoutesOpts> = async (server, | |
| const contractWhitelistResult = await checkContractWhitelist(userOp.callData, chainId.chainId, signer.address); | ||
| if (!contractWhitelistResult) throw new Error('Contract Method not whitelisted'); | ||
| } | ||
| /* Removed Whitelist for now | ||
| const isWhitelisted = await checkWhitelist(api_key, epVersion, userOp.sender, sponsorshipPolicy.id); | ||
| // For EPV_06 we still use the old paymaster which whitelists the address on-chain if its verifyingPaymaster it goes to case vps for EPV_06 which checks on db | ||
| if (!isWhitelisted && epVersion !== EPVersions.EPV_06) { | ||
| throw new Error('This sender address has not been whitelisted yet'); | ||
| } | ||
| */ | ||
|
Comment on lines
+258
to
+264
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Security concern: Complete removal of whitelist validation. The whitelist validation has been entirely disabled by commenting out the code. While the PR indicates this is temporary, this creates a significant security gap as sender addresses are no longer validated against whitelists. Recommendations:
Consider implementing a feature flag approach: - /* Removed Whitelist for now
- const isWhitelisted = await checkWhitelist(api_key, epVersion, userOp.sender, sponsorshipPolicy.id);
- // For EPV_06 we still use the old paymaster which whitelists the address on-chain if its verifyingPaymaster it goes to case vps for EPV_06 which checks on db
- if (!isWhitelisted && epVersion !== EPVersions.EPV_06) {
- throw new Error('This sender address has not been whitelisted yet');
- }
- */
+ const whitelistEnabled = process.env.ENABLE_WHITELIST_VALIDATION !== 'false';
+ if (whitelistEnabled) {
+ const isWhitelisted = await checkWhitelist(api_key, epVersion, userOp.sender, sponsorshipPolicy.id);
+ if (!isWhitelisted && epVersion !== EPVersions.EPV_06) {
+ throw new Error('This sender address has not been whitelisted yet');
+ }
+ }Also applies to: 394-399, 599-615 🤖 Prompt for AI Agents |
||
| if (epVersion === EPVersions.EPV_06) | ||
| result = await paymaster.signV06(userOp, str, str1, entryPoint, networkConfig.contracts.etherspotPaymasterAddress, bundlerUrl, signer, estimate, server.log); | ||
| else if (epVersion === EPVersions.EPV_07) { | ||
|
|
@@ -363,7 +365,7 @@ const paymasterRoutes: FastifyPluginAsync<PaymasterRoutesOpts> = async (server, | |
|
|
||
| // get supported networks from sponsorshipPolicy | ||
| const supportedNetworks: number[] | undefined | null = sponsorshipPolicy.enabledChains; | ||
| if (!supportedNetworks || !supportedNetworks.includes(chainId.chainId)) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.UNSUPPORTED_NETWORK }); | ||
| if ((!supportedNetworks || !supportedNetworks.includes(chainId.chainId)) && !sponsorshipPolicy.isApplicableToAllNetworks) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.UNSUPPORTED_NETWORK }); | ||
|
|
||
| if (txnMode) { | ||
| const signerAddress = await signer.getAddress(); | ||
|
|
@@ -389,10 +391,12 @@ const paymasterRoutes: FastifyPluginAsync<PaymasterRoutesOpts> = async (server, | |
| if (!contractWhitelistResult) throw new Error('Contract Method not whitelisted'); | ||
| } | ||
|
|
||
| /* Removed Whitelist | ||
| const isWhitelisted = await checkWhitelist(api_key, epVersion, userOp.sender, sponsorshipPolicy.id); | ||
| if (!isWhitelisted) { | ||
| throw new Error('This sender address has not been whitelisted yet'); | ||
| } | ||
| */ | ||
|
|
||
| if (epVersion === EPVersions.EPV_06) { | ||
| if (!apiKeyEntity.verifyingPaymasters) { | ||
|
|
@@ -592,6 +596,7 @@ const paymasterRoutes: FastifyPluginAsync<PaymasterRoutesOpts> = async (server, | |
| return returnValue; | ||
| } | ||
|
|
||
| /* Removed Whitelist | ||
| async function checkWhitelist(api_key: string, epVersion: EPVersions, senderAddress: string, policyId: number) { | ||
| const globalWhitelistRecord = await server.whitelistRepository.findOneByApiKeyAndPolicyId(api_key); | ||
| if (!globalWhitelistRecord?.addresses?.includes(senderAddress)) { | ||
|
|
@@ -607,7 +612,7 @@ const paymasterRoutes: FastifyPluginAsync<PaymasterRoutesOpts> = async (server, | |
| } | ||
| } | ||
| return true; | ||
| } | ||
| } */ | ||
| }; | ||
|
|
||
| export default paymasterRoutes; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Fix markdown formatting issues while maintaining good changelog content.
The changelog entry accurately documents the changes, but there are formatting issues that should be addressed for consistency with markdown standards.
Apply this diff to fix the formatting:
📝 Committable suggestion
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
2-2: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
2-2: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
3-3: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
3-3: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
4-4: Lists should be surrounded by blank lines
null
(MD032, blanks-around-lists)
🤖 Prompt for AI Agents