INNER CODE UNIT · Python

manifest

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

def manifest():
    return send_from_directory(STATIC_DIR, 'app-manifest.json', mimetype='application/json')


@app.route('/oauth/callback', methods=['GET'])
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.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…