Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #14314
Closed
Open
Issue created Jan 21, 2015 by Trac@tracbot

ExitPolicy.can_exit_to() returns incorrect results when address is omitted

Note: this is with Stem version 1.3.0

When using ExitPolicy.can_exit_to(port=443, strict=False), an incorrect result is returned. Ex:

>>> policy = ExitPolicy('reject 1.0.0.0/8:*', 'accept *:*')
>>> policy.can_exit_to(port=443, strict=False)
>>> False

If an address is included, however, the results are as expected:

>>> policy = ExitPolicy('reject 1.0.0.0/8:*', 'accept *:*')
>>> policy.can_exit_to(address='8.8.8.8', port=443, strict=False)
>>> True

According to Stem's documentation for can_exit_to() for the 'strict' parameter:

strict (bool) -- if the address or port is excluded then check if we can exit to all instances of the defined address or port

I interpret this to mean:

If 'strict' is True, then can_exit_to() should return True iff exits to all possible IPs are allowed on the specified port when 'address' is omitted. If 'strict' is False, then can_exit_to() should return True if any exits to the specified port are allowed when 'address' is omitted.

Is this just a misunderstanding of the documentation on my part? Or is this actually a bug?

Attached: a script to reproduce the issue.

Trac:
Username: nskinkel

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking