GitGuardian / ggshield

Find and fix 360+ types of hardcoded secrets and 70+ types of infrastructure-as-code misconfigurations.
https://gitguardian.com
MIT License
1.57k stars 138 forks source link

Use OS port selection for the local OAuth server #913

Open fbochu opened 3 weeks ago

fbochu commented 3 weeks ago

Is your feature request related to a problem? Please describe.

In the OAuthClient, we start a local HTTP server by trying out a series of ports. However the port selection could be made by the operating system by passing 0 as port number.

Describe the solution you'd like

from http.server import HTTPServer, SimpleHTTPRequestHandler
server = HTTPServer(("127.0.0.1", 0), SimpleHTTPRequestHandler)
print(server.server_address, server.server_name, server.server_port)
agateau-gg commented 2 weeks ago

Sounds like a good idea. I am going to mark this one as a good first issue.