Skip to content

Commit

Permalink
Merge pull request #4417 from brave-intl/staging
Browse files Browse the repository at this point in the history
Prod Release: 04-17-2024
  • Loading branch information
tsmartt authored Apr 17, 2024
2 parents 924eb34 + 0fe238d commit 26b5be2
Show file tree
Hide file tree
Showing 5 changed files with 2,137 additions and 2,617 deletions.
10 changes: 9 additions & 1 deletion app/controllers/api/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@ def authenticate

def authenticate_ip
return true if API_IP_WHITELIST.blank? && (Rails.env.development? || Rails.env.test?)
API_IP_WHITELIST.any? { |ip_addr| ip_addr.include?(request.remote_ip) }

direct_remote_ip = request.remote_ip
passed_from_next = request&.headers&.fetch("HTTP_ORIGINALIP", "")

authenticated = API_IP_WHITELIST.any? { |ip_addr| ip_addr.include?(direct_remote_ip) }
if !authenticated && passed_from_next.present?
authenticated = API_IP_WHITELIST.any? { |ip_addr| ip_addr.include?(passed_from_next) }
end
authenticated
end

def authenticate_token
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/active_analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def current_user
end

def current_ability
@current_ability ||= Ability.new(current_user, request.remote_ip)
@current_ability ||= Ability.new(current_user, request.remote_ip, request&.headers&.fetch("HTTP_ORIGINALIP", ""))
end
end
end
3 changes: 2 additions & 1 deletion config/webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const customConfig = {
'brave-ui': path.resolve(__dirname, '../../node_modules/brave-ui/src')
},
fallback: {
"crypto": require.resolve("crypto-browserify")
crypto: require.resolve("crypto-browserify"),
stream: require.resolve("stream-browserify"),
},
extensions: ['.css']
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"typescript": "^5.1.6"
},
"resolutions": {
"@babel/traverse": "7.24.1",
"**/@babel/traverse": "7.24.1",
"node-fetch": "3.3.2",
"nth-check": "2.1.1",
"postcss": "8.4.33",
Expand Down
Loading

0 comments on commit 26b5be2

Please sign in to comment.