Skip to content

Conversation

@ocervell
Copy link
Contributor

@ocervell ocervell commented Jan 8, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for custom binary names during tool installation.
  • Bug Fixes

    • Resolved naming conflict in httpx task by updating to use httpx-toolkit, preventing conflicts with the Python httpx library.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 8, 2026

Walkthrough

This pull request adds support for custom binary naming during installation across GitHub and source-based installation flows. The binary_name parameter is introduced to the installer class hierarchy and propagated through installation paths, with the httpx task demonstrating usage by renaming its binary to 'httpx-toolkit'.

Changes

Cohort / File(s) Summary
Installer Framework Parameter Threading
secator/installer.py
Extended Installer.install(), GithubInstaller.install(), and SourceInstaller.install() method signatures with optional binary_name parameter; updated _download_and_unpack() to accept and use binary_name for final binary naming; all call sites updated to propagate the parameter through installation flows.
Command Base Class Extension
secator/runners/command.py
Added install_binary_name public attribute to Command class with default value None.
httpx Task Configuration
secator/tasks/httpx.py
Updated task command from 'httpx -irh' to 'httpx-toolkit -irh'; added install_binary_name = 'httpx-toolkit' attribute to leverage the new installer binary naming feature.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 A binary name, so fresh and new,
Threads through installers, tried and true,
From GitHub's depths to sources deep,
Custom names the binaries keep,
httpx-toolkit, no conflicts here—
Our toolkit's vision becomes clear!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(installer): move binary name to avoid conflicts' accurately captures the main change: adding support for custom binary names in the installer to prevent naming conflicts, as demonstrated by the httpx-toolkit case.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 92bdab8 and 3f9762f.

📒 Files selected for processing (3)
  • secator/installer.py
  • secator/runners/command.py
  • secator/tasks/httpx.py
🧰 Additional context used
🪛 Ruff (0.14.10)
secator/installer.py

95-95: Unused noqa directive (non-enabled: E501)

Remove unused noqa directive

(RUF100)


246-246: Unused class method argument: binary_name

(ARG003)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: integration (3.11, ubuntu-latest)
🔇 Additional comments (6)
secator/runners/command.py (1)

84-94: LGTM!

The new install_binary_name attribute is well-placed alongside other installation-related attributes and follows the existing naming convention. The default None value is appropriate, allowing tools to optionally override when they need a custom binary name.

secator/tasks/httpx.py (1)

21-21: LGTM! Consistent binary renaming to avoid conflict.

The changes are well-coordinated:

  • cmd updated to use the new binary name httpx-toolkit
  • install_binary_name set to match
  • install_cmd correctly retains the original Go package path (github.com/projectdiscovery/httpx/cmd/httpx)

The installer will download/build the original httpx binary and rename it to httpx-toolkit, avoiding the conflict with Python's httpx library.

Also applies to: 79-81

secator/installer.py (4)

89-101: LGTM! Binary name extraction and propagation to GithubInstaller.

The binary name is correctly retrieved from the tool class and passed to the GitHub installer path.


328-357: LGTM! GithubInstaller properly handles binary renaming.

The implementation correctly:

  1. Accepts binary_name parameter
  2. Computes final_binary_name with fallback to repo name
  3. Passes both repo_name (to find binary in archive) and binary_name (for final destination) to _download_and_unpack

447-491: LGTM! Archive extraction correctly handles binary renaming.

The separation of repo_name (for finding the binary in the archive) and binary_name (for the final destination) is the right approach. The binary is correctly:

  1. Located in the archive using the original repo_name
  2. Made executable
  3. Moved to the destination with the custom binary_name

115-115: Note: binary_name is passed but not used by SourceInstaller.install.

This call correctly passes binary_name, but as noted above, the SourceInstaller.install method doesn't actually use it to rename the installed binary.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
secator/installer.py (1)

246-321: binary_name parameter is accepted but never used - source installations won't rename binaries.

The binary_name parameter is added to the signature but the method never uses it. When a tool like httpx is installed from source (via go install), the binary will be installed as httpx in GOBIN, not renamed to httpx-toolkit. This means:

  1. go install github.com/projectdiscovery/httpx/cmd/httpx@v1.7.0 installs binary as httpx
  2. binary_name='httpx-toolkit' is ignored
  3. cmd = 'httpx-toolkit -irh' will fail because no httpx-toolkit binary exists

