NodeSecure / NodeSecure/js-x-ray
implementing "unclosed-ressource" warning
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 287
- Forks
- 43
- Avg merge
- 16h 34m
- Merged PRs (30d)
- 19
Description
The goal would be to implement a new probe that detect unclosed ressource for example:
const fs = require('fs/promises');
let fileHandle;
try {
fileHandle = await fs.open('example.txt', 'r');
// ... perform operations
await fileHandle.close(); // Releases the file resource
} catch(e) {
console.log(e.message);
// if an error occurs we don't release the file resource
throw error;
}
- A list of modules to cover would be:
File descriptor | (fs) fileHandle.close() / fs.close(fd)
Streams | stream.destroy() or stream.end()
Net/HTTP sockets & servers | socket.destroy(), server.close()
Timers | clearTimeout() / clearInterval(), or timer.unref()
Worker threads | worker.terminate()
DB pool connections | client.release() (library-specific)
- Edge cases to consider:
Since node 24 we can use Symbol.dispose, Symbol.asyncDispose with the keyword using.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files, tests, or entry points, so first map the existing probe architecture and how resource lifetimes are represented. Define coverage and completion criteria for file handles, streams, sockets, timers, workers, database connections, and Node 24 disposal syntax before implementing and testing the probe.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, typescript
- Domain
- devtools, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100