Skip to content

Commit

Permalink
Remove the user/admin-create endpoint
Browse files Browse the repository at this point in the history
In theory, this allowed admins to create user profiles,
primed and ready for the person to log in.

Cloudwatch shows this was actually done only a handful of times in 2021.

Additionally, imperfect sanitization of the username field could
lead to CSV injection attacks, via the export on Users.jsx.
  • Loading branch information
benmartin-coforma committed Jan 16, 2025
1 parent 9366a9a commit aa61a93
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 311 deletions.
8 changes: 0 additions & 8 deletions services/app-api/handlers/users/post/createUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ export const main = handler(async (event, context) => {
return await createUser(userData);
});

export const adminCreateUser = handler(async (event, context) => {
await authorizeAdmin(event);

const userData = JSON.parse(event.body);

return await createUser(userData);
});

const createUser = async (userData) => {
if (!userData.username) {
return `Please enter a username`;
Expand Down
9 changes: 0 additions & 9 deletions services/app-api/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,6 @@ functions:
method: post
cors: true
authorizer: aws_iam
adminCreateUser:
handler: handlers/users/post/createUser.adminCreateUser
role: LambdaApiRole
events:
- http:
path: users/admin-add
method: post
cors: true
authorizer: aws_iam
deleteUser:
handler: handlers/users/post/deleteUser.main
role: LambdaApiRole
Expand Down
181 changes: 0 additions & 181 deletions services/ui-src/src/components/AddUser/AddUser.jsx

This file was deleted.

16 changes: 0 additions & 16 deletions services/ui-src/src/components/AddUser/AddUser.scss

This file was deleted.

85 changes: 0 additions & 85 deletions services/ui-src/src/components/AddUser/AddUser.test.jsx

This file was deleted.

4 changes: 0 additions & 4 deletions services/ui-src/src/components/Routes/Routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import Users from "../Users/Users";
import EditUser from "../EditUser/EditUser";
import Example from "../Example/Example";
import Quarterly from "../Quarterly/Quarterly";
import UserAdd from "../AddUser/AddUser";
import Unauthorized from "../Unauthorized/Unauthorized";
import FormPage from "../FormPage/FormPage";
import StateSelector from "../StateSelector/StateSelector";
Expand Down Expand Up @@ -85,9 +84,6 @@ export default function Routes({ user, isAuthorized }) {
<AuthenticatedRoute exact path="/form-templates">
<FormTemplates />
</AuthenticatedRoute>
<AuthenticatedRoute exact path="/users/add">
<UserAdd />
</AuthenticatedRoute>
<AuthenticatedRoute exact path="/users/:id/edit">
<EditUser />
</AuthenticatedRoute>
Expand Down
8 changes: 0 additions & 8 deletions services/ui-src/src/libs/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ export const createUser = async data => {
return API.post("mdct-seds", `/users/add`, opts);
};

// *** create user - admin only
export const adminCreateUser = async data => {
const opts = await requestOptions();
opts.body = data;

return API.post("mdct-seds", `/users/admin-add`, opts);
};

/*************************** FORMS API ***************************/
// *** get forms associated with a specified state for specified year and quarter
export const getStateForms = async data => {
Expand Down

0 comments on commit aa61a93

Please sign in to comment.