Skip to content

fix(security): resolve CodeQL code alerts#4648

Open
cl-efornaciari wants to merge 4 commits intomainfrom
fix/codeql-code-alerts
Open

fix(security): resolve CodeQL code alerts#4648
cl-efornaciari wants to merge 4 commits intomainfrom
fix/codeql-code-alerts

Conversation

@cl-efornaciari
Copy link
Contributor

Summary

  • Total alerts addressed: 8
  • Fixed: 7
  • False positive (documented): 1

Alert Table

# Rule ID Severity File:Line Status Notes
41 js/insufficient-password-hash high nav-consulting/authentication.ts:17 False positive HMAC-SHA256 is for API request signing, not password storage; correct algorithm for this use case
39 js/insecure-randomness high lcx/config/index.ts:15 Fixed Uses getRandomRequiredEnv → fixed in util.ts
38 js/insecure-randomness high bootstrap/config/index.ts:27-29 Fixed Uses getRandomEnv/getRandomRequiredEnv → fixed in util.ts
37 js/insecure-randomness high bootstrap/config/index.ts:24-26 Fixed Same as above
23 js/http-to-file-access medium observation/index.ts:44 Fixed Added getSafeOutputPath to validate filename, block path traversal
22 js/indirect-command-line-injection medium scripts/workspace.ts:39 Fixed Added sanitizeBranchForShell to validate branch name before shell interpolation
17 js/incomplete-sanitization high por-address-list/addressManager.ts:99 Fixed Changed replace("'", '') to replace(/'/g, '') to escape all apostrophes
14 js/prototype-polluting-assignment medium bootstrap/overrider.ts:119 Fixed Skip proto, constructor, prototype keys in combineOverrides

How Changes Were Made

  • js/insecure-randomness: Replaced Math.random() with crypto.randomInt() in getRandomEnv and getRandomRequiredEnv (packages/core/bootstrap/src/lib/util.ts). Updated unit test to spy on crypto.randomInt instead of Math.random.
  • js/http-to-file-access: Added getSafeOutputPath() that validates filename with path.basename() and rejects path traversal (..).
  • js/indirect-command-line-injection: Added sanitizeBranchForShell() that validates branch name against alphanumeric///-/_/. before interpolating into yarn command.
  • js/incomplete-sanitization: Replaced address.replace("'", '') with address.replace(/'/g, '') to replace all apostrophes, not just the first.
  • js/prototype-polluting-assignment: Added guard to skip __proto__, constructor, and prototype keys when copying inputOverrides into combinedOverrides.
  • js/insufficient-password-hash: No change. HMAC-SHA256 is the correct algorithm for API request signing; CodeQL incorrectly treats API credentials as stored passwords.

Resolves CodeQL alerts: #14, #17, #22, #23, #37, #38, #39
- js/insecure-randomness: replace Math.random with crypto.randomInt in util
- js/http-to-file-access: validate output filename before file write
- js/indirect-command-line-injection: sanitize branch name for shell
- js/incomplete-sanitization: replace all apostrophes, not first only
- js/prototype-polluting-assignment: skip __proto__/constructor/prototype
- js/insufficient-password-hash (#41): false positive, HMAC-SHA256 correct for API signing
@changeset-bot
Copy link

changeset-bot bot commented Feb 20, 2026

🦋 Changeset detected

Latest commit: fc8fdf0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 69 packages
Name Type
@chainlink/ea-bootstrap Patch
@chainlink/observation Patch
@chainlink/ea-scripts Patch
@chainlink/por-address-list-adapter Patch
@chainlink/bitcoin-json-rpc-adapter Patch
@chainlink/bsol-price-adapter Patch
@chainlink/crypto-volatility-index-adapter Patch
@chainlink/historical-average-adapter Patch
@chainlink/implied-price-adapter Patch
@chainlink/medianizer-adapter Patch
@chainlink/nftx-adapter Patch
@chainlink/proof-of-reserves-adapter Patch
@chainlink/rocket-pool-adapter Patch
@chainlink/savax-price-adapter Patch
@chainlink/set-token-index-adapter Patch
@chainlink/the-graph-adapter Patch
@chainlink/xsushi-price-adapter Patch
@chainlink/ea-factories Patch
@chainlink/ea-reference-data-reader Patch
@chainlink/reduce-adapter Patch
@chainlink/token-allocation-adapter Patch
@chainlink/readme-test-adapter Patch
@chainlink/ada-balance-adapter Patch
@chainlink/amberdata-adapter Patch
@chainlink/anyblock-adapter Patch
@chainlink/bea-adapter Patch
@chainlink/binance-adapter Patch
@chainlink/blockchain.com-adapter Patch
@chainlink/blockchair-adapter Patch
@chainlink/bob-adapter Patch
@chainlink/btc.com-adapter Patch
@chainlink/cache.gold-adapter Patch
@chainlink/celsius-address-list-adapter Patch
@chainlink/chain-reserve-wallet-adapter Patch
@chainlink/coinapi-adapter Patch
@chainlink/coinbase-adapter Patch
@chainlink/coinlore-adapter Patch
@chainlink/coinranking-adapter Patch
@chainlink/covid-tracker-adapter Patch
@chainlink/cryptoapis-adapter Patch
@chainlink/deribit-adapter Patch
@chainlink/enzyme-adapter Patch
@chainlink/eodhistoricaldata-adapter Patch
@chainlink/eth-balance-adapter Patch
@chainlink/etherscan-adapter Patch
@chainlink/fmpcloud-adapter Patch
@chainlink/galaxis-adapter Patch
@chainlink/graphql-adapter Patch
@chainlink/json-rpc-adapter Patch
@chainlink/layer2-sequencer-health-adapter Patch
@chainlink/lcx-adapter Patch
@chainlink/lido-adapter Patch
@chainlink/mock-ea-adapter Patch
@chainlink/mycryptoapi-adapter Patch
@chainlink/onchain-gas-adapter Patch
@chainlink/snowflake-adapter Patch
@chainlink/sochain-adapter Patch
@chainlink/solana-view-function-adapter Patch
@chainlink/sportsdataio-adapter Patch
@chainlink/stader-labs-adapter Patch
@chainlink/swell-address-list-adapter Patch
@chainlink/synthetix-debt-pool-adapter Patch
@chainlink/therundown-adapter Patch
@chainlink/twelvedata-adapter Patch
@chainlink/uniswap-v2-adapter Patch
@chainlink/upvest-adapter Patch
@chainlink/uscpi-one-adapter Patch
@chainlink/wrapped-adapter Patch
@chainlink/harmony-adapter Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

content += `, ${result.stagingResult}, ${result.prodResult}, ${new Date().toISOString()}`
console.log(content)
fs.appendFileSync(`${config.outputFileName}`, content)
fs.appendFileSync(outputPath, content)

Check warning

Code scanning / CodeQL

Network data written to file Medium

Write to file system depends on
Untrusted data
.
Write to file system depends on
Untrusted data
.
- utils.test.ts: use mockImplementationOnce for crypto.randomInt spy to fix TS2345
- swift-dodos-fix.md: escape __proto__ in markdown for Prettier
Copy link
Contributor

@mxiao-cll mxiao-cll left a comment

Choose a reason for hiding this comment

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

This needs to be released given it's high impact

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.

2 participants