Skip to content

Commit

Permalink
Merge pull request #280 from gouravmore/all-1.4.0
Browse files Browse the repository at this point in the history
Issue #235359 fix: Missing Content Security Policy for learner ai app
  • Loading branch information
gouravmore authored Feb 19, 2025
2 parents 7444ccb + 27af833 commit 3245745
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
9 changes: 9 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta http-equiv="Content-Security-Policy" content="
default-src 'self' https://*.squarespace-cdn.com https://*.googleapis.com https://*.gstatic.com https://*.cdnfonts.com https://*.jsdelivr.net;
img-src 'self' data: https://*.squarespace-cdn.com;
style-src 'self' https://*.googleapis.com https://*.gstatic.com https://*.cdnfonts.com;
script-src 'self' https://*.jsdelivr.net;
font-src 'self' https://*.googleapis.com https://*.gstatic.com https://*.cdnfonts.com;
connect-src 'self';
frame-ancestors 'self';
">
<meta
name="description"
content="Base React App structure for Devigital Systems Projects"
Expand Down
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const App = () => {
window.parent.postMessage(
{
message: "Unauthorized",
}
}, window?.location?.ancestorOrigins?.[0] || window.parent.location.origin
);
} else {
localStorage.clear();
Expand Down
2 changes: 1 addition & 1 deletion src/components/Assesment/Assesment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ export const ProfileHeader = ({
const handleProfileBack = () => {
try {
if (process.env.REACT_APP_IS_APP_IFRAME === "true") {
window.parent.postMessage({ type: "restore-iframe-content" });
window.parent.postMessage({ type: "restore-iframe-content" }, window?.location?.ancestorOrigins?.[0] || window.parent.location.origin);
navigate("/");
} else {
navigate("/discover-start");
Expand Down
2 changes: 1 addition & 1 deletion src/components/DiscoverSentance/DiscoverSentance.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const SpeakSentenceComponent = () => {
{
score: score,
message: "all-test-rig-score",
}
}, window?.location?.ancestorOrigins?.[0] || window.parent.location.origin
);
}
};
Expand Down
5 changes: 1 addition & 4 deletions src/services/content/contentService.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ const getHeaders = () => {
return {
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
"Cache-Control": "no-cache",
Pragma: "no-cache",
"Content-Security-Policy": "default-src 'self'"
"Content-Type": "application/json"
}
};
};
Expand Down
5 changes: 1 addition & 4 deletions src/services/learnerAi/learnerAiService.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ const getHeaders = () => {
return {
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
"Cache-Control": "no-cache",
Pragma: "no-cache",
"Content-Security-Policy": "default-src 'self'"
"Content-Type": "application/json"
},
};
};
Expand Down
5 changes: 1 addition & 4 deletions src/services/orchestration/orchestrationService.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ const getHeaders = () => {
return {
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
"Cache-Control": "no-cache",
Pragma: "no-cache",
"Content-Security-Policy": "default-src 'self'"
"Content-Type": "application/json"
},
};
};
Expand Down
4 changes: 2 additions & 2 deletions src/views/Practice/Practice.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const Practice = () => {
{
score: score,
message: "all-test-rig-score",
}
}, window?.location?.ancestorOrigins?.[0] || window.parent.location.origin
);
}
};
Expand Down Expand Up @@ -713,7 +713,7 @@ const Practice = () => {
"mechanic_1")
? 500
: stringLengths[0];
window.parent.postMessage({ type: "stringLengths", length });
window.parent.postMessage({ type: "stringLengths", length }, window?.location?.ancestorOrigins?.[0] || window.parent.location.origin);
}
}
}, [questions[currentQuestion]]);
Expand Down

0 comments on commit 3245745

Please sign in to comment.