[plugins/catalog-backend-module-github] Throw on invalid branch name
Signed-off-by: Luke Albao <luke.albao@webflow.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-backend-module-github': minor
|
||||
---
|
||||
|
||||
Explicitly rejects branch names containing a slash character
|
||||
+20
@@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user