Skip to content

Commit

Permalink
chore: add harcoded web app CORS origins [CFISO-2167] (#9438)
Browse files Browse the repository at this point in the history
* chore: add hardcoded web app origins
  • Loading branch information
denkristoffer authored Feb 5, 2025
1 parent 942fc1f commit ed7ff16
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 7 deletions.
1 change: 0 additions & 1 deletion apps/slack/lambda/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ SLACK_CLIENT_ID=from-slack_app
SLACK_CLIENT_SECRET=from-slack-app
FRONTEND_URL=https://something.ngrok.io
BACKEND_URL=https://some-other-thing.ngrok.io/api
WEB_APP_URL=https://localhost:3001
1 change: 0 additions & 1 deletion apps/slack/lambda/config/serverless.dev.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ variables:
dynamoEndpoint: http://dynamodb:8000
frontendUrl: 'http://localhost:1234'
workflowsUrl: 'workflows-url-for-cors'
webAppUrl: 'https://app.contentful.com'
serverless:
pathPrefix: '/dev'
customDomain:
Expand Down
1 change: 0 additions & 1 deletion apps/slack/lambda/config/serverless.prd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ variables:
dynamoEndpoint: dynamodb.${aws:region}.amazonaws.com
frontendUrl: 'https://slack.ctfapps.net/index.html'
workflowsUrl: 'https://17a00aa2-860a-4c54-849b-d831f0198a13.ctfcloud.net'
webAppUrl: 'https://app.contentful.com'
baseUrl: 'https://api.contentful.com'
app:
privateKey: ${ssm:/aws/reference/secretsmanager/ci/apps/slack/prd/private-key}
Expand Down
1 change: 0 additions & 1 deletion apps/slack/lambda/config/serverless.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ variables:
dynamoEndpoint: dynamodb.${aws:region}.amazonaws.com
frontendUrl: 'https://slack-test.ctfapps.net/index.html'
workflowsUrl: ${env:STAGING_WORKFLOWS_URL}
webAppUrl: 'https://app.contentful.com'
baseUrl: ${env:STAGING_CMA_HOST}
app:
privateKey: ${ssm:/aws/reference/secretsmanager/ci/apps/slack/test/private-key}
Expand Down
1 change: 0 additions & 1 deletion apps/slack/lambda/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const config = {
appId: envOr('APP_ID', 'unknown'),
frontendUrl: envOr('FRONTEND_URL', 'https://localhost:3001'),
workflowsUrl: envOr('WORKFLOWS_URL', 'https://localhost:3001'),
webAppUrl: envOr('WEB_APP_URL', 'https://localhost:3001'),
backendUrl: envOr('BACKEND_URL', 'https://localhost:3000/dev/api'),
signingSecret: envOr('SIGNING_SECRET', 'shhhh'),
serverless: {
Expand Down
3 changes: 2 additions & 1 deletion apps/slack/lambda/lib/middlewares/corsConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { config } from '../config';
const frontendUrl = new URL(config.frontendUrl);
const allowedUrls = [
config.workflowsUrl,
config.webAppUrl,
frontendUrl.origin,
'https://app.contentful.com',
'https://app.eu.contentful.com',
/(http:\/\/localhost):(\d{1,4})/,
];

Expand Down
1 change: 0 additions & 1 deletion apps/slack/lambda/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ functions:
SLACK_SIGNING_SECRET: ${self:custom.slackSigningSecret.signing_secret}
FRONTEND_URL: ${self:custom.frontendUrl}
WORKFLOWS_URL: ${self:custom.workflowsUrl}
WEB_APP_URL: ${self:custom.webAppUrl}
BACKEND_URL: https://${self:custom.customDomain.domainName}/api
SIGNING_SECRET: ${self:custom.signingSecret.signing_secret}
PRIVATE_APP_KEY: ${self:custom.app.privateKey}
Expand Down

0 comments on commit ed7ff16

Please sign in to comment.