Browse Source

add filter xss to attachment refs refs endpoint

NaokiHigashi28 1 year ago
parent
commit
68add38be0
1 changed files with 3 additions and 3 deletions
  1. 3 3
      packages/remark-attachment-refs/src/server/routes/refs.ts

+ 3 - 3
packages/remark-attachment-refs/src/server/routes/refs.ts

@@ -86,7 +86,7 @@ export const routesFactory = (crowi): any => {
   router.get('/ref', accessTokenParser, loginRequired, async(req: RequestWithUser, res) => {
     const user = req.user;
     const { pagePath, fileNameOrId } = req.query;
-
+    const filterXSS = new FilterXSS();
     if (pagePath == null) {
       res.status(400).send('the param \'pagePath\' must be set.');
       return;
@@ -96,7 +96,7 @@ export const routesFactory = (crowi): any => {
 
     // not found
     if (page == null) {
-      res.status(404).send(`pagePath: '${pagePath}' is not found or forbidden.`);
+      res.status(404).send(filterXSS.process(`pagePath: '${pagePath}' is not found or forbidden.`));
       return;
     }
 
@@ -117,7 +117,7 @@ export const routesFactory = (crowi): any => {
 
     // not found
     if (attachment == null) {
-      res.status(404).send(`attachment '${fileNameOrId}' is not found.`);
+      res.status(404).send(filterXSS.process(`attachment '${fileNameOrId}' is not found.`));
       return;
     }