You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Affiliation Options for Sandbox API users : Ongoing Discussion Ticket #26378
There are challenges around how affiliations for API users will work compared to UI users. The main question is how to complete business affiliations using API to enable users in API sandbox to test and continue with their development.
Methods Discussed
Passcodes/Passwords: Used to authorize users, but not all businesses have one set up.
Access Codes: Issued for AR (Annual Report) filings but not tied to full business management. A new access code is generated every year for the AR filing.
Magic Links (Email-Based): Automated links sent to business emails for authorizing affiliation. It’s short-lived and lasts for 15-20 mins (to be confirmed)
Proposed Solutions
Passcode-Based Affiliation (Preferred Option):
Use existing Passcode or Corporate Password for affiliation.
If a passcode is missing, migrate the Access Code into the Passcode field.
Magic Link Automation (More Complex)
Automate email parsing to extract the magic link.
Risk: because anyone can request affiliation invitations.
Delegation Model
Allow business owners to approve third-party access via UI.
Not suitable for API users without manual steps.
Agreement
Perform testing in the sandbox for the following scenarios:
Affiliation using Passcodes
Challenges
As we started to look into testing in Sandbox, it was discovered, that in order to do the testing/validate the API affiliation scenario in Sandbox we are calling the auth api in prod.
On checking with Travis it was validated that they have a sandbox version ready to go but needs work/alignment on things like data sync from prod to sandbox.
Next Steps
Data sync for both Auth and Business Registry sandbox environments.
changed the title [-]Affiliation Options for API users : Ongoing Discussion Ticket[/-][+]Affiliation Options for Sandbox API users : Ongoing Discussion Ticket[/+]on Mar 10, 2025
recently i helped with moving a copy of lear db from openshfit to a "non-prod" lear db instance in gcp production environment. which database should this new 'sandbox' database mirror: 1. the 'non-prod' copy of lear db currently running in gcp prod 2. lear db in openshift prod 3. or some other database (e.g. the actual prod db that will be eventually running in gcp). i will have more questions depending on your answer
@argush3 To get data obfuscated, you'd need to provide a masking file and have anon extension installed in the db, here is an example: https://github.com/bcgov/sbc-auth/blob/main/jobs/gcp-db-data-masking/sql/mask.sql To establish these rules, you can either provide a list of columns you need to mask (then, i would create the mask.sql from the list), or make a mask.sql file yourself, or try managing masking rule via alembic, e.g. https://github.com/bcgov/STRR/pull/559/files (have not tried yet, but potentially this is the preferred way of doing it). If you provide an sql script with anything else you'd like to run (i.e. bumping sequences), that could be run as well. Potentially all these scripts would need to be stored in the lear repo. Just to be clear the process of syncing would be a a dump/restore (i.e. gcp export/import) On a side note lear db is running Postgres 12 which will be charged for extended support starting May 1, 2025. Not sure how long the plan is to keep running prod db in OpenShift for.
@argush3 lear-db-sandbox instance has been created. It currently has a copy of prod masked data.
The data is refreshed via lear-db-ocp-sync job that uses another auxiliary copy of lear db running in gcp prod environment. Not sure how often you want to refresh entire db, as that would wipe out any data created by users interacting with sandbox environment. Thor mentioned that there is potentially a need to do partial data reloads from prod. If that is the case could we get some clarification about which tables/columns need to be reloaded.
Activity
[-]Affiliation processes for API users[/-][+]Affiliation Options for API users[/+][-]Affiliation Options for API users[/-][+]Affiliation Options for API users : Ongoing Discussion Ticket[/+][-]Affiliation Options for API users : Ongoing Discussion Ticket[/-][+]Affiliation Options for Sandbox API users : Ongoing Discussion Ticket[/+]bolyachevets commentedon Mar 10, 2025
recently i helped with moving a copy of lear db from openshfit to a "non-prod" lear db instance in gcp production environment. which database should this new 'sandbox' database mirror: 1. the 'non-prod' copy of lear db currently running in gcp prod 2. lear db in openshift prod 3. or some other database (e.g. the actual prod db that will be eventually running in gcp). i will have more questions depending on your answer
bolyachevets commentedon Mar 11, 2025
also, i hope that daily syncing frequency is sufficient for your purposes
argush3 commentedon Mar 11, 2025
@bolyachevets the OCP LEAR prod database should be the database we should be mirroring for sandbox. Once a day is good to start off with I think.
Some other things we need to talk about:
bolyachevets commentedon Mar 11, 2025
@argush3 To get data obfuscated, you'd need to provide a masking file and have anon extension installed in the db, here is an example: https://github.com/bcgov/sbc-auth/blob/main/jobs/gcp-db-data-masking/sql/mask.sql To establish these rules, you can either provide a list of columns you need to mask (then, i would create the mask.sql from the list), or make a mask.sql file yourself, or try managing masking rule via alembic, e.g. https://github.com/bcgov/STRR/pull/559/files (have not tried yet, but potentially this is the preferred way of doing it). If you provide an sql script with anything else you'd like to run (i.e. bumping sequences), that could be run as well. Potentially all these scripts would need to be stored in the lear repo. Just to be clear the process of syncing would be a a dump/restore (i.e. gcp export/import) On a side note lear db is running Postgres 12 which will be charged for extended support starting May 1, 2025. Not sure how long the plan is to keep running prod db in OpenShift for.
bolyachevets commentedon Mar 11, 2025
N.B. don't run 'SELECT anon.anonymize_database();' against prod db, as it will permanently modify the data
bolyachevets commentedon Mar 13, 2025
@argush3 lear-db-sandbox instance has been created. It currently has a copy of prod masked data.
The data is refreshed via lear-db-ocp-sync job that uses another auxiliary copy of lear db running in gcp prod environment. Not sure how often you want to refresh entire db, as that would wipe out any data created by users interacting with sandbox environment. Thor mentioned that there is potentially a need to do partial data reloads from prod. If that is the case could we get some clarification about which tables/columns need to be reloaded.
vikas-gov commentedon Mar 13, 2025
@bolyachevets as discussed, lets have it on-demand for now. Will check with Thor on the scope of delta reloads.