Read private repositories only with the user's own GitHub token

GITHUB_ACCESS_TOKEN belongs to the server, but any user could ingest any
repository it can see, private ones included. It is now used only for
public repositories; the loader checks the repository's visibility first
and asks for a GitHub connection otherwise.

The loader also takes a token from the connection a source syncs from.
Merging a connection's keys into a plain repository URL no longer fails
on json.loads, manual Sync now passes the source's connection, and a
token GitHub rejects pauses the connection's sources for reconnect.
This commit is contained in:
arc53-machine committed 2026-09-29 10:41:03 +01:00
1 parent 35d6d80e87
commit 3572d968ec
9 files changed
+357 -22

No files matched your search

+2
View File
@@ -452,6 +452,8 @@ class SyncSource(Resource):
sync_frequency=doc.get("sync_frequency", "never"),
retriever=doc.get("retriever", "classic"),
doc_id=str(doc["id"]),
# S3 and GitHub sources made from a connection read with its keys.
connection_id=str(doc["connection_id"]) if doc.get("connection_id") else None,
)
except Exception as err:
current_app.logger.error(
+2
View File
@@ -277,6 +277,7 @@ def sync_source(
sync_frequency,
retriever,
doc_id,
connection_id=None,
):
resp = sync(
self,
@@ -287,6 +288,7 @@ def sync_source(
sync_frequency,
retriever,
doc_id,
connection_id=connection_id,
)
return resp