Skip to content

Commit cd2ed1f

Browse files
authored
Merge pull request #7 from AKA-NETWORK/alert-autofix-210
Potential fix for code scanning alert no. 210: Type confusion through parameter tampering
2 parents 8983b3d + 10026bf commit cd2ed1f

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

examples/cms-agilitycms/lib/preview.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ export async function validatePreview({ agilityPreviewKey, slug, contentID }) {
8787
};
8888
}
8989

90+
// Ensure agilityPreviewKey is a string
91+
if (typeof agilityPreviewKey !== 'string') {
92+
return {
93+
error: true,
94+
message: `Invalid agilitypreviewkey type.`,
95+
};
96+
}
97+
9098
//sanitize incoming key (replace spaces with '+')
9199
if (agilityPreviewKey.includes(` `)) {
92100
agilityPreviewKey = agilityPreviewKey.split(` `).join(`+`);

0 commit comments

Comments
 (0)