Skip to content

enhance the display url for all addresses 0.0.0.0 while using httpd#1

Open
brendanator wants to merge 1 commit intobase-sha/761018dc5954b848d184a019ffabcdc917657cebfrom
head-sha/fdc52af263013d3af82974990c94b6bb605b4fd6/2024-04-09T10-24-46/b6e36b
Open

enhance the display url for all addresses 0.0.0.0 while using httpd#1
brendanator wants to merge 1 commit intobase-sha/761018dc5954b848d184a019ffabcdc917657cebfrom
head-sha/fdc52af263013d3af82974990c94b6bb605b4fd6/2024-04-09T10-24-46/b6e36b

Conversation

@brendanator
Copy link

The original log ## Open your webbrowser at the URL: http://localhost:42525 is ambiguous when I already set addr to 0.0.0.0. It looks like the server runing only on localhost.
After merge this PR, when addr isn't 0.0.0.0, the log will show as

## Open your webbrowser at the URL: http://localhost:42525

and show as the following when addr is 0.0.0.0

## Running on all addresses (0.0.0.0)
## Open your webbrowser at the URL: http://192.168.33.111:42525

@brendanator
Copy link
Author

This is a benchmark review for experiment review_of_100_reviews_20240409.
Run ID: review_of_100_reviews_20240409/benchmark_2024-04-09T10-24-34_v1-16-0-95-g65fefaeef-dirty.

This pull request was cloned from https://github.com/tpaviot/pythonocc-core/pull/1311. (Note: the URL is not a link to avoid triggering a notification on the original pull request.)

Copy link
Author

@brendanator brendanator left a comment

Choose a reason for hiding this comment

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

Sourcery logo Sourcery Review:

Hey @brendanator - I've reviewed your changes and found some issues that need to be addressed.

Blocking issues:

  • Hard-coded IP addresses detected. (link)
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🔴 Security: 1 blocking issue
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Docstrings: all looks good

LangSmith trace

Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

:meta private:
"""
# arbitrary private address
host = "fd31:f903:5ab5:1::1" if family == socket.AF_INET6 else "10.253.155.219"
Copy link
Author

Choose a reason for hiding this comment

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

Sourcery logo suggestion (code_refinement): Consider using well-known IP addresses for testing connectivity.

Using arbitrary private IP addresses might not be reachable in all environments. Consider using well-known IP addresses like '8.8.8.8' for IPv4 or '2001:4860:4860::8888' for IPv6.

Suggested change
host = "fd31:f903:5ab5:1::1" if family == socket.AF_INET6 else "10.253.155.219"
host = "2001:4860:4860::8888" if family == socket.AF_INET6 else "8.8.8.8"

Choose a reason for hiding this comment

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

Is this comment correct?

Choose a reason for hiding this comment

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

Is this comment helpful?

Choose a reason for hiding this comment

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

Is the comment type correct?

Choose a reason for hiding this comment

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

Is the comment area correct?

except OSError:
return "::1" if family == socket.AF_INET6 else "127.0.0.1"

return s.getsockname()[0] # type: ignore
Copy link
Author

Choose a reason for hiding this comment

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

Sourcery logo suggestion (code_clarification): Clarify the reason for ignoring type checks.

It's generally a good practice to avoid ignoring type checks. If it's necessary here, please add a comment explaining why, to maintain code clarity.

Choose a reason for hiding this comment

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

Is this comment correct?

Choose a reason for hiding this comment

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

Is this comment helpful?

Choose a reason for hiding this comment

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

Is the comment type correct?

Choose a reason for hiding this comment

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

Is the comment area correct?

:meta private:
"""
# arbitrary private address
host = "fd31:f903:5ab5:1::1" if family == socket.AF_INET6 else "10.253.155.219"
Copy link
Author

Choose a reason for hiding this comment

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

Sourcery logo 🚨 issue (security): Hard-coded IP addresses detected.

Using hard-coded IP addresses can lead to potential security risks and maintenance issues. Consider using environment variables or configuration files for these values.

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.

3 participants