shiftcommerce / penthouse Goto Github PK
View Code? Open in Web Editor NEW๐ A multi-tenancy framework
๐ A multi-tenancy framework
Some of the alias methods inside the Migrator have been changed in Activerecord >= 5.2.
These changes were dealt with by Apartment, so we can take some inspiration here: https://github.com/influitive/apartment/pull/523/files
Rubocop vulnerability present in penthouse.gemspec. We need to upgrade to 0.49.0 or later.
This needs to be complete by April 2019.
Vulnerability details:
RuboCop 0.48.1 and earlier does not use /tmp in safe way, allowing local users to exploit this to tamper with cache files belonging to other users.
yard vulnerability has been present in penthouse.gemspec since Dec 2017. We need to upgrade to 0.9.11 or later.
This needs to be complete by April 2019.
Due to time passed, I would suggest updating to the very latest version, if greater than 0.9.11, unless an issue is identified with doing so.
Vulnerability details:
lib/yard/core_ext/file.rb in the server in YARD before 0.9.11 does not block relative paths with an initial ../ sequence, which allows attackers to conduct directory traversal attacks and read arbitrary files.
Currently to handle shared tables, we're having to perform a lot of cruft in individual applications, this could be more neatly abstracted by Penthouse.
default_database_configuration = {
pool: 20,
connect_timeout: 5, # seconds
checkout_timeout: 5, # seconds
variables: { statement_timeout: 5_000 } # milliseconds
}.with_indifferent_access
ActionDispatch::Reloader.to_prepare do
# load our global database configuration
database_config = ActiveRecord::Base.configurations[Rails.env] ||
Rails.application.config.database_configuration[Rails.env]
# set some default values
database_config = default_database_configuration.deep_merge(database_config)
# set the global tables to use the global database
[Account, AccountSetting].each do |model|
# enforce the master connection
model.octopus_establish_connection(database_config)
# only allow use of master DB
model.allow_shard(Octopus.master_shard)
# ensure it has the public schema prefix
model.table_name = "public.#{model.table_name.split(".", 2).last}"
end
end
Penthouse.switch('tenant1') do
# tenant1
Penthouse.switch('tenant2') do
# tenant2
end
# public
end
As reported by @dmcnally
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.