What are current best practices for development database credential management? - database

In our shop we store credentials for Test and Prod resources in a secured vault and our CI/CD pipelines manage retrieval and provide access by the apps to those credentials at run time. This works great.
However, the vaulting mechanism is not accessible from a local development workstation which makes management of credentials to our Dev database a hassle.
Various mechanisms have been suggested:
1. give each dev access to the DB on their specific credentials
The concern here is that apps are not owned by specific teams so anyone new to the code base would need to request db accesses to be setup.
use a common account and share credentials among the team
One sharing approach suggested is to check the shared credentials into the code repo as an environment specific configuration. provided those credentials have limited access (dev db, read,write permissions) and the data bears no relation to real data, its low risk. (We also have on-premise code repository thats not publicly accessibly)
Another is to store the creds in plain text on a secured location. But that requires the dev to locate the creds each time they get a local copy of the code.it also opens the risk that a file setup for the app gets inadvertently checked into the code repository. (see above)
What are others doing to solve this problem?

A couple alternate options that I've done.
Get everyone use a local db - understand this might not be viable depending on your scenario. DEVs could restore their local databases from backup (taken from say a test environment), OR (for new/greenfield projects), you could use a local containerised database where all DDL and config data is created via database migration framework - the latter is what we do at my workplace (we're using SQL Server and DbUp as migration framework). Note: we're not seeding the database with test data, but this is something you can also look into...
Use git-crypt (or something similar) for transparent encryption and decryption of specific files in a git repository e.g. config file containing database password.

Related

Synchronizing identity server 4 instances

I work for a company that owns multiple factories, one of our goals is to allow every factory to continue operating even without a working internet connection. We host a single identity server 4 instance to manage our authentication and authorization. The authentication is done with windows authentication and the domain service is replicated across every factory. In our current setup when the connection to the central identity server is down our users cannot be authenticated.
We want to move to a setup where every factory will host its own version of identity server to authentication can happen even without a connection to the central service. The downside to this approach is that it makes configuration very tedious and error-prone. Most of our users require the same access in every factory, so if we need to update a user's claims or role we need to reconfigure this in every factory. We want to fix this by hosting a central identity server and push all changes to the local instances on a database level. We only want to allow one-way synchronization, so no local configuration or local to central pushing of data.
Are we on the right track with this approach or are we missing something? Are there any best practices for centralized configuration with localized hosting of identity server 4? Any ideas will be helpful.
We want to fix this by hosting a central identity server and push all changes to the local instances on a database level. We only want to allow one-way synchronization, so no local configuration or local to central pushing of data.
Having multi DB and data sync between them seems to be a very good option based on your requirements.
You can have a CI/CD in place for code deployment to make sure all instance apps are sync and move all configurations and user data to DB as your plan.
To sync the data you can use SQL Data Sync for Azure as this is the Distributed Applications case.
Are we on the right track with this approach or are we missing something? Are there any best practices for centralized configuration with localized hosting of identity server 4? Any ideas will be helpful.
I'm not sure if this is much related to IdentityServer, this sounds more like a distributed application solution to me. Saying this as you might need to extend your search criteria to look for any application type with same model.

Storage options for win 8/10 universal app?

Assuming I want to develop a Win 8/10 universal app eg calendar, the user has a two devices tablet/phone.
How can my calendar share a local SQL database?
I don't want to maintain or administer an azure service or any other remote DB service ie AWS, VPS running SQL Express etc.. which is overkill for such a basic scenario.
I have considered SQLite and dumping the DB file in the users MS OneDrive folder but as we know this could result in sync/lock issues.
So using a purely self contained & free model, how can my two devices share this basic SQL data?
If the database is small you can save it in the RoamingFolder and let Windows take care of copying it to the other system.
See Quickstart: Roaming app data
Other than that storing the data in a cloud service such as an Azure Mobile App Service is the easiest and cleanest solution. Azure Mobile Services support offline sync to SQLite if you need to support both online and offline scenarios.
Saving app data on the user's OneDrive or dropbox and then explicitly downloading it to use is possible but more difficult and a bit dirtier since the data will be visible to the user and could be accidentally deleted, moved, etc. For a personal app it's not bad but I wouldn't do this in production.
If you're copying the database between systems (either via roaming or via a data storage site) you'll need to devise a way to handle conflicts. This is simpler if everything is kept in a single cloud database.

Why can't I access a Notes DB with manager access on the ACL?

I have to make some changes to an application hosted within Lotus Notes 8.5.
The database normally resides on a Domino server so I've made a local copy with no encryption and ensured I have manager access in the access control list.
Yet, when I try to run the application for testing purposes, I get a dialog box stating "You are not authorised to run this application". This shouldn't be the case since manager is the highest level of access.
I've tried multiple solutions found on the net in just about every combination I can think of:
copying with and without encryption.
copying and not copying the ACL.
copying the whole DB and copying design only.
compacting the local DB with ncompact after removing encryption.
restarting Notes frequently and regularly :-)
Nothing seems to work, Notes refuses to let me access the database. I have checked effective access of my user ID and it does state I have manager access but still no go.
How can I figure out why it's refusing to let me run the application?
In case roles are used in your database and restrict access then you have to set in ACL option Advanced / Enforce a consistent ACL across all replicas
for local stored database.
It is specific to local databases that normally all roles are ignored. The consistent ACL option is the only way to make them work. Here is a detailed description how this option affects the access to a local database. It don't have to be necessary a local replica - it works the same way for a local copy too.
You have to be a bit careful about this option. You can exclude yourself from ACL changes setting this option without leaving/setting administrator access for you.

