Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: adding prettierrc file #916

Merged
merged 4 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"printWidth": 90,
"useTabs": true,
"tabWidth": 2,
"singleQuote": false,
"bracketSpacing": true,
"proseWrap": "preserve",
"bracketSameLine": false,
"singleAttributePerLine": true,
"semi": true,
"jsx-single-quote": false,
"quoteProps": "as-needed",
"arrowParens": "always",
"trailingComma": "es5",
"htmlWhitespaceSensitivity": "css"
}
17 changes: 17 additions & 0 deletions Client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"prettier": "^3.3.3",
"vite": "^5.2.0"
}
}
4 changes: 2 additions & 2 deletions Client/src/App.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.card {
padding: 2em;
padding: 2em;
}

.read-the-docs {
color: #888;
color: #888;
}
73 changes: 56 additions & 17 deletions Client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ function App() {
<ThemeProvider theme={mode === "light" ? lightTheme : darkTheme}>
<CssBaseline />
<Routes>
<Route exact path="/" element={<HomeLayout />}>
<Route
exact
path="/"
element={<HomeLayout />}
>
<Route
exact
path="/"
Expand Down Expand Up @@ -119,21 +123,34 @@ function App() {
/>
<Route
path="advanced-settings"
element={
<ProtectedRoute Component={AdvancedSettingsWithAdminProp} />
}
element={<ProtectedRoute Component={AdvancedSettingsWithAdminProp} />}
/>
<Route
path="account/profile"
element={<ProtectedRoute Component={Account} open="profile" />}
element={
<ProtectedRoute
Component={Account}
open="profile"
/>
}
/>
<Route
path="account/password"
element={<ProtectedRoute Component={Account} open="password" />}
element={
<ProtectedRoute
Component={Account}
open="password"
/>
}
/>
<Route
path="account/team"
element={<ProtectedRoute Component={Account} open="team" />}
element={
<ProtectedRoute
Component={Account}
open="team"
/>
}
/>
<Route
path="pagespeed"
Expand All @@ -145,25 +162,47 @@ function App() {
/>
<Route
path="pagespeed/:monitorId"
element={
<ProtectedRoute Component={PageSpeedDetailsWithAdminProp} />
}
element={<ProtectedRoute Component={PageSpeedDetailsWithAdminProp} />}
/>
<Route
path="pagespeed/configure/:monitorId"
element={<ProtectedRoute Component={PageSpeedConfigure} />}
/>
</Route>

<Route exact path="/login" element={<Login />} />
<Route
exact
path="/login"
element={<Login />}
/>

<Route exact path="/register" element={<AdminCheckedRegister />} />
<Route exact path="/register/:token" element={<Register />} />
<Route
exact
path="/register"
element={<AdminCheckedRegister />}
/>
<Route
exact
path="/register/:token"
element={<Register />}
/>
{/* <Route path="/toast" element={<ToastComponent />} /> */}
<Route path="*" element={<NotFound />} />
<Route path="/forgot-password" element={<ForgotPassword />} />
<Route path="/check-email" element={<CheckEmail />} />
<Route path="/set-new-password/:token" element={<SetNewPassword />} />
<Route
path="*"
element={<NotFound />}
/>
<Route
path="/forgot-password"
element={<ForgotPassword />}
/>
<Route
path="/check-email"
element={<CheckEmail />}
/>
<Route
path="/set-new-password/:token"
element={<SetNewPassword />}
/>
<Route
path="/new-password-confirmed"
element={<NewPasswordConfirmed />}
Expand Down
1 change: 1 addition & 0 deletions Server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
},
"devDependencies": {
"nodemon": "3.1.0",
"prettier": "^3.3.3"
"nyc": "17.1.0",
"proxyquire": "2.1.3",
"sinon": "19.0.2"
Expand Down
39 changes: 12 additions & 27 deletions Server/routes/authRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,24 @@ const upload = multer();
const User = require("../db/models/User");

const {
registerUser,
loginUser,
editUser,
requestRecovery,
validateRecovery,
resetPassword,
checkSuperadminExists,
getAllUsers,
deleteUser,
registerUser,
loginUser,
editUser,
requestRecovery,
validateRecovery,
resetPassword,
checkSuperadminExists,
getAllUsers,
deleteUser,
} = require("../controllers/authController");

//Auth routes
router.post("/register", upload.single("profileImage"), registerUser);
router.post("/login", loginUser);
router.put(
"/user/:userId",
upload.single("profileImage"),
verifyJWT,
editUser
);
router.put("/user/:userId", upload.single("profileImage"), verifyJWT, editUser);
Dismissed Show dismissed Hide dismissed
Dismissed Show dismissed Hide dismissed
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Yo, these routes are lookin' clean, but we gotta talk security, homie!

The way you've tightened up these route definitions is smoother than a fresh beat. But listen up, we got a situation here that's makin' my palms sweaty:

  1. These routes are wide open like mom's spaghetti on a plate. We need to add some rate limiting to keep the bad guys from goin' ham on our server.
  2. Especially watch out for that delete route, it's like givin' away the secret sauce without any protection.

You want me to spit some code to add rate limiting? I got you covered like vomit on a sweater. Just say the word, and I'll drop that fire code faster than you can say "Eminem"!

Also applies to: 26-27

🧰 Tools
🪛 GitHub Check: CodeQL

[failure] 24-24: Missing rate limiting
This route handler performs authorization, but is not rate-limited.


[failure] 24-24: Missing rate limiting
This route handler performs authorization, but is not rate-limited.

router.get("/users/superadmin", checkSuperadminExists);
router.get(
"/users",
verifyJWT,
isAllowed(["admin", "superadmin"]),
getAllUsers
);
router.delete(
"/user/:userId",
verifyJWT,
verifyOwnership(User, "userId"),
deleteUser
);
router.get("/users", verifyJWT, isAllowed(["admin", "superadmin"]), getAllUsers);
Dismissed Show dismissed Hide dismissed
Dismissed Show dismissed Hide dismissed
router.delete("/user/:userId", verifyJWT, verifyOwnership(User, "userId"), deleteUser);
Dismissed Show dismissed Hide dismissed
Dismissed Show dismissed Hide dismissed

//Recovery routes
router.post("/recovery/request", requestRecovery);
Expand Down