Skip to content

Commit a3d9ee0

Browse files
authored
fix(frontend): Patch Artifact Storage Key XSS Vulnerability. Fixes #12670 (#12671)
format code change error response to 500 rework for simple length check revert unchanged files fix tests Signed-off-by: JerT33 <[email protected]>
1 parent 44df009 commit a3d9ee0

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

frontend/server/handlers/artifacts.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ export function getArtifactsHandler({
123123
res.status(500).send('Storage key is missing from artifact request');
124124
return;
125125
}
126+
if (key.length > 1024) {
127+
res.status(500).send('Object key too long');
128+
return;
129+
}
126130
console.log(`Getting storage artifact at: ${source}: ${bucket}/${key}`);
127131

128132
let client: MinioClient;

frontend/server/integration-tests/artifact-get.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,21 @@ describe('/artifacts', () => {
821821
.get(`/artifacts/get?source=volume&bucket=artifact&key=subartifact/notxist.csv`)
822822
.expect(500, 'Failed to open volume.');
823823
});
824+
825+
it('rejects keys longer than 1024 characters', async () => {
826+
const configs = loadConfigs(argv, {
827+
AWS_ACCESS_KEY_ID: 'aws123',
828+
AWS_SECRET_ACCESS_KEY: 'awsSecret123',
829+
});
830+
app = new UIServer(configs);
831+
const request = requests(app.start());
832+
await request
833+
.get(
834+
'/artifacts/get?source=s3&namespace=test&peek=256&bucket=ml-pipeline&key=' +
835+
'a'.repeat(1025),
836+
)
837+
.expect(500, 'Object key too long');
838+
});
824839
});
825840

826841
describe('/:source/:bucket/:key', () => {

0 commit comments

Comments
 (0)