-
-
Notifications
You must be signed in to change notification settings - Fork 255
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
GITHUB_ENTERPRISE_PORT incorrect placement due to bug in octonode #907
Comments
@quine are you still seeing this issue? Are you able to fix and test it? |
@jgadsden Sorry for not getting back to you sooner! Let me go back and check. |
thanks, much appreciated @quine - there have been a few changes in this area so it may be working now |
@jgadsden Roger that. Will test today. 🤞 |
@jgadsden Unfortunately, it looks like it's still constructing the URL incorrectly:
As an aside, seems like Octonode is no longer maintained -- repo's been archived. |
Okay, so this is still totally an issue with Octonode. I reckon, if it was at all possible to get a change upstream, we could do something like this in octonode/client.coffee, something like : if @options?.baseapipath and urlFromPath.pathname
urlFromPath.pathname = "#{@options.baseapipath}#{urlFromPath.pathname}"
_url = url.format
protocol: urlFromPath.protocol or @options?.protocol or "https:"
auth: urlFromPath.auth or if @token?.username and @token?.password then "#{@token.username}:#{@token.password}" else ''
hostname: urlFromPath.hostname or @options?.hostname or "api.github.com"
port: urlFromPath.port or @options?.port
pathname: urlFromPath.pathname
query: query and then update td.server/src/repositories/githubrepo.js like: const getClient = (accessToken) => {
const enterpriseHostname = env.get().config.GITHUB_ENTERPRISE_HOSTNAME;
if (enterpriseHostname) {
const port = env.get().config.GITHUB_ENTERPRISE_PORT;
const protocol = env.get().config.GITHUB_ENTERPRISE_PROTOCOL;
const enterpriseOpts = { hostname: `${enterpriseHostname}` };
enterpriseOpts.baseapipath = '/api/v3';
if (port) { enterpriseOpts.port = parseInt(port, 10); }
if (protocol) { enterpriseOpts.protocol = protocol; }
return github.client(accessToken, enterpriseOpts);
}
return github.client(accessToken);
}; At least then IDK, something like that might work, but again...octonode's no longer maintained, and I have no idea if anyone is taking the reins on it. |
@quine thank you for getting to the bottom of this - we can keep it open and see if a non-default GITHUB_ENTERPRISE_PORT using octonode can be correctly used |
@jgadsden Sure thing. TBH, simplest workaround in the interim is to just not take in/honor the Half-jokingly(?), someone could actually take over/fork Octonode -- or...more seriously, and far less appealing I'm sure, switch to something else, such as Octokit.js? 🙁 |
Describe the bug:
Threat Dragon is improperly constructing GitHub Enterprise (GHE) URLs (after initial OAuth login), leading to
404
errors on GHE, with Threat Dragon then returning500
errors.It appears to start here:
threat-dragon/td.server/src/repositories/githubrepo.js
Lines 9 to 10 in 6223384
The inclusion of both the base path (
/api/v3
) and theport
when constructing the URL for octonode causes the URL to be invalid.Using
github.company.com
as the example...enterpriseOpts
is set to, then:enterpriseOpts { hostname: 'github.company.com/api/v3', port: 443, protocol: 'https' }
this.options.hostname
ishttp://github.company.com/api/v3
, so_url
ends up beinghttps://github.company.com/api/v3:443/user
Expected behaviour:
Threat Dragon should properly construct the GHE URL.
Environment:
To Reproduce:
GITHUB_ENTERPRISE_HOSTNAME
in Threat Dragon's env/api/v3/user
returns an errortd.server
logs, displaying error similar to below:https://github.company.com/api/v3:443/user
The text was updated successfully, but these errors were encountered: