-
Notifications
You must be signed in to change notification settings - Fork 138
fix: stop exposing client-side tokens #1329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a2b6a8c
8f47c28
fb43872
0190eea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -10,7 +10,7 @@ export interface GitHubOrgStats { | |||||
| totalRepositories: number; | ||||||
| totalContributors: number; | ||||||
| publicRepositories: number; | ||||||
| discussionsCount: number; | ||||||
| discussionsCount: number | null; | ||||||
| lastUpdated: number; | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -64,6 +64,8 @@ class GitHubService { | |||||
| private readonly CACHE_KEY = "github_org_stats"; | ||||||
| private readonly CACHE_DURATION = 30 * 60 * 1000; // 30 minutes in milliseconds | ||||||
| private readonly BASE_URL = "https://api.github.com"; | ||||||
| private readonly DISCUSSIONS_UNAVAILABLE_MESSAGE = | ||||||
| "GitHub Discussions are disabled until a server-side GitHub proxy is configured."; | ||||||
|
||||||
| "GitHub Discussions are disabled until a server-side GitHub proxy is configured."; | |
| "GitHub Discussions are available only server-side; configure GITHUB_TOKEN or a server-side GitHub proxy."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Abhash-Chakraborty , I had a quick question for you . is this gonna work around the discussions also , ATM the discussion in prod are working fine .
Copilot
AI
Apr 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getDiscussionsCount() returns 0 when GraphQL is unavailable in the browser. That makes downstream UI/reporting treat the value as a real count ("0 discussions") rather than "unavailable", which is misleading. Consider representing this as null/undefined (and updating GitHubOrgStats + UI), or surfacing an explicit "unavailable" flag/message instead of overloading 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Abhash-Chakraborty this can be doable
Copilot
AI
Apr 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even when canUseGitHubGraphQL() is true, fetchDiscussions() still calls https://api.github.com/graphql directly without any auth header. If/when this is invoked in a server-side context, it will still fail with 401 unless you route through an authenticated proxy or add server-side auth (e.g., from env). Consider failing fast with a clear configuration error when no server-side token/proxy is available, rather than attempting the call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new
markdown.hooks.onBrokenMarkdownLinksconfig is likely not a recognized Docusaurus option (Docusaurus 3.x supportsonBrokenMarkdownLinksas a top-level config). As written, this may be ignored and broken markdown links will use the default behavior instead ofwarn. Consider moving this toonBrokenMarkdownLinks: "warn"at the top level and removing themarkdown.hooksnesting.