Repository navigation
Add client-side import/export for saved recipes - #36
Conversation
|
Thanks for the contribution, @mannubaveja007! Great work getting this implemented so quickly. The overall approach looks good, and all CI checks are passing. I reviewed the changes and found a few edge cases I'd like you to address before merging:
Please also add regression tests covering these cases. Thanks again for the work! Looking forward to the updated PR. |
67d990e to
64a6947
Compare
|
Updated per review:
All checks/tests pass. |
|
Thanks for the updates, @mannubaveja007! Great work addressing the previous feedback. CI and CodeQL are passing. I found a couple of remaining edge cases before we merge:
Please add regression tests for these cases as well. Once these are addressed, I'll review the updated changes again. Thanks for your continued work on DecodeBox! |
|
Updated:
Ready for re-review. |
|
Fixed the failing test: malformed steps still drop the whole recipe, while valid imported args are sanitized against operation definitions. Pushed. |
|
Thanks for the latest update! I reviewed commit However, I found a few remaining issues: 1. In if (def.type === 'toggleString' && def.toggleValues &&
!def.toggleValues.includes(String(value))) {
value = def.value;
}
As a result, custom values such as AES keys, IVs, and salts can be replaced with their defaults during import. The imported Please validate and restore 2. Numeric arguments still lack operation-defined range validation The current implementation checks whether a numeric value is a number, but does not enforce the operation's For example, Argon2 defines memory and iteration limits, but a crafted recipe can bypass these UI-level constraints and supply excessive values. Please enforce finite-number validation and the actual operation-defined boundaries before restoring imported values. This is particularly important for memory- and CPU-intensive operations such as Argon2 and scrypt. 3. Potential regression in lazy loading The static import of Since the engine is intentionally lazy-loaded, please verify the production bundle output and consider a lightweight validation registry that preserves the existing loading architecture. 4. Additional regression tests Please add tests covering:
The latest changes are moving in the right direction, and the versioning issue is now resolved. I'd like to see these remaining edge cases covered before approving the PR. Thanks again for your continued work! |
|
Thanks for the update! The lazy-loading improvement and numeric validation changes look good. I reviewed the latest commit, and there are still two important issues I'd like to address before approving this PR. 1.
|
|
Thanks for the latest update, Mannu! I reviewed the latest commit ( I also checked the latest CI and CodeQL results, and everything is passing. Great work! I found three remaining edge cases that I'd like you to address before we can approve and merge this PR. 1. Fail-open behavior when the operation catalogue is unavailableFile: Currently: if (operations.length > 0 && !op) return null;When In the actual application flow, operations are loaded asynchronously. If a user imports recipes before the catalogue is available, validation can be bypassed. Expected behavior:
2. Argument type validationFile:
For example, an argument defined as Expected behavior:
3. Persist normalized recipes correctlyFile: In if (valid.length !== recipes.length) persist(valid);This only persists changes when the number of recipes changes. However, a recipe can remain valid while some of its arguments are normalized or corrected. In that case, the updated version is returned to the store but is not persisted to localStorage. Expected behavior:
4. Additional regression testsPlease add tests covering:
I appreciate your effort and the improvements you've made so far. Please address these remaining cases and push an updated commit. Once they're covered and the tests pass, I'll review the PR again. Thanks for your patience and continued contributions! |
|
Addressed the latest review: imports now reject when the operation catalogue is unavailable, args are validated per type, normalized recipes persist on content changes, and tests cover these cases. |
|
Fixed both gaps: normalizeRecipes now fails closed on an empty catalogue (and loadOperations skips normalization), and normalization uses the persist result so Zustand stays in sync with localStorage, including the 100-recipe trim. Added tests. |
|
Thanks for the latest updates, Mannu! I reviewed the new commits and the normalization changes look good. I noticed one remaining startup edge case: Please add a guard inside Once this is addressed, I'm happy to approve and merge the PR. Thanks again for your patience and excellent work! |
|
Thanks a lot, Mannu, for your patience and dedication throughout this PR. I really appreciate your hard work, responsiveness, and willingness to address all the feedback. Great contribution to OWASP DecodeBox — looking forward to more collaborations! |
Fixes #35
Summary
Adds export/import for saved recipes, entirely client-side.
Implementation
exportRecipes()serializes saved recipes to JSON.importRecipes()validates entries, skips duplicates and invalid data, respects the 100-recipe limit, and merges without overwriting.Tests
src/lib/recipes.test.tscovering round-trip import/export, invalid JSON, and duplicate-id handling.