diff --git a/.github/workflows/ai-pr-review.yml b/.github/workflows/ai-pr-review.yml
index b219136..69d4058 100644
--- a/.github/workflows/ai-pr-review.yml
+++ b/.github/workflows/ai-pr-review.yml
@@ -2,7 +2,7 @@ name: ⚡ Flash PR Review
on:
pull_request_target:
- types: [opened, synchronize]
+ types: [opened, synchronize, reopened, ready_for_review]
permissions:
contents: read
@@ -22,11 +22,13 @@ jobs:
github.event.pull_request.user.login != 'dependabot[bot]'
steps:
- - name: Checkout PR Head
+ # SECURITY: Check out the BASE ref so we run trusted scripts only.
+ # The fork's code is never checked out — we only fetch its diff via git.
+ - name: Checkout Base (trusted scripts)
uses: actions/checkout@v4
with:
- ref: ${{ github.event.pull_request.head.sha }}
- fetch-depth: 0
+ ref: ${{ github.event.pull_request.base.sha }}
+ persist-credentials: false
- name: Setup Node
uses: actions/setup-node@v4
@@ -34,16 +36,21 @@ jobs:
node-version: 20
- name: Get PR Diff
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
- git fetch origin ${{ github.base_ref }} --depth=1
- git diff origin/${{ github.base_ref }}...HEAD > pr.diff
+ # Fetch the diff via GitHub API — no fork checkout needed
+ gh api \
+ repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} \
+ -H "Accept: application/vnd.github.v3.diff" \
+ > pr.diff
DIFF_SIZE=$(wc -c < pr.diff)
echo "diff_size=$DIFF_SIZE" >> $GITHUB_ENV
echo "📄 Diff size: $DIFF_SIZE bytes"
- # Extract changed file list
- git diff --name-only origin/${{ github.base_ref }}...HEAD > changed-files.txt
+ # Extract changed file list from the diff
+ grep -E '^\+\+\+ b/' pr.diff | sed 's|^\+\+\+ b/||' > changed-files.txt || true
echo "📁 Changed files:"
cat changed-files.txt
@@ -51,20 +58,25 @@ jobs:
if: env.diff_size == '0'
run: echo "Empty diff, skipping review"
+ # SECURITY: Build PR context JSON safely via Node.js to avoid
+ # shell injection from untrusted PR titles / branch names.
- name: Get PR Context
if: env.diff_size != '0'
- run: |
- # Save PR body to file (avoids shell escaping issues)
- cat > pr-context.json << 'PREOF'
- {
- "title": "${{ github.event.pull_request.title }}",
- "author": "${{ github.event.pull_request.user.login }}",
- "number": ${{ github.event.pull_request.number }},
- "base": "${{ github.base_ref }}",
- "head": "${{ github.head_ref }}",
- "action": "${{ github.event.action }}"
- }
- PREOF
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const fs = require('fs')
+ const pr = context.payload.pull_request
+ const meta = {
+ title: pr.title,
+ author: pr.user.login,
+ number: pr.number,
+ base: pr.base.ref,
+ head: pr.head.ref,
+ action: context.payload.action,
+ }
+ fs.writeFileSync('pr-context.json', JSON.stringify(meta, null, 2))
+ console.log('📋 PR context written safely')
- name: Run Flash Review
if: env.diff_size != '0'
@@ -73,7 +85,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO_OWNER: ${{ github.repository_owner }}
- REPO_NAME: ${{ github.event.repository.name }}
+ REPO_NAME: ${{ github.event.pull_request.base.repo.name }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: node scripts/ai-review/review.js
@@ -139,12 +151,14 @@ jobs:
return
}
+ const headSha = '${{ github.event.pull_request.head.sha }}'
+
// Post as a pull request review with inline comments
try {
await github.rest.pulls.createReview({
...context.repo,
pull_number: context.issue.number,
- commit_id: '${{ github.event.pull_request.head.sha }}',
+ commit_id: headSha,
event: 'COMMENT',
comments: comments.map((c) => ({
path: c.path,
@@ -162,7 +176,7 @@ jobs:
await github.rest.pulls.createReviewComment({
...context.repo,
pull_number: context.issue.number,
- commit_id: '${{ github.event.pull_request.head.sha }}',
+ commit_id: headSha,
path: c.path,
line: c.line,
body: c.body,
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 0c98aba..9cf8a59 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -2,7 +2,7 @@ name: ✅ CI
on:
pull_request:
- types: [opened, synchronize]
+ types: [opened, synchronize, reopened, ready_for_review]
concurrency:
group: ci-${{ github.event.pull_request.number }}
diff --git a/eslint.config.mjs b/eslint.config.mjs
index 60e96eb..8d3f733 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -16,6 +16,8 @@ const eslintConfig = defineConfig([
destructuredArrayIgnorePattern: "^_",
},
],
+ "@typescript-eslint/no-explicit-any": "warn",
+ "@typescript-eslint/ban-ts-comment": "warn",
},
},
// Override default ignores of eslint-config-next.
@@ -25,8 +27,10 @@ const eslintConfig = defineConfig([
"out/**",
"build/**",
"next-env.d.ts",
- // Non-Next.js files
+ // Non-source directories
"scripts/**",
+ "documentation/**",
+ "inspiration/**",
]),
]);
diff --git a/package.json b/package.json
index f874fd2..314023d 100644
--- a/package.json
+++ b/package.json
@@ -79,6 +79,5 @@
"tw-animate-css": "^1.4.0",
"typescript": "^5",
"vitest": "^4.1.2"
- },
- "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
+ }
}
diff --git a/src/app/api/transactions/initiate/route.ts b/src/app/api/transactions/initiate/route.ts
index b60344e..03e4b52 100644
--- a/src/app/api/transactions/initiate/route.ts
+++ b/src/app/api/transactions/initiate/route.ts
@@ -12,7 +12,7 @@ const initiateSchema = z.object({
fromAmount: z.string(),
toAmount: z.string(),
provider: z.string().default('lifi'),
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
+
route: z.any(),
toAddress: z.string().optional(), // receiver wallet for P2P direct hits (android)
})
diff --git a/src/app/api/v1/webhooks/route.ts b/src/app/api/v1/webhooks/route.ts
index 6be1e67..a287d9b 100644
--- a/src/app/api/v1/webhooks/route.ts
+++ b/src/app/api/v1/webhooks/route.ts
@@ -118,8 +118,8 @@ export async function GET(req: NextRequest) {
// Fetch delivery stats for all endpoints in two queries
const endpointIds = (endpoints || []).map((ep: { id: string }) => ep.id)
- let totalsByEndpoint: Record
- This allows you to verify the payment status and show a "Thank You" page on your own domain. + This allows you to verify the payment status and show a “Thank You” page on your own domain.
diff --git a/src/app/page.tsx b/src/app/page.tsx index 9bdfba0..f79744d 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -100,9 +100,8 @@ export default function Home() { const { isConnected } = useAppKitAccount() const [mounted, setMounted] = useState(false) - useEffect(() => { - setMounted(true) - }, []) + // eslint-disable-next-line react-hooks/set-state-in-effect -- standard hydration guard + useEffect(() => { setMounted(true) }, []) // Only trust wallet state after hydration to prevent SSR mismatch const walletReady = mounted && isConnected diff --git a/src/components/Dither.tsx b/src/components/Dither.tsx index c59fd5b..f01cbc3 100644 --- a/src/components/Dither.tsx +++ b/src/components/Dither.tsx @@ -155,9 +155,10 @@ class RetroEffectImpl extends Effect { } } +const WrappedRetroEffect = wrapEffect(RetroEffectImpl); + const RetroEffect = forwardRef