mirror of
https://github.com/UNITRONIX/BetterDesk.git
synced 2026-10-26 14:30:19 +00:00
5ce1cc70fc
Import latest release failed with generic_agent_release_redirect_host_invalid because browser_download_url redirects to release-assets.githubusercontent.com, which was missing from the SSRF allowlist (already allowed in the module installer). Refs #475 Thanks: INSOLVE (Honorary); Marco Jakobs (@jacotec); MyNameisStitch (@MyNameisStitch); Redspin (@playerumpknow); muopc (@muopc)
30 lines
1.2 KiB
JavaScript
30 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
const {
|
|
resolveAllowedGithubHost,
|
|
GITHUB_FETCH_HOSTS,
|
|
} = require('../services/genericAgentReleaseService');
|
|
|
|
describe('genericAgentReleaseService GitHub redirect allowlist', () => {
|
|
it('allows the same GitHub download hosts as supportGeneratorModule (incl. release-assets CDN)', () => {
|
|
expect(resolveAllowedGithubHost('release-assets.githubusercontent.com'))
|
|
.toBe('release-assets.githubusercontent.com');
|
|
expect(resolveAllowedGithubHost('objects.githubusercontent.com'))
|
|
.toBe('objects.githubusercontent.com');
|
|
expect(resolveAllowedGithubHost('api.github.com')).toBe('api.github.com');
|
|
expect(resolveAllowedGithubHost('github.com')).toBe('github.com');
|
|
expect(Object.keys(GITHUB_FETCH_HOSTS).sort()).toEqual([
|
|
'api.github.com',
|
|
'github.com',
|
|
'objects.githubusercontent.com',
|
|
'release-assets.githubusercontent.com',
|
|
].sort());
|
|
});
|
|
|
|
it('rejects unrelated redirect hosts (SSRF guard)', () => {
|
|
expect(resolveAllowedGithubHost('evil.example')).toBeNull();
|
|
expect(resolveAllowedGithubHost('127.0.0.1')).toBeNull();
|
|
expect(resolveAllowedGithubHost('')).toBeNull();
|
|
});
|
|
});
|