Skip to content

Commit 3ca6962

Browse files
committed
fix: allow any HTTPS host for dotfiles repo
Self-hosted GitLab, Gitea, etc. are valid. Only require HTTPS + valid path format, not a specific host allowlist.
1 parent d06fab3 commit 3ca6962

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

src/lib/server/validation.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,10 @@ describe('validateDotfilesRepo', () => {
141141
expect(result.error).toContain('too long');
142142
});
143143

144-
it('should reject disallowed hosts', () => {
145-
const result = validateDotfilesRepo('https://example.com/user/dotfiles.git');
144+
it('should accept any HTTPS host including self-hosted', () => {
145+
const result = validateDotfilesRepo('https://gitlab.huami.com/user/dotfiles.git');
146146

147-
expect(result.valid).toBe(false);
148-
expect(result.error).toContain('GitHub, GitLab, Bitbucket, or Codeberg');
147+
expect(result.valid).toBe(true);
149148
});
150149

151150

src/lib/server/validation.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,8 @@ export function validateDotfilesRepo(url: string | null | undefined): Validation
4949
const parsed = new URL(url);
5050
const hostname = parsed.hostname.toLowerCase();
5151

52-
const allowedHosts = ['github.com', 'gitlab.com', 'bitbucket.org', 'codeberg.org'];
53-
const isAllowed = allowedHosts.includes(hostname);
54-
55-
if (!isAllowed) {
56-
return {
57-
valid: false,
58-
error: 'Dotfiles repo must be hosted on GitHub, GitLab, Bitbucket, or Codeberg'
59-
};
52+
if (!hostname) {
53+
return { valid: false, error: 'Dotfiles repo URL is missing a hostname' };
6054
}
6155

6256
if (parsed.pathname.includes('..') || parsed.pathname.includes('//')) {

0 commit comments

Comments
 (0)