fix(spend-permission): throw in production guard instead of console.warn#334
Open
faisalnugroho wants to merge 1 commit into
Open
fix(spend-permission): throw in production guard instead of console.warn#334faisalnugroho wants to merge 1 commit into
faisalnugroho wants to merge 1 commit into
Conversation
The production guard in createSpendPermissionTypedDataWithSeconds used console.warn, which only logs a warning but allows the test-only function to execute in production. Changed to throw an Error to prevent silent misuse. Closes base#325
Collaborator
🟡 Heimdall Review Status
|
Author
|
Hi! Following up on this bug fix PR. This PR changes the production guard from console.warn to a thrown error when an invalid spend permission is detected. Currently, invalid permissions silently pass through in production, which could allow unauthorized spend operations. Would appreciate your review. All CI checks pass (StepSecurity ✅). Would love to get your review when you have a moment. Thanks! |
Author
|
Hi! I'd love to get this PR reviewed when you have a moment. This PR addresses throw in production guard instead of console.warn. Happy to make any adjustments based on your feedback. Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The production guard in
createSpendPermissionTypedDataWithSeconds(utils.ts:126-131) usesconsole.warnwhich only logs a warning but allows the test-only function to execute in production.Impact: The
@testOnlyfunction can be accidentally used in production without any hard failure, potentially causing incorrect spend permission behavior with raw seconds instead of days.Fix
Changed
console.warn(...)tothrow new Error(...)to prevent silent misuse in production environments.Test Plan
Closes #325