INNER CODE UNIT · Python

oauth_callback

cisco-open/forge · .docker/forge-github-app-register/app.py:31

def oauth_callback():
    code = request.args.get('code')
    if not code:
        return "Missing 'code' parameter", 400

    # Local-only GitHub App registration helper; code is a GitHub API path segment.
    # lgtm[py/path-injection]
    url = f'{GITHUB_API}/app-manifests/{code}/conversions'
    headers = {'Accept': 'application/vnd.github.v3+json'}
    resp = requests.post(url, headers=headers, timeout=REQUEST_TIMEOUT_SECONDS)

    if resp.status_code != 201:
        # Local-only helper; upstream error text is returned only to the local operator.
        # lgtm[py/reflective-xss]
        error = f'Error converting manifest: {resp.status_code} {resp.text}'
        return error, 500

    data = resp.json()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…