Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • BridgeDB BridgeDB
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 24
    • Issues 24
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • The Tor Project
  • Anti-censorship
  • BridgeDBBridgeDB
  • Issues
  • #11231
Closed
Open
Created Mar 18, 2014 by Isis Lovecruft@isis

BridgeDB's txrecaptcha returns the "No bridges available!" page if 'captcha_response_field' is blank

I was writing unittests for the bridgedb.HTTPServer module and discovered this.

What is happening is:

  • bridgedb.HTTPServer.ReCaptchaProtectedResource.render_POST(request) is called with blank strings for the 'captcha_challenge_field' and 'captcha_response_field' POST arguments.
  • bridgedb.HTTPServer.CaptchaProtectedResource.render_POST(request) is called.
  • bridgedb.HTTPServer.ReCaptchaProtectedResource.checkSolution(request) is called.
  • bridgedb.HTTPServer.CaptchaProtectedResource.extractClientSolution(request) is called, and it returns a tuple of (_, _), which in Python has a boolean value of True.
  • The empty strings return a bridgedb.txrecaptcha.RecaptchaResponse from bridgedb.HTTPServer.ReCaptchaProtectedResource.checkSolution() without hitting the callback function checkResponse().
  • The RecaptchaResponse also evaluates to True, meaning that checkSolution(request) in render_POST() passes, and the server tries to render the RecaptchaResponse object as the list of bridges to give to the client, resulting in the "No bridges available!" webpage.

That sounds confusing. But I have a unittest to prove it happens, and the solution is really simple:

In bridgedb.CaptchaProtectedResource.render_POST():

-        if self.checkSolution(request):
+        if self.checkSolution(request) is True:
Assignee
Assign to
Time tracking