Is it possible to secure local database data when selling an offline (local installation) web app?

A typical scenario: I have a database with very valuable information but need to offer an offline installation of the software (WAMP/LAMP). With MySQL you can easily copy/paste database files, also PHP script defines user db access in a readable format. Is there any way data can be protected from 'stealing'? If not what is the best platform (web app, desktop app, ...) to achieve such?
You cannot stop that user from stealing the data but it should be possible to encrypt the local data with JS in case the laptop is stolen etc. To do this you would need to prompt the user for the encryption key or use some other method... It should obviously not be stored in the local database itself

Permissions For Deploying Database Schema Changes

I've got a Python application that connected to Microsoft SQL Server 2000. The application checks for updates on startup and automatically applies them. Soon, it will need to handle database schema changes as well. Based on my research, it seems that creating a baseline script of my current database and then creating a new script for each schema change is the way to go. That way, any version of database can be updated to the newest version.
My question is how do I manage the permissions for these updates? Right now there's about 50 people using my application, most of which have read-only access. Ideally, I'd like any user to be able to perform the necessary changes such as creating or altering tables so that the first person to receive the new update will apply the new schema changes. If that doesn't happen, then he/she might not be able to use the application at all until someone with appropriate permissions updates the database.
I can see a problem occurring if every user can update the schema. What would prevent them from logging into the SQL Server Management Studio and causing issues like dropping tables, etc.?
Right now, this application is only deployed in once place, so it's easy for me to manage schema changes manually. But we do have plans to deploy to more areas and I'd for all this to be handled automatically.
You want to restrict users admin privileges, but at the same time you want them to perform admin activities... Bit of a "chicken and egg" problem :-)
Option 1: Use webapp
Convert your program to run as a web application.
Bit drastic, however, much simpler maintanence. Your users no longer need to install Python, centralized upgrades and a shared connection pool to the database.
This solves your database authentication problem. Users authenticate themselves to the web application, not the database.
I use liquibase to manage my database schemas. It has a servlet listener which can automatically upgrade the database when a new version of my app is deployed. (Liquibase also has a command-line interface for use by alternative technologies like Python).
Option 2: encrypt admin password
You encrypt the admin password and make it available as a text file retrievable from a corporate web server, enabling any users application to download it at startup.
There is a security issue with this solution.... In order to decrypt the admin password, a shared secret needs to be built into your python application.... This is security by obscurity.

Resources