Skip to content

Initialize scripts#26

Open
dannpl wants to merge 4 commits into
pump-fun:mainfrom
dannpl:main
Open

Initialize scripts#26
dannpl wants to merge 4 commits into
pump-fun:mainfrom
dannpl:main

Conversation

@dannpl

@dannpl dannpl commented Feb 23, 2026

Copy link
Copy Markdown
  • Create Token
  • Buy Token
  • Sell Token

Note

Medium Risk
Introduces a script that can create and immediately buy a token on Solana and upload metadata to a third-party endpoint; mistakes in RPC/config or key handling can lead to unintended on-chain transactions and fund loss.

Overview
Adds a new scripts package that can create a pump.fun token and optionally seed an initial buy by building and submitting a Solana v0 transaction via @pump-fun/pump-sdk.

Includes a helper to upload token metadata (image + socials) to pump.fun’s IPFS API using fetch/undici, and updates .gitignore to exclude node_modules (plus adds a yarn.lock for the scripts dependencies).

Written by Cursor Bugbot for commit b39db3e. This will update automatically on new commits. Configure here.

@socket-security

socket-security Bot commented Feb 23, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​types/​bn.js@​5.2.01001007481100
Added@​solana/​spl-token@​0.4.69910010081100
Added@​solana/​web3.js@​1.93.19510010084100
Addedtypescript@​5.2.21001009010090
Added@​pump-fun/​pump-sdk@​1.28.09010010097100
Addedundici@​7.22.09610010097100

View full report

@socket-security

socket-security Bot commented Feb 23, 2026

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: npm @pump-fun/pump-sdk is 98.0% likely obfuscated

Confidence: 0.98

Location: Package overview

From: scripts/package.jsonnpm/@pump-fun/pump-sdk@1.28.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@pump-fun/pump-sdk@1.28.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
High CVE: npm bigint-buffer Vulnerable to Buffer Overflow via toBigIntLE() Function

CVE: GHSA-3gc7-fjrx-p6mg bigint-buffer Vulnerable to Buffer Overflow via toBigIntLE() Function (HIGH)

Affected versions: <= 1.1.5

Patched version: No patched versions

From: ?npm/@pump-fun/pump-sdk@1.28.0npm/@solana/spl-token@0.4.6npm/@solana/web3.js@1.93.1npm/bigint-buffer@1.1.5

ℹ Read more on: This package | This alert | What is a CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known high severity CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/bigint-buffer@1.1.5. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

Comment thread scripts/create-token.ts Outdated
let request = await fetch("https://pump.fun/api/ipfs", {
method: "POST",
headers: {
Host: "www.pump.fun",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Host header mismatches the request URL domain

Medium Severity

The fetch request targets https://pump.fun/api/ipfs but the Host header is manually set to www.pump.fun. This domain mismatch between the URL and the Host header can cause the server to reject the request, route it incorrectly, or fail TLS validation depending on server configuration.

Fix in Cursor Fix in Web

Comment thread scripts/create-token.ts Outdated
Comment thread scripts/create-token.ts
console.log("✅ Token created successfully!");
};

createToken();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Module-level invocation causes side effects on import

Medium Severity

createToken() is called at module scope in a file that index.ts re-exports via export * from "./create-token". This means any import of the package (or running node ./dist/index.js) will unconditionally execute createToken. When the planned Buy Token and Sell Token scripts are added and similarly re-exported from index.ts, running the entry point will execute all scripts simultaneously rather than the intended one. The module-level constants (RPC_URL, creator, CONNECTION) also evaluate eagerly on import, which prevents this from functioning as a reusable library.

Additional Locations (1)

Fix in Cursor Fix in Web

formData.append("twitter", create.twitter || ""),
formData.append("telegram", create.telegram || ""),
formData.append("website", create.website || ""),
formData.append("showName", "true"));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comma operator obscures sequential append calls

Low Severity

The formData.append calls are chained using the comma operator inside a single expression statement with wrapping parentheses. While functionally correct, this is a very unusual and confusing pattern — the parenthesized group evaluates each sub-expression but discards all results except the last. Using separate statements would be much clearer and less error-prone.

Fix in Cursor Fix in Web

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Comment thread scripts/create-token.ts
website: TOKEN_WEBSITE,
});
const metadataUri = (metadata as any).metadataUri ?? (metadata as any).uri;
console.log("✅ Metadata URI:", metadataUri);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metadata upload failure silently produces undefined URI

Medium Severity

When createTokenMetadata catches an error, it returns { success: false, error }. The caller extracts metadataUri via (metadata as any).metadataUri ?? (metadata as any).uri, which resolves to undefined on this error object. The script then proceeds to build and submit a transaction with uri: undefined, producing a confusing downstream failure instead of surfacing the actual metadata upload error.

Additional Locations (1)

Fix in Cursor Fix in Web

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

},
body: formData,
});
return request.json();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing await on request.json() bypasses try-catch

Medium Severity

return request.json() returns the promise without awaiting it inside the try block. If the response body isn't valid JSON, the resulting rejection won't be caught by the surrounding catch, which was clearly intended to handle all errors and return { success: false, error }. This needs return await request.json() for the try-catch to work as expected.

Fix in Cursor Fix in Web

Comment thread scripts/create-token.ts
const TOKEN_TELEGRAM = "https://t.me/mytoken";
const TOKEN_WEBSITE = "https://mytoken.com";

const creator = Keypair.generate();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random keypair generates unfunded creator every run

High Severity

Keypair.generate() creates a fresh random keypair with zero SOL balance on every execution. Since createToken() is invoked at module scope (line 91), this script will always submit a transaction from an unfunded account, guaranteeing failure. The creator keypair needs to be loaded from a file or environment variable to reference a funded wallet.

Fix in Cursor Fix in Web

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