-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keep all ports that we connect to #348
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When tracking outbound connections, this makes sure that connections to multiple ports in the same hostname are correctly tracked, rather than ignored.
foca
force-pushed
the
dont-shadow-ports-in-hostnames
branch
from
August 29, 2024 10:05
49ae329
to
2d107d5
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
PR looks good to me. 👍 export class Hostnames {
private map = new Map<string, Ports>();
constructor(private readonly maxEntries: number = 200) {}
add(hostname: string, port: number | undefined) {
if (!this.map.has(hostname)) {
- this.map.set(hostname, new Set());
+ this.map.set(hostname, new Set([port]));
+ } else {
+ this.map.get(hostname)?.add(port);
}
- (this.map.get(hostname) as Ports).add(port);
|
timokoessler
approved these changes
Sep 5, 2024
…w-ports-in-hostnames * 'main' of github.com:AikidoSec/node-RASP: (484 commits) Fix linting Add unit tests for hono/context-storage Fix addHonoMiddleware types Upgrade mongodb in sample app Add comment about mongodb v6.10.0 Keep same order Use process.nextTick before wrapping Collection Fix lock files Add links to docs Update end2end/tests/node-red.test.js Update end2end/tests/node-red.test.js Add node-red e2e test Fix property definition fix: Do not use wrap helper for req handler Improve package.json Fix test Fix lint Fix lint Fix type import Test express v4 and v5 ...
timokoessler
reviewed
Dec 6, 2024
library/agent/Hostnames.ts
Outdated
add(hostname: string, port: number | undefined) { | ||
if (this.map.has(hostname)) { | ||
return; | ||
private portKey(port: number | undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused?
timokoessler
approved these changes
Dec 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, when connecting to multiple ports in the same hostname, the firewall only tracks the first port connected to, and discards the rest. This fixes the code so that we track all ports connected to and report them to the server.