[plugins/catalog-backend-module-github] Throw on invalid branch name

Signed-off-by: Luke Albao <luke.albao@webflow.com>
This commit is contained in:
Luke Albao
2025-03-28 15:58:58 -07:00
parent a044efa187
commit f0c22ebd08
3 changed files with 31 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend-module-github': minor
---
Explicitly rejects branch names containing a slash character
@@ -311,4 +311,24 @@ describe('readProviderConfigs', () => {
expect(() => readProviderConfigs(config)).toThrow();
});
it('throws an error when filters.branch contains a slash', () => {
const config = new ConfigReader({
catalog: {
providers: {
github: {
invalidBranchUser: {
organization: 'test-org',
catalogPath: '/*/catalog-info.yaml',
filters: {
branch: 'test/a',
},
},
},
},
},
});
expect(() => readProviderConfigs(config)).toThrow();
});
});
@@ -104,6 +104,12 @@ function readProviderConfig(
);
}
if (branchPattern?.includes('/')) {
throw new Error(
'Error while processing GitHub provider config. Slash characters (/) are not allowed in filters.branch',
);
}
const schedule = config.has('schedule')
? readSchedulerServiceTaskScheduleDefinitionFromConfig(
config.getConfig('schedule'),