Skip to content

Potential fix for code scanning alert no. 24: Property access on null or undefined - #24

Open
developerEhsan wants to merge 1 commit into
masterfrom
alert-autofix-24
Open

Potential fix for code scanning alert no. 24: Property access on null or undefined#24
developerEhsan wants to merge 1 commit into
masterfrom
alert-autofix-24

Conversation

@developerEhsan

Copy link
Copy Markdown
Owner

Potential fix for https://github.com/developerEhsan/api-client/security/code-scanning/24

To fix this without changing functionality, replace the runtime-initialized ctx (undefined as unknown as ModuleContext) with a type-only declared variable. In TypeScript, declare const ctx: ModuleContext; provides the type for compile-time checks but emits no runtime value initialization, which avoids creating an always-undefined base expression while preserving all existing type assertions and @ts-expect-error checks.

Edit in packages/core/src/factory/request-events.test-d.ts:

  • In the it('ctx.request enforces path params at the call site', ...) block, replace:
    • const ctx = undefined as unknown as ModuleContext;
  • With:
    • declare const ctx: ModuleContext;

No new imports, helper methods, or dependencies are required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

… or undefined

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@vercel
vercel Bot temporarily deployed to Preview – api-client-react-vite July 30, 2026 14:02 Inactive
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
api-client-nextjs Skipped Skipped Jul 30, 2026 2:02pm
api-client-react-vite Skipped Skipped Jul 30, 2026 2:02pm

@vercel
vercel Bot temporarily deployed to Preview – api-client-nextjs July 30, 2026 14:02 Inactive
@developerEhsan
developerEhsan marked this pull request as ready for review July 30, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant