Insecure Design

Failing Securely
@app.route('/connect/<client_id>')
def connect(client_id):
  """Attempt to open a connection the specified client."""

  try:
    connection = pool.connect(client_id)
    session['connection_id'] = connection.id
    return { 'message' : 'Connection established' }
  except ConnectionFailure as e:
    # Log the error on the server-side, but send an innocuous message
    # back to the user so we don't leak information.
    log.error(e)
    return { 'message' : 'Unable to connect' }, 400