Sample audits · Open-source projects, first eight

solana-foundation/solana-web3.js

The JavaScript SDK for Solana.

Summary card for this audit: 65 findings after review, 0 High, 9 Medium, 41 Low, 15 Info
Auditedsolana-foundation/solana-web3.js at commit 8837d96f7ce5b446c5f95f1a6dd58647b1eb02b1
Date11 October 2026 (audited again; first audit 11 October 2026)
How it ranlocal run on our workstation, full audit, Standard review
Verdict after reviewPass with notes (Fail if a High finding remains after review, otherwise Pass with notes)
0
High after review
9
Medium after review
41
Low after review
15
Info after review
0
excluded on review

Compared with the first audit

Same commit as the first audit: the project's default branch has no later commits (checked 11 October 2026), so nothing could have been fixed upstream in between. Each finding of the first audit (11 October 2026) was checked again against the code audited now. 25 findings in the first audit; 23 still open (15 found again, 8 not reported again but still present); 2 not in the code, so the first audit was wrong there. This audit has 65 findings after review, 49 of them new.

First auditFindingReviewed rating thenNowIn this audit
#1Example sign-in no nonceInfoStill open#1, #2
#2No secure-context checkInfoStill open#6
#3WS reconnect with no backoffMediumStill open#59
#4Failed disconnect leaves selection clearedLowStill open#25
#5Nonce confirmation pollsInfoStill open#11
#6Cached blockhash ignores commitment/slotNot in the code: the first audit was wrong herenot reported again
#7Abort listeners never removedLowStill open#8
#8ConnectionProvider never closes connectionsLowStill opennot reported again
#9useLocalStorage not syncedLowStill open#23
#10Lockup.default shared mutableInfoStill open#21
#11Loader.chunkSize mutable mid-uploadNot in the code: the first audit was wrong herenot reported again
#12Dead commitment branches, contradicting commentLowStill opennot reported again
#13Wire parser: no size cap, quadratic populateMediumStill open#31
#14connection.ts about 6,600 linesLowStill open#26
#15stake.ts combines five classesLowStill open#33
#16legacy.ts mixes four jobsLowStill open#34
#17Blockhash flag + sleep loopLowStill open#28
#18Repeated connect() not joinedInfoStill opennot reported again
#19Example send flow repeated 4xLowStill open#38
#20console.error scatteredInfoStill opennot reported again
#21Release does not test exact tarballsLowStill opennot reported again
#22Release gate unit tests onlyLowStill opennot reported again
#23Same callback twice: removing one cancels otherMediumStill open#9
#24gh-pages action by mutable tagMediumStill opennot reported again
#25CI pipes unverified installer to shLowStill opennot reported again
How to read this page

Each finding keeps the number it has in the audit report. The rating shown first is the one after review; the first automated rating is listed with it. 16 findings were first rated Medium or High; 9 of them are Medium or High after review. Text marked "From the report" is quoted from the audit report; fixes are suggestions and were not tested. Code locations link to the file and line at the audited commit.

Medium after review (9)

