Skip to content
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

nope-ip removal - Phase 1 #8714

Merged
merged 1 commit into from
Feb 5, 2025
Merged

Conversation

liranmauda
Copy link
Contributor

nope-ip removal - Phase 1

net_utils

  • Will no longer use the deprecated url.parse() and use new URL() instead. It is possible because we use it with .hostname, which is equal for both.
  • Create ip_toLong to replace the node-ip toLong

Others

  • Replace the use of isV4Format to net.isIPv4
  • Replace the use of isV6Format to net.isIPv6
  • Calling ip_toLong instead of toLong

Explain the changes

Issues: Fixed #xxx / Gap #xxx

Testing Instructions:

  • Doc added/updated
  • Tests added

@@ -578,10 +577,10 @@ function _prepare_auth_request(req) {
const client_ip = net_utils.unwrap_ipv6(req.auth.client_ip);
if (client_ip) {
let is_allowed = false;
const client_ip_val = ip_module.toLong(client_ip);
const client_ip_val = net_utils.ip_toLong(client_ip);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if we still need allowed_ips in accounts. maybe we should get rid of that? then we don't need most of the code here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jackyalbo I have looked at it but it is completely out of scope.
We should have a run on looking at deprecated fields in the schema and remove them, including an upgrade script to verify they are no longer there.

@liranmauda liranmauda requested a review from jackyalbo February 5, 2025 08:57
@@ -3,7 +3,8 @@
/* eslint-disable no-control-regex */

const _ = require('lodash');
const ip = require('ip');
const ip_module = require('ip');
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we just changing the name here? consistency? maybe explain here that this change is still in progress, and we plan to remove this module.
Is the effort of totally removing this module that big? the isEqual sounds easy also, CIDR doesn't suppose to be hard if we have the ip_to_long conversion

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is Phase 1, as the title suggests.
The change of this name is to make it easy for us to look for ip_module.
in later PR we will address the other functions, CIDR is not that easy...

Copy link
Contributor

Choose a reason for hiding this comment

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

the question is if we need 2 phases :). But sure, if you prefer to split.

nope-ip removal - Phase 1

# `net_utils`
- Will no longer use the deprecated `url.parse()` and use `new URL()` instead. It is possible because we use it with .hostname, which is equal for both.
- Create ip_toLong to replace the node-ip toLong

# Others
- Replace the use of isV4Format to net.isIPv4
- Replace the use of isV6Format to net.isIPv6
- Calling ip_toLong instead of toLong

Signed-off-by: liranmauda <[email protected]>
@liranmauda liranmauda force-pushed the liran-remove-node-ip branch from 941bbaa to a3a39c4 Compare February 5, 2025 11:11
@liranmauda liranmauda merged commit 56563a0 into noobaa:master Feb 5, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants