Skip to content

Conversation

@assisted-by-ai
Copy link
Owner

Summary

  • prevent tor_bootstrap_check from crashing when bootstrap status lacks a PROGRESS field
  • fall back to an error exit code after closing the controller when parsing fails

Testing

  • Not run (not requested)

Codex Task

@assisted-by-ai
Copy link
Owner Author

Updated tor_bootstrap_check.py to safely handle bootstrap responses missing a PROGRESS field by exiting with an error code after closing the controller instead of raising an exception.

Comment on lines -31 to +35
progress_percent = re.match('.* PROGRESS=([0-9]+).*', bootstrap_status)
progress_percent = re.search(r"PROGRESS=([0-9]+)", bootstrap_status)

if not progress_percent:
controller.close()
sys.exit(255)

Choose a reason for hiding this comment

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

This is likely unnecessary - there are two places in C-Tor's source code that generate the output of a GETINFO status/bootstrap-phase command, one is https://gitlab.torproject.org/tpo/core/tor/-/blob/b5d08ddc09ec785d81e4043d9f9e2f032c9e49ab/src/feature/control/control_bootstrap.c#L165 and the other is https://gitlab.torproject.org/tpo/core/tor/-/blob/b5d08ddc09ec785d81e4043d9f9e2f032c9e49ab/src/feature/control/control_bootstrap.c#L324. Both of them include a PROGRESS= key. We could catch this, but it's probably not worth it.

@ArrayBolt3
Copy link

Rejected, seems unnecessary given the job this tool performs and the way Tor works under the hood in this area. This PR can be closed. (The security report may still be useful for the review of other PRs though.)

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.

3 participants