9. Medium Removing one of two identical subscriptions silently stops the other
First rating: Medium · Reviewed rating: Medium · Review: confirmed · also in the first audit (#23)
From the report
Evidence
(subscription.callbacks as Set<SubscriptionConfig['callback']>).delete(
  callback,
);
Why it matters

registering the same callback twice for the same subscription gives two client ids but only one entry in the Set. Removing either id deletes the shared entry, and the other registration stops receiving notifications without any error.

Suggested fix, not tested

store one entry per client subscription id (a Map keyed by client id), or reference-count the callbacks per hash. Delete only the entry that belongs to the id being removed.

13. Medium Batch transaction fetch opens one request per signature with no limit
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
return await Promise.all(
  signatures.map(signature => fetcher(signature, config)),
);
Why it matters

getTransactions and getParsedTransactions are often called with hundreds of signatures (up to 1000 from getSignaturesForAddress). Every request starts at once, which triggers rate limiting (HTTP 429) and socket exhaustion. The retries then add more load on top.

Suggested fix, not tested

send through a bounded worker pool (5 to 10 requests in flight), or use a single JSON-RPC batch request.

31. Medium Wire transaction parsing has no size cap and a nested string-compare scan
First rating: Low · Reviewed rating: Medium · Review: confirmed, rated higher on review · also in the first audit (#13)
From the report
Evidence
isSigner:
  transaction.signatures.some(
    keyObj => keyObj.publicKey.toString() === pubkey.toString(),
Why it matters

every key comparison base58-encodes both keys, inside a nested loop, and the input size is never checked first.

Suggested fix, not tested

reject buffers larger than the packet size before decoding, and look keys up in a Set of signer addresses built once.

56. Medium Transaction confirmation fails in two different ways depending on which path wins
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
if (value?.err) {
  reject(value.err);
} else if (
Why it matters

when the websocket notification arrives first, a failed transaction resolves with {value: {err}}, and sendAndConfirmTransaction turns that into a SendTransactionError. When the initial status poll arrives first, the promise rejects with the raw error object, which has no message and no stack. Callers get different failure types for the same event.

Suggested fix, not tested

resolve this path with {context, value} too, exactly as the subscription callback does.

58. Medium Account lookup errors lose their error class and RPC code
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
Location: packages/web3.js/src/connection.ts:3355 (also getNonce and getLatestBlockhash)
From the report
Evidence
} catch (e) {
  throw new Error(
    'failed to get info about account ' + publicKey.toBase58() + ': ' + String(e),
Why it matters

callers can no longer branch on RPC error codes such as "minimum context slot not reached" or "node unhealthy". The "and context" variant of the same method keeps those codes.

Suggested fix, not tested

use throwSolanaRpcErrorIfNeeded, or wrap the error with {cause}.

59. Medium Websocket reconnect retries immediately with no backoff
First rating: Medium · Reviewed rating: Medium · Review: confirmed · also in the first audit (#3)
From the report
Evidence
this._disconnectChannel(
  SUBSCRIPTION_CHANNEL_CLOSE_CODE_UNEXPECTED,
  error instanceof Error ? error : new Error(String(error)),
Why it matters

a failed connect is reported as an unexpected close. The controller marks every subscription pending and calls ensureConnected again with no delay (controller.ts:162-179). An unreachable endpoint produces a tight connect-and-fail loop and a flood of log lines.

Suggested fix, not tested

add capped exponential backoff with jitter, plus a maximum attempt count or a failed state, before reconnecting. Reset the delay after a successful connect.

60. Medium A failed program chunk upload can crash the Node process
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
transactions.push(
  sendAndConfirmTransaction(connection, transaction, [payer, program], {
Why it matters

on the throttled endpoints the loop awaits a sleep while earlier chunk promises have no rejection handler yet. A chunk that fails during that wait is an unhandled rejection, which ends a Node 15+ process before the caller's try/catch can run.

Suggested fix, not tested

attach a handler to each promise as it is created (for example, collect results with Promise.allSettled), or send the chunks through a bounded queue that awaits each one.

62. Medium Changing auto-connect drops the live wallet session
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
const options = useMemo(
  () => ({autoConnect, chain, filter, storage, storageKey}),
  [chain, autoConnect, storage, storageKey, filter],
Why it matters

the layout effect disposes the wallet controller and creates a new one whenever options changes. Toggling auto-connect, as the example's checkbox does, therefore disconnects a connected user. The README and release notes do not list auto-connect as an option that rebuilds the controller.

Suggested fix, not tested

remove autoConnect from the options that rebuild the controller and pass it to the live controller instead, or document it as a rebuild trigger.

64. Medium Quick-start sample uses an endpoint that rejects browser requests
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
<ConnectionProvider endpoint="https://api.mainnet-beta.solana.com">
  <WalletProvider chain="solana:mainnet">
Why it matters

the repository's own example app warns that this endpoint rejects browser requests and that sends will fail. Developers who copy the quick start get an app that does not work.

Suggested fix, not tested

use a placeholder RPC URL, or the devnet endpoint, and note the limits of the public mainnet endpoint.

Low after review (41)

4. Low Migration guide decodes mint and token accounts without checking the owning program
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
const mintRaw = await connection.getAccountInfo(mint);
const tokenRaw = await connection.getAccountInfo(tokenAccount);
const mintData = getMintDecoder().decode(mintRaw.data);
Why it matters

an account owned by a different program is accepted as a classic token account, and so is a Token-2022 account. Payment checks built from this sample can be fooled by a substituted account.

Suggested fix, not tested

before decoding, compare mintRaw.owner and tokenRaw.owner with the expected token program (classic or Token-2022). Use the Token-2022 decoder for Token-2022 accounts.

5. Low Agent migration reference teaches the same unchecked token-account decode
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
| `getMint(connection, address)`  | `connection.getAccountInfo(pubkey)` + `getMintDecoder().decode(data)`   |
Why it matters

an AI agent that follows this table will generate the decode from finding 4, with no owner check.

Suggested fix, not tested

state in the table that the account owner must match the expected token program before the decoded values are trusted.

7. Low Fee-payer test only checks values the test itself mocked
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
await mockRpcResponse({ method: 'getBalance', params: [accountPayer.publicKey.toBase58(), ...], value: LAMPORTS_PER_SOL - 1, ...});
expect(balance <= BigInt(LAMPORTS_PER_SOL)).to.eq(true);
Why it matters

in mock mode the test compares canned answers with themselves. A bug that swaps the payer and the sender would still pass.

Suggested fix, not tested

in mock mode, assert on the transaction itself: the fee payer and the first signer are accountPayer, and the transfer source is accountFrom. Keep the balance checks for live runs only.

8. Low Abort listener added on every confirmation is never removed
First rating: Medium · Reviewed rating: Low · Review: rated too high · also in the first audit (#7)
From the report
Evidence
signal.addEventListener('abort', () => {
  reject(signal.reason);
});
Why it matters

apps often pass one long-lived AbortSignal to many confirmTransaction calls. Each call adds a listener and a promise that never settles, and neither is released, so memory grows and Node prints MaxListeners warnings.

Suggested fix, not tested

register the listener with {once: true} and remove it when the confirmation settles. Alternatively, return a {promise, dispose} pair and call dispose in a finally block.

10. Low Block dispatch settings kept in two maps that can disagree
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
setBlockDispatchConfig(hash, dispatchConfig): void {
  this._blockDispatchConfigByHash.set(hash, dispatchConfig);
}
Why it matters

the copy keyed by server id is refreshed only when a subscription changes state. A later registration for a subscription that is already active is dispatched with the old settings.

Suggested fix, not tested

when the hash already has a server subscription id, update both maps in one place. Alternatively, resolve the settings through the hash at dispatch time and drop the second map.

12. Low Post-expiry status loop has no attempt cap or deadline
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
if (status.context.slot < (outcome.slotInWhichNonceDidAdvance ?? nonceMinContextSlot ?? 0n)) {
  await Promise.race([sleep(400), cancellationPromise]);
  continue;
Why it matters

if the serving node lags and the caller passed no abort signal, an expensive full-history status query repeats every 400 ms with no end.

Suggested fix, not tested

add a deadline or a maximum attempt count with backoff, and throw a clear timeout error when it is reached.

14. Low Program load can hang forever waiting for the next slot
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
while (true) {
  try {
    const currentSlot = await connection.getSlot({
Why it matters

every getSlot error is swallowed and there is no deadline. If the RPC node becomes unreachable after the program is finalized, Loader.load never returns and never reports an error.

Suggested fix, not tested

add a deadline or a retry cap, and rethrow the last error when it is exceeded. A slot-change subscription is a cheaper signal than polling.

15. Low Program chunk uploads are sent with no concurrency cap
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
if (connection._rpcEndpoint.includes('solana.com')) {
  const REQUESTS_PER_SECOND = 4;
  await sleep(1000 / REQUESTS_PER_SECOND);
Why it matters

throttling applies only when the URL happens to contain solana.com. On any other provider, all chunk transactions for a large program are sent at once.

Suggested fix, not tested

use a bounded-concurrency queue for every endpoint and make the rate configurable. Do not decide behaviour from a substring of the URL.

16. Low Wire transaction parsing does not check the signature count
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
publicKey: message.accountKeys[index],
Why it matters

Transaction.from pairs signatures with keys by position and never checks that the counts match. Malformed input fails later with a raw TypeError on an undefined key instead of a clear validation error.

Suggested fix, not tested

assert signatures.length === message.header.numRequiredSignatures before building the pairs, as the versioned transaction already does.

17. Low Legacy message constructor accepts out-of-range indexes and header counts
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
this.instructions.forEach(ix =>
  this.indexToProgramIds.set(ix.programIdIndex, this.accountKeys[ix.programIdIndex]),
Why it matters

an out-of-range program index is stored silently as an undefined key, and the consistency of the header counts is never checked.

Suggested fix, not tested

validate the header, key and index invariants in one function that the constructor calls, so every construction path goes through it.

18. Low Versioned message headers are stored without validation
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
this.header = Object.freeze({...args.header});
Why it matters

signer and writable status is calculated from the header. A header whose read-only counts exceed the key counts makes isAccountWritable and isAccountSigner return wrong answers without any error. The same applies at message/v1.ts:175.

Suggested fix, not tested

write one shared header validator and call it from the legacy, v0 and v1 constructors and from every fromCompiledMessage.

19. Low Program-id lookup is a stored copy that goes stale when fields are mutated
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
private indexToProgramIds: Map<number, PublicKey> = new Map<number, PublicKey>();
Why it matters

instructions and accountKeys are public and mutable, but this map is filled only once. After a direct mutation, isProgramId, programIds and nonProgramIds give stale answers.

Suggested fix, not tested

derive the program ids from the fields when they are read, or make the fields read-only.

22. Low Stored network setting is trusted without validation and can crash the example app
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
const [network, setNetwork] = useLocalStorage<Cluster>('network', 'devnet');
Why it matters

whatever is in localStorage is cast to a cluster name without a check. A stale or edited value makes clusterApiUrl throw while the root provider renders (providers.tsx:26). The whole app fails on every load, and because the network selector is inside the crashed tree, users cannot fix it without clearing site data.

Suggested fix, not tested

validate the stored value against the supported networks and fall back to devnet. Let useLocalStorage take an optional validator.

23. Low Local-storage helper uses unprefixed keys and does not validate or sync records
First rating: Low · Reviewed rating: Low · Review: confirmed · also in the first audit (#9)
From the report
Evidence
const stored = globalThis.localStorage?.getItem(key);
return stored ? (JSON.parse(stored) as T) : defaultState;
Why it matters

generic keys such as network can collide with other code on the same origin. A second tab never sees the first tab's change and can overwrite it with stale state.

Suggested fix, not tested

namespace the keys, validate the parsed value, and listen to the storage event.

25. Low Wallet selection is cleared before disconnect succeeds
First rating: Low · Reviewed rating: Low · Review: confirmed · also in the first audit (#4)
From the report
Evidence
const target = active()?.wallet;
select(null);
try { await namespace.disconnect();
Why it matters

if disconnect rejects, the wallet is still connected but no wallet is selected, so a later connect() throws "wallet not selected".

Suggested fix, not tested

clear the selection only after disconnect resolves.

26. Low Connection class is a single very large class with several separate concerns
First rating: Low · Reviewed rating: Low · Review: confirmed · also in the first audit (#14)
From the report
Evidence
export class Connection {
  /** @internal */ _blockhashInfo: {
  /** @internal */ private readonly _subscriptionRegistry =
Why it matters

one class of about 3,900 lines holds the blockhash cache, three confirmation strategies, the transport and all RPC methods. Changes are slow to make and risky.

Suggested fix, not tested

extract the blockhash cache, the confirmation strategies and the HTTP transport into their own modules, and keep Connection as a thin facade over them.

27. Low Blockhash cache state lives inside the RPC facade class
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
/** @internal */ _disableBlockhashCaching: boolean = false;
/** @internal */ _pollingBlockhash: boolean = false;
Why it matters

the cache state and the methods that use it are spread through the facade class.

Suggested fix, not tested

move them into a dedicated blockhash-cache class that Connection holds.

28. Low Blockhash refresh is not shared between concurrent callers
First rating: Low · Reviewed rating: Low · Review: confirmed · also in the first audit (#17)
From the report
Evidence
while (this._pollingBlockhash) {
  await sleep(100);
}
Why it matters

callers wait by polling a flag every 100 ms. Two callers that arrive together when the cache is empty both start a refresh, and a caller that bypasses the cache clears the shared flag early.

Suggested fix, not tested

keep one in-flight refresh promise, return it to every concurrent caller, and clear it when it settles.

32. Low Decoded stake lockup values lose precision above 2^53
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
return new Lockup(
  Number(lockup.unixTimestamp),
  Number(lockup.epoch),
Why it matters

these on-chain fields are 64-bit integers. Values above 2^53, such as the maximum value used to lock an account forever, are rounded when an instruction is decoded. The decoded instruction then shows a wrong value and does not encode back to the same bytes.

Suggested fix, not tested

keep these fields as bigint (as the stake-account lockup type already does), or throw when a value is not a safe integer.

33. Low Stake module mixes account decoding, instruction decoding and building in one large file
First rating: Low · Reviewed rating: Low · Review: confirmed · also in the first audit (#15)
From the report
Evidence
export class StakeInstruction {
...
export class StakeProgram {
Why it matters

a file of about 1,600 lines holds three separable concerns.

Suggested fix, not tested

split it into account, instruction-decoder and program modules, and re-export them from an index file.

34. Low Legacy Transaction class mixes model, signing, wire format and fee estimation
First rating: Low · Reviewed rating: Low · Review: confirmed · also in the first audit (#16)
From the report
Evidence
export class Transaction {
...
async getEstimatedFee(connection: Connection)
Why it matters

wire encoding and decoding, signing and RPC calls are all in one class, so a change to one concern risks the others.

Suggested fix, not tested

extract the wire encode/decode and the signing helpers into separate modules.

35. Low Message classes repeat the same instruction conversion and signer logic
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
const instructions = expandInstructionPlans(args.instructions).map(
  instruction =>
    isKitInstruction(instruction)
Why it matters

the legacy, v0 and v1 message classes each carry a copy of the instruction conversion, the signer test and the codec setup, so a fix to one copy can miss the others.

Suggested fix, not tested

move the shared logic into one message helper module and call it from all three classes.

36. Low Vote program id and codecs are defined twice
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
const VOTE_PROGRAM_ID = new PublicKey(
  'Vote111111111111111111111111111111111111111',
);
Why it matters

the same id and the same u64 and public-key codecs are also defined in vote-account.ts, so there are two sources of truth.

Suggested fix, not tested

import them from one module.

37. Low Wallet controller is one large closure holding several concerns
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
export function createWalletController({
  onError,
  ...config
Why it matters

one 427-line closure holds selection, the connect and disconnect lifecycle, sign-in, message and transaction signing, a long send pipeline and snapshot assembly.

Suggested fix, not tested

move the send pipeline and the snapshot builder into their own modules.

38. Low Example send components repeat the whole send-and-confirm flow
First rating: Low · Reviewed rating: Low · Review: confirmed · also in the first audit (#19)
From the report
Evidence
const {
  context: {slot: minContextSlot},
  value: {blockhash, lastValidBlockHeight},
Why it matters

four components repeat the blockhash fetch, send, confirm and notify steps. Only the transaction builder differs, so every fix has to be made four times.

Suggested fix, not tested

extract one shared hook or helper that takes the transaction builder as its input.

42. Low Same record type guard is copied into several files
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
function isRecord(value: unknown): value is Record<string, unknown> {
  return value != null && typeof value === 'object';
}
Why it matters

the same guard is also in connection.ts, kit-adapters/block-notifications.ts and validator-info.ts.

Suggested fix, not tested

define it once in utils and import it everywhere.

43. Low Base58/Base64 codec singletons are re-created in several modules
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
const BASE58_ENCODER = getBase58Encoder();
const BASE64_CODEC = getBase64Codec();
Why it matters

the same pair is also created in connection.ts, account-notifications.ts, response.ts and message/legacy.ts.

Suggested fix, not tested

export one shared pair from codecs.ts.

44. Low Send-options mapping is duplicated in the two send-and-confirm helpers
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
const sendOptions = options && {
  skipPreflight: options.skipPreflight,
  preflightCommitment: options.preflightCommitment || options.commitment,
Why it matters

the same block is in send-and-confirm-transaction.ts, so the two helpers can drift apart.

Suggested fix, not tested

extract one shared mapping helper.

45. Low Raw block types are declared twice
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
type RawBlockReward = Readonly<{
  commission?: number | null;
Why it matters

identical types are also declared in response.ts.

Suggested fix, not tested

export them from one module.

47. Low Program instruction-decoding helpers are copied per program and have diverged
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
function checkProgramId(programId: PublicKey) {
  if (!programId.equals(ComputeBudgetProgram.programId)) {
Why it matters

five program modules each carry their own decode and program-id-check helpers, and the copies already differ. For example, the system program checks the program id in each caller and has no guard for an unknown instruction type.

Suggested fix, not tested

write one generic decode helper that takes the program id, the parser and the expected type, and use it from all five modules.

48. Low Signature length is hard-coded although a constant exists
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
signatures.length * 64 + signData.length;
Why it matters

the literal 64 appears in several files, and in others it is re-declared locally, next to an imported constant for the same value.

Suggested fix, not tested

use the existing signature-length and public-key-length constants everywhere.

49. Low Superseded-request error filter is repeated in three UI components
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
if (error.name !== 'AbortError') setError(error.message);
Why it matters

the same check is in WalletModal.tsx and WalletMultiButton.tsx, so a change in how superseded requests are recognised can miss one copy.

Suggested fix, not tested

use one shared helper or hook.

51. Low Public RPC host list is maintained in two places
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
const PUBLIC_MAINNET_HOSTS = new Set(['api.mainnet-beta.solana.com','api.mainnet.solana.com']);
Why it matters

the wallet controller keeps its own list of the official endpoints, and both lists must change together.

Suggested fix, not tested

export the list from the package and derive the warning from it.

52. Low Test live-versus-mock switch is decided in many places with two different checks
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
export const mockServer = process.env.TEST_LIVE === undefined ? new MockHttpServer() : undefined;
Why it matters

when TEST_LIVE is set to an empty string, some files treat the run as live and others as mocked. Tests then call a port that nothing listens on.

Suggested fix, not tested

export one boolean from test/url.ts and use it everywhere.

53. Low Promise-detection helper is copied in both test mocks
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
function isPromise<T>(value: PromiseLike<T> | T): value is PromiseLike<T> {
Why it matters

an identical copy is in mocks/rpc-http.ts.

Suggested fix, not tested

move it to a shared test utility.

54. Low Subscription registry accessor is copied in two test files
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
function getSubscriptionRegistry(connection: Connection): { hasServerSubscription(serverSubscriptionId: number): boolean; }
Why it matters

the same accessor and its constant are also in connection-subscriptions.test.ts.

Suggested fix, not tested

move both into the shared test utilities.

55. Low Test key and lookup-table builders are copied across test files
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
function createTestKeys(count: number): Array<PublicKey> {
  return Array.from({length: count}, () => getUniqueAddress());
Why it matters

createTestKeys is copied into six files and createTestLookupTable into three.

Suggested fix, not tested

put both next to getUniqueAddress in test/utils/address.ts.

57. Low Block fetch errors are all relabelled as server-side RPC errors
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
} catch (e) {
  throw new SolanaJSONRPCError(
    e as JsonRpcErrorLike,
Why it matters

in getBlock and getParsedBlock, network failures, aborts and mapping errors all become JSON-RPC errors with an undefined code, and the original error and its stack are lost. Every other method rethrows non-RPC errors unchanged.

Suggested fix, not tested

use the existing throwSolanaRpcErrorIfNeeded helper here, as the sibling methods do.

61. Low One malformed validator-info account breaks the whole listing
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
const info = parseInfo(JSON.parse(rawInfo));
return new ValidatorInfo(configKeys[1].publicKey, info);
Why it matters

the method is documented to return null when no info is found, but it throws on malformed JSON. Any validator can publish such text, and one bad account aborts every consumer that enumerates all validator-info accounts.

Suggested fix, not tested

wrap the parse and the validation, and return null (or a typed error) for malformed content.

63. Low Example labels a private RPC endpoint as a browser-public variable
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
# Private mainnet RPC. The public mainnet endpoint returns 403 to browsers.
NEXT_PUBLIC_MAINNET_RPC_URL=
Why it matters

Next.js copies every NEXT_PUBLIC_ value into the shipped JavaScript, and this app is a static export. A provider URL that carries an API key becomes readable by every visitor, who can then use up its quota.

Suggested fix, not tested

say in the template that this value is public. Recommend an origin-restricted browser key, or put a server-side RPC proxy in front of private endpoints.

65. Low Multi-package release cannot be completed after a partial failure
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
npm publish "$TARBALL" --access public --tag "$NPM_TAG"
PUBLISHED=$((PUBLISHED + 1))
Why it matters

the packages are published in a loop. If the first package publishes and the second fails, no tag or GitHub release is created. A re-run then fails at the pre-flight "already published" check (line 300), so the only way out is to bump the version of both packages.

Suggested fix, not tested

make the publish step skip a package already on the registry at that version (after confirming the content matches), and fail only when a package is missing. Create the tag and release in a step that records what was published, even after a partial failure.

Info after review (15)

1. Info Message-signing demo signs a fixed text with no server challenge
First rating: Low · Reviewed rating: Info · Review: rated too high · also in the first audit (#1)
From the report
Evidence
const message = new TextEncoder().encode(
  `${window.location.host} wants you to sign in with your Solana account:\n${publicKey.toBase58()}\n\nPlease sign in.`,
Why it matters

the text has no nonce and no expiry, so one signature stays valid for every later use of the same text. Readers who copy this demo into a login flow get a replayable sign-in.

Suggested fix, not tested

have the server issue a random nonce with an issue time and an expiry. Include them in the signed text and verify them, and the domain, on the server. Label the fixed text as demo-only.

2. Info Sign-in demo has no nonce, issue time or expiry and verifies only in the browser
First rating: Low · Reviewed rating: Info · Review: rated too high · also in the first audit (#1)
From the report
Evidence
const input: SolanaSignInInput = {
  address: address ?? undefined,
  domain: window.location.host,
Why it matters

there is no replay protection, and a check that runs only in the browser proves nothing to a backend.

Suggested fix, not tested

add a server-supplied nonce, issuedAt and expirationTime. Add a comment that verifySignIn must run on the server against the nonce the server issued.

3. Info Off-chain message demo does not check that the signed bytes contain the requested message
First rating: Low · Reviewed rating: Info · Review: rated too high · new in this audit
From the report
Evidence
const {signature, signedOffchainMessage} = await signOffchainMessage(
  `${window.location.host} wants you to sign an offchain message.`,
);
Why it matters

the demo checks the signature over whatever bytes the wallet returned, not over the content it asked for. Code copied from it would accept a signature over different content.

Suggested fix, not tested

decode signedOffchainMessage and compare its content and required signers with the request before you treat the signature as proof.

6. Info Wallet connect gives no clear error on an insecure (non-HTTPS) origin
First rating: Low · Reviewed rating: Info · Review: rated too high · also in the first audit (#2)
From the report
Evidence
target = selectedWallet();
if (active()?.wallet.name === target.name) return;
await namespace.connect(target);
Why it matters

browser wallets refuse to work on plain-HTTP origins other than localhost. The library never checks the origin, so integrators see an unexplained failure.

Suggested fix, not tested

before connecting, check window.isSecureContext. When the origin is insecure and not localhost, raise a configuration error that says to serve the app over HTTPS.

11. Info Durable-nonce confirmation polls over HTTP although a change subscription exists
First rating: Low · Reviewed rating: Info · Review: rated too high · also in the first audit (#5)
From the report
Evidence
sleep(2000),
...
const nextNonceValue = await Promise.race<
Why it matters

an RPC request every 2 seconds, while the same Connection already offers an account-change subscription for the nonce account.

Suggested fix, not tested

use the account-change subscription as the main signal, and keep a slow poll only as a fallback when the subscription is not active.

20. Info Authorization layout constants are only shallowly frozen
First rating: Low · Reviewed rating: Info · Review: rated too high · new in this audit
From the report
Evidence
export const StakeAuthorizationLayout = Object.freeze({
  Staker: {
    index: 0,
Why it matters

the nested Staker, Withdrawer and Voter objects can still be changed at runtime. Their index goes straight into instruction data, so one stray write changes which authority later instructions set.

Suggested fix, not tested

freeze the nested objects as well, or export plain numeric constants.

21. Info Default lockup is one shared mutable instance
First rating: Low · Reviewed rating: Info · Review: rated too high · also in the first audit (#10)
From the report
Evidence
static default: Lockup = new Lockup(0, 0, PublicKey.default);
Why it matters

every stake account initialized without an explicit lockup uses this one object, so mutating it changes the lockup of all later accounts.

Suggested fix, not tested

return a fresh or frozen instance from a getter, and mark constant statics read-only.

24. Info UI timers are not cleared on unmount
First rating: Low · Reviewed rating: Info · Review: rated too high · new in this audit
From the report
Evidence
setTimeout(() => setCopied(false), 400);
Why it matters

the timer can fire after the component has unmounted. The same pattern is in the example's Notifications.tsx:41.

Suggested fix, not tested

keep the timer id in a ref and clear it in an effect cleanup.

29. Info RPC response bodies are read and parsed with no size cap or timeout
First rating: Low · Reviewed rating: Info · Review: rated too high · new in this audit
From the report
Evidence
const rawResponse = await response.text();
return (
  rawResponse.length === 0 ? null : parseJsonWithBigInts(rawResponse)
Why it matters

a misbehaving or hostile endpoint can make the client buffer and parse an unbounded body.

Suggested fix, not tested

add a configurable maximum response size and a default request timeout.

30. Info Cluster timing constants are hard-coded
First rating: Low · Reviewed rating: Info · Review: rated too high · new in this audit
From the report
Evidence
// TODO: These constants should be removed in favor of reading them out of a
// Syscall account
export const NUM_TICKS_PER_SECOND = 160;
Why it matters

poll intervals are derived from these values, so they are mis-tuned on clusters with a different slot time.

Suggested fix, not tested

derive the slot time from cluster data, or make the poll intervals configurable.

39. Info Two different helpers share the name supportsTransactionVersion
First rating: Low · Reviewed rating: Info · Review: rated too high · new in this audit
From the report
Evidence
export function supportsTransactionVersion(
  wallet: Wallet,
  version: SolanaTransactionVersion,
Why it matters

components/transactionVersion.ts has a helper with the same name and a different input. A wrong import can compile and quietly answer a different question.

Suggested fix, not tested

rename one of them, for example to walletAdvertisesTransactionVersion.

40. Info Example send and sign buttons allow double submission
First rating: Low · Reviewed rating: Info · Review: rated too high · new in this audit
From the report
Evidence
onClick={onClick}
disabled={!publicKey}
Why it matters

the button stays enabled while the wallet prompt and the send are pending, so a double click starts two sends.

Suggested fix, not tested

disable the button, or reuse the in-flight promise, until the action settles.

41. Info Wallet modal text cannot be overridden or localized
First rating: Low · Reviewed rating: Info · Review: rated too high · new in this audit
From the report
Evidence
? 'Connect a wallet on Solana to continue'
: "You'll need a wallet on Solana to continue"
Why it matters

the buttons accept a labels map, but the modal hard-codes its strings, so integrators who work in other languages have to fork it.

Suggested fix, not tested

add a labels prop to the modal, with the current English strings as defaults.

46. Info Adapter modules and the Connection module import each other
First rating: Low · Reviewed rating: Info · Review: rated too high · new in this audit
From the report
Evidence
import type {
  BlockSubscriptionAccountsModeBlockResponse,
} from '../connection';
Why it matters

connection.ts imports the adapters and the adapters import types back from it, which makes the module graph cyclic.

Suggested fix, not tested

move the shared response and config types into a neutral types module that both sides import.

50. Info No-op subscribe helper is declared in three files
First rating: Low · Reviewed rating: Info · Review: rated too high · new in this audit
From the report
Evidence
const noSubscription = () => () => {};
Why it matters

the helper is repeated in the example's PublicEndpointWarning.tsx and Settings.tsx.

Suggested fix, not tested

export it once, together with a small "is mounted" hook.

Want this for your code?

Upload a ZIP or link a public GitHub repo, pick the areas and the depth, and get findings by severity with fixes.