Skip to content
Draft
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
9 changes: 5 additions & 4 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ database:
dbHost: "{{secretsmanager:/prod/db/host}}"
dbPort: "{{secretsmanager:/prod/db/port}}"

##### storing keys in this file and committing to git is a security risk. Also hard to manage configs for different environments
api:
paymentGatewayKey: "Fg7H2yLdM8VpQz3N6RbXtPWaK4CsJ9T5"
smsProviderKey: "X1Y2Z3A4B5C6D7E8F9G0H1I2J3K4L5M6"
internalServiceToken: "{{secretsmanager:/prod/api/internalService}}"
analyticsIntegrationKey: "{{ssm:/prod/api/analytics}}"
paymentGatewayKey: "Fg7H2yLdM8VpQz3N6RbXtPWaK4CsJ9T5"
smsProviderKey: "X1Y2Z3A4B5C6D7E8F9G0H1I2J3K4L5M6"
internalServiceToken: "{{secretsmanager:/prod/api/internalService}}"
analyticsIntegrationKey: "{{ssm:/prod/api/analytics}}"

thirdParty:
awsAccessKey: "{{secretsmanager:/aws/access-key}}"
Expand Down
3 changes: 3 additions & 0 deletions graphql/dataSources.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// /graphql/dataSources.ts

// highly sensitive endpoints here, should have permissions checks
export class UserAPI {
// =====================================
// Existing Methods
// =====================================

async getUserDetails(userId: string) {
// probaly need to make sure only admin or the user themselves can access this
const response = await fetch(`https://circle-api.com/user/${userId}/details`, {
method: 'GET',
headers: {
Expand Down Expand Up @@ -50,6 +52,7 @@ export class UserAPI {
return await response.json();
}

// need to probbaly make sure only the highest permission level can delete users
async deleteUser(userId: string) {
const response = await fetch(`https://circle-api.com/user/${userId}`, {
method: 'DELETE',
Expand Down
2 changes: 1 addition & 1 deletion pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default NextAuth({
case 'alice':
token.role = Roles.ADMIN;
break;
case 'bob':
case 'bob': // should not hard code role like this
token.role = Roles.USER;
break;
default:
Expand Down