Skip to content

Commit e7a47d5

Browse files
feat: enhance meta-tx handler tests with comprehensive coverage for s… (#1018)
* feat: enhance meta-tx handler tests with comprehensive coverage for signing functions - Added tests for various signing functions including signMetaTx, signMetaTxCreateSeller, signMetaTxUpdateSeller, and others. - Implemented assertions for signed meta transactions and structured data. - Introduced shared constants and helper functions to streamline test setup. - Updated existing tests to utilize new constants and improve readability. - Ensured compatibility with Biconomy paths in relevant test cases. * lint * fix: update documentation for completeExchangeBatch to completeExchange in meta transaction signing * feat: add comprehensive tests for MetaTxMixin functions in mixin.test.ts * refactor: improve formatting and readability in mixin.test.ts * feat: add settings.json for claude configuration with permissions * feat: enhance MetaTxMixin tests with additional assertions and mock data * feat: add Claude code instructions for post-task linting process * refactor: improve code formatting and readability in mixin.test.ts * fix: normalize BigNumberish nonce to string in signMetaTx message Agent-Logs-Url: https://github.com/bosonprotocol/core-components/sessions/aabe43be-8339-4df3-8e78-18e865c3f825 Co-authored-by: levalleux-ludo <7184124+levalleux-ludo@users.noreply.github.com> * feat: enhance signNativeMetaTx and signNativeMetaTxApproveExchangeToken with overloads for returnTypedDataToSign; add comprehensive tests for both functions * refactor: update signNativeMetaTx and related functions to return UnsignedMetaTx instead of StructuredData - Changed return type of signNativeMetaTx and signNativeMetaTxApproveExchangeToken functions to UnsignedMetaTx. - Updated implementation to include functionName and functionSignature in the returned UnsignedMetaTx. - Modified tests to assert against UnsignedMetaTx instead of StructuredData, ensuring correct structure and presence of new fields. - Adjusted mixin methods to align with the updated return types and assertions. * fix: convert nonce to string in signNativeMetaTx message * refactor: remove debug logging from meta-tx tests --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: levalleux-ludo <7184124+levalleux-ludo@users.noreply.github.com>
1 parent 95432e5 commit e7a47d5

12 files changed

Lines changed: 4466 additions & 258 deletions

File tree

.claude/settings.json

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
// ========== WEB FETCH ==========
5+
"WebFetch(*)",
6+
7+
// ========== FILE OPERATIONS (read-only & safe writes) ==========
8+
"Bash(ls:*)",
9+
"Bash(pwd:*)",
10+
"Bash(cat:*)",
11+
"Bash(mkdir:*)",
12+
"Bash(cp:*)",
13+
"Bash(mv:*)",
14+
"Bash(find:*)",
15+
"Bash(grep:*)",
16+
"Bash(sed:*)",
17+
"Bash(awk:*)",
18+
"Bash(sort:*)",
19+
"Bash(uniq:*)",
20+
"Bash(wc:*)",
21+
"Bash(head:*)",
22+
"Bash(tail:*)",
23+
"Bash(touch:*)",
24+
"Bash(tree:*)",
25+
"Bash(du:*)",
26+
"Bash(df:*)",
27+
28+
// ========== NODE.JS / PACKAGE MANAGEMENT ==========
29+
"Bash(node:*)",
30+
"Bash(npm:*)",
31+
"Bash(npx:*)",
32+
"Bash(yarn:*)",
33+
"Bash(pnpm:*)",
34+
35+
// ========== TYPESCRIPT / BUILD ==========
36+
"Bash(tsc:*)",
37+
"Bash(ts-node:*)",
38+
39+
// ========== TESTING ==========
40+
"Bash(jest:*)",
41+
42+
// ========== LINTING / FORMATTING ==========
43+
"Bash(eslint:*)",
44+
"Bash(prettier:*)",
45+
46+
// ========== SAFE GIT OPERATIONS ==========
47+
"Bash(git status:*)",
48+
"Bash(git log:*)",
49+
"Bash(git diff:*)",
50+
"Bash(git show:*)",
51+
"Bash(git branch:*)",
52+
"Bash(git stash list:*)",
53+
"Bash(git tag:*)",
54+
"Bash(git remote -v:*)",
55+
"Bash(git fetch:*)",
56+
"Bash(git add:*)",
57+
"Bash(git commit:*)",
58+
"Bash(git checkout:*)",
59+
"Bash(git merge:*)",
60+
"Bash(git rebase:*)",
61+
62+
// ========== TEXT PROCESSING & UTILITIES ==========
63+
"Bash(echo:*)",
64+
"Bash(printf:*)",
65+
"Bash(tr:*)",
66+
"Bash(cut:*)",
67+
"Bash(xargs:*)",
68+
"Bash(jq:*)",
69+
"Bash(base64:*)",
70+
71+
// ========== PROCESS INFO (read-only) ==========
72+
"Bash(ps:*)",
73+
"Bash(whoami:*)",
74+
"Bash(which:*)",
75+
"Bash(where:*)",
76+
77+
// ========== MISC UTILITIES ==========
78+
"Bash(date:*)",
79+
"Bash(sleep:*)",
80+
"Bash(test:*)",
81+
"Bash(zip:*)",
82+
"Bash(unzip:*)"
83+
],
84+
85+
"deny": [
86+
// ========== DESTRUCTIVE FILESYSTEM OPERATIONS ==========
87+
"Bash(rm -rf /)",
88+
"Bash(rm -rf *)",
89+
"Bash(rm -rf ./*)",
90+
"Bash(rm -rf ../*)",
91+
"Bash(dd if=/dev/zero*)",
92+
"Bash(mkfs.*)",
93+
"Bash(format:*)",
94+
95+
// ========== DESTRUCTIVE GIT OPERATIONS ==========
96+
"Bash(git push:*)",
97+
"Bash(git push --force:*)",
98+
"Bash(git push -f:*)",
99+
"Bash(git reset --hard:*)",
100+
"Bash(git clean -f:*)",
101+
"Bash(git clean -fd:*)",
102+
"Bash(git checkout -- .:*)",
103+
"Bash(git branch -D:*)",
104+
"Bash(git restore .:*)",
105+
106+
// ========== PRIVILEGE ESCALATION ==========
107+
"Bash(sudo:*)",
108+
"Bash(su:*)",
109+
"Bash(doas:*)",
110+
111+
// ========== FORK BOMBS ==========
112+
"Bash(:(){:|:&};:)",
113+
114+
// ========== REVERSE SHELLS ==========
115+
"Bash(/dev/tcp/*)",
116+
"Bash(/dev/udp/*)",
117+
"Bash(nc -e /bin/bash*)",
118+
"Bash(bash -c 'exec 1<>/dev/tcp/*')",
119+
120+
// ========== PIPE-EXEC FROM REMOTE ==========
121+
"Bash(curl * | bash*)",
122+
"Bash(curl * | sh*)",
123+
"Bash(wget * | bash*)",
124+
"Bash(wget * | sh*)",
125+
"Bash(source <(curl*)",
126+
"Bash(bash <(curl*)",
127+
128+
// ========== CREDENTIAL THEFT ==========
129+
"Bash(cat /etc/shadow*)",
130+
"Bash(cat /etc/passwd*)",
131+
"Bash(cat ~/.ssh/id_rsa*)",
132+
"Bash(cat ~/.aws/credentials*)",
133+
"Bash(cat ~/.docker/config.json*)",
134+
"Bash(cat ~/.kube/config*)",
135+
136+
// ========== PROCESS KILLING ==========
137+
"Bash(kill -9:*)",
138+
"Bash(killall:*)",
139+
140+
// ========== LOG & AUDIT DELETION ==========
141+
"Bash(history -c*)",
142+
"Bash(cat /dev/null > ~/.bash_history*)",
143+
144+
// ========== CLOUD METADATA EXPLOITS ==========
145+
"Bash(curl http://169.254.169.254/*)",
146+
"Bash(curl http://metadata.google.internal/*)",
147+
148+
// ========== DANGEROUS EVAL / INJECTION ==========
149+
"Bash(eval:*)",
150+
151+
// ========== KERNEL / SYSTEM MODIFICATION ==========
152+
"Bash(sysctl -w*)",
153+
"Bash(modprobe:*)",
154+
"Bash(insmod:*)",
155+
"Bash(rmmod:*)",
156+
"Bash(iptables -F*)"
157+
]
158+
}
159+
}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@ scripts/abi-signatures.csv
4141
storybook-static
4242
.qodo
4343
.env
44+
45+
# claude
46+
.claude/settings.local.json

CLAUDE.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Claude Code Instructions
2+
3+
## Post-task linting
4+
5+
After completing any task (once code and test changes have been functionally validated), always run:
6+
7+
```bash
8+
npm run lint:fix
9+
```
10+
11+
This fixes linting issues introduced by the changes before considering the task done.
12+
13+
Run it **without a `cd &&` prefix** — use `npm run lint:fix` directly so it matches the `Bash(npm:*)` allow rule and does not prompt for authorisation.

0 commit comments

Comments
 (0)