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

CORS Security Patch Fix on files docker-compose.yml and config/application.rb #47

Open
wants to merge 4 commits into
base: development
Choose a base branch
from
Open
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
15 changes: 12 additions & 3 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,21 @@ class Application < Rails::Application
Rails.root.join('app', 'models', 'similarity')

# CORS config
config.middleware.insert_before Warden::Manager, Rack::Cors do
# config.middleware.insert_before Warden::Manager, Rack::Cors do
# allow do
# origins '*'
# resource '*', headers: :any, methods: %i(get post put delete options)
# end
# end

# Updated CORS Security Patch Fix
config.middleware.insert_before Warden::Manager, Rack::Cors do
allow do
origins '*'
origins ENV['DF_ALLOWED_ORIGINS'].split(',')
resource '*', headers: :any, methods: %i(get post put delete options)
end
end
end

# Generators for test framework
if Rails.env.test?
config.generators do |g|
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ services:
environment:
RAILS_ENV: 'development'

# CORS Vulnerability Remediation
# The DF_ALLOWED_ORIGINS variable must reflect the exact URLs where the OnTrack app will be accessed (e.g., production, staging, or development URLs).
# Allowed origins must reflect the exact URLs where the OnTrack app will be accessed.
# Failure to update this variable with the correct origins will cause inaccessibility.
DF_ALLOWED_ORIGINS: "http://localhost:4200"

DF_STUDENT_WORK_DIR: /student-work
DF_INSTITUTION_HOST: http://localhost:3000
DF_INSTITUTION_PRODUCT_NAME: OnTrack
Expand Down