File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,6 +41,10 @@ export class MockDataSource implements DataSource {
4141 }
4242
4343 async getObjectSchema ( objectName : string ) : Promise < any > {
44+ if ( ! objectName || typeof objectName !== 'string' ) {
45+ throw new Error ( 'Invalid object name' ) ;
46+ }
47+
4448 console . log ( `[DataSource] Getting schema for ${ objectName } ` ) ;
4549 // Return a minimal schema for mock purposes
4650 return {
Original file line number Diff line number Diff line change @@ -171,7 +171,16 @@ export class RestDataSource<T = any> implements DataSource<T> {
171171 * Get object schema/metadata
172172 */
173173 async getObjectSchema ( objectName : string ) : Promise < any > {
174- const url = `${ this . baseUrl } /_schema/${ objectName } ` ;
174+ if ( ! objectName || typeof objectName !== 'string' ) {
175+ throw new Error ( 'Invalid object name' ) ;
176+ }
177+
178+ // Validate object name to prevent path traversal
179+ if ( objectName . includes ( '/' ) || objectName . includes ( '\\' ) || objectName . includes ( '..' ) ) {
180+ throw new Error ( 'Invalid object name: must not contain path separators' ) ;
181+ }
182+
183+ const url = `${ this . baseUrl } /_schema/${ encodeURIComponent ( objectName ) } ` ;
175184
176185 const response = await fetch ( url ) ;
177186
You can’t perform that action at this time.
0 commit comments