The static analysis correctly flagged this as an unused argument (ARG003).

🔧 Proposed fix: Rename binary after successful source installation
 	@classmethod
 	def install(cls, config, version=None, install_prereqs=True, binary_name=None):
 		"""Install from source.
 
 		Args:
 			cls: ToolInstaller class.
 			config (dict): A dict of distros as keys and a command as value.
 			version (str, optional): Version to install.
 			install_prereqs (bool, optional): Install pre-requisites.
 			binary_name (str, optional): Custom binary name to use after installation.
 
 		Returns:
 			Status: install status.
 		"""
 		install_cmd = None
+		original_binary_name = None
 		if isinstance(config, str):
 			install_cmd = config
+			# Extract original binary name from install command for renaming
+			if binary_name:
+				# Try to extract the original name from common patterns
+				if 'go install' in install_cmd:
+					# e.g., go install github.com/user/repo/cmd/toolname@version
+					match = re.search(r'/cmd/([^@/]+)@', install_cmd)
+					if match:
+						original_binary_name = match.group(1)
 		else:
 			# ... existing code ...
 
 		# ... existing code until the end ...
 
 		# Run command
 		ret = Command.execute(install_cmd, cls_attributes={'shell': True}, quiet=False)
 		if ret.return_code != 0:
 			return InstallerStatus.INSTALL_FAILED
+
+		# Rename binary if custom name is specified
+		if binary_name and original_binary_name and binary_name != original_binary_name:
+			# Find the installed binary and rename it
+			original_path = shutil.which(original_binary_name)
+			if original_path:
+				target_dir = os.path.dirname(original_path)
+				target_path = os.path.join(target_dir, binary_name)
+				console.print(Info(message=f'Renaming {original_binary_name} to {binary_name}...'))
+				shutil.move(original_path, target_path)
+
 		return InstallerStatus.SUCCESS

Alternatively, you may need to pass the original tool name (e.g., from tool_cls.cmd.split(' ')[0]) to properly locate and rename the binary after source installation.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 92bdab8 and 3f9762f.

📒 Files selected for processing (3)
  • secator/installer.py
  • secator/runners/command.py
  • secator/tasks/httpx.py
🧰 Additional context used
🪛 Ruff (0.14.10)
secator/installer.py

95-95: Unused noqa directive (non-enabled: E501)

Remove unused noqa directive

(RUF100)


246-246: Unused class method argument: binary_name

(ARG003)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: integration (3.11, ubuntu-latest)
🔇 Additional comments (6)
secator/runners/command.py (1)

84-94: LGTM!

The new install_binary_name attribute is well-placed alongside other installation-related attributes and follows the existing naming convention. The default None value is appropriate, allowing tools to optionally override when they need a custom binary name.

secator/tasks/httpx.py (1)

21-21: LGTM! Consistent binary renaming to avoid conflict.

The changes are well-coordinated:

  • cmd updated to use the new binary name httpx-toolkit
  • install_binary_name set to match
  • install_cmd correctly retains the original Go package path (github.com/projectdiscovery/httpx/cmd/httpx)

The installer will download/build the original httpx binary and rename it to httpx-toolkit, avoiding the conflict with Python's httpx library.

Also applies to: 79-81

secator/installer.py (4)

89-101: LGTM! Binary name extraction and propagation to GithubInstaller.

The binary name is correctly retrieved from the tool class and passed to the GitHub installer path.


328-357: LGTM! GithubInstaller properly handles binary renaming.

The implementation correctly:

  1. Accepts binary_name parameter
  2. Computes final_binary_name with fallback to repo name
  3. Passes both repo_name (to find binary in archive) and binary_name (for final destination) to _download_and_unpack

447-491: LGTM! Archive extraction correctly handles binary renaming.

The separation of repo_name (for finding the binary in the archive) and binary_name (for the final destination) is the right approach. The binary is correctly:

  1. Located in the archive using the original repo_name
  2. Made executable
  3. Moved to the destination with the custom binary_name

115-115: Note: binary_name is passed but not used by SourceInstaller.install.

This call correctly passes binary_name, but as noted above, the SourceInstaller.install method doesn't actually use it to rename the installed binary.

@ocervell ocervell merged commit 320b8f7 into main Jan 9, 2026
10 checks passed
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.

2 participants