codecov / codecov-browser-extension

A browser extension for Codecov. Works for Chrome and Firefox
Apache License 2.0
36 stars 11 forks source link

Unable to configure for self hosted instance. #64

Closed trevjonez closed 1 month ago

trevjonez commented 8 months ago

https://github.com/codecov/codecov-browser-extension/blob/0a395bfb6e35dc0eb958d70ba176c40aed70d54a/src/service.ts#L15

Current auth check logic seems to assume that the github user codecov would exist in the server. But in the case of self hosted that is not the case.

As is the api call will return a 404 and the extension will fail to initialize.

These json blobs are the logs from the actual containers of my instance.

{
    "message": "Not Found: /api/v2/github/codecov",
    "asctime": "2024-01-29 21:25:37,486",
    "name": "django.request",
    "levelname": "WARNING",
    "lineno": 241,
    "pathname": "/usr/local/lib/python3.9/site-packages/django/utils/log.py",
    "funcName": "log_response",
    "threadName": "MainThread",
    "status_code": 404,
    "request": "<WSGIRequest: GET '/api/v2/github/codecov'>",
    "logger.name": "django.request",
    "logger.thread_name": "MainThread",
    "level": "WARNING"
}
{
    "remote_address": "10.208.172.136",
    "request_time": "[29/Jan/2024:21:25:37 +0000]",
    "request": "GET /api/v2/github/codecov HTTP/1.1",
    "status_code": "404",
    "response_length": "23",
    "referer": "-",
    "useragent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36"
}

Using that service.ts file as a guide I am able to poke at it with curl to see the body of the reply as well as test it with a different username to confirm what a 200 reply would look like.

image

trevjonez commented 8 months ago

looks like just removing the username may be sufficient for testing the auth token provided. image