Skip to content

Conversation

@Napalys
Copy link
Contributor

@Napalys Napalys commented Mar 26, 2025

The latest version of Hapi introduces a new import name, @hapi/hapi, and a new server function.

Without this update, CodeQL would miss alerts related to the TaintedPath CWE-022 when using the newer version of the Hapi server.

@github-actions github-actions bot added the JS label Mar 26, 2025
@Napalys Napalys marked this pull request as ready for review March 26, 2025 10:50
Copilot AI review requested due to automatic review settings March 26, 2025 10:50
@Napalys Napalys requested a review from a team as a code owner March 26, 2025 10:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request updates the codebase to support the newer version of Hapi using the new import name "@hapi/hapi" and server function, ensuring that CodeQL can correctly detect alerts related to TaintedPath CWE-022.

  • Updated test code in the Security query-tests to use "@hapi/hapi".
  • Revised library test code for Hapi server instantiation.
  • Documented the changes in the library change-notes.

Reviewed Changes

Copilot reviewed 3 out of 6 changed files in this pull request and generated no comments.

File Description
javascript/ql/test/query-tests/Security/CWE-022/TaintedPath/hapi.js Introduces a new test case using the updated Hapi import and server function.
javascript/ql/test/library-tests/frameworks/hapi/src/hapihapi.js Updates server instantiation to support the new Hapi API.
javascript/ql/lib/change-notes/2025-03-26-Hapi.md Adds a brief change note documenting the update.
Files not reviewed (3)
  • javascript/ql/lib/semmle/javascript/frameworks/Hapi.qll: Language not supported
  • javascript/ql/test/library-tests/frameworks/hapi/tests.expected: Language not supported
  • javascript/ql/test/query-tests/Security/CWE-022/TaintedPath/TaintedPath.expected: Language not supported
Comments suppressed due to low confidence (1)

javascript/ql/test/library-tests/frameworks/hapi/src/hapihapi.js:1

  • [nitpick] The file uses two different patterns for instantiating a Hapi server. For consistency and clarity, consider unifying the instantiation style (either using inline require or assigning the module to a variable).
var server1 = new (require('@hapi/hapi')).Server(); // HTTP::Server

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more

@Napalys Napalys merged commit 32369da into github:main Mar 27, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants