Access control for contractors in test environments
Disabling a SQL Server login leaves its existing connections running. A PostgreSQL password can expire while another authentication method still admits the same role. Before a contractor starts testing, record each account, its permissions and its end date. Include a separate step for sessions that are already open when the work ends.
Record each route into the test stack
Start the access record with the work the contractor needs to do: use the application, inspect logs, query a database or change a server. Give each person a named account at the layers they need. Put an owner and an end date beside each account before issuing the credentials.
A VPN connection and a database login belong on separate rows. In a hypothetical test stack, the VPN lets a tester reach the database host, and the database checks its own credentials. Removing the VPN profile would leave the database credential intact. Whether that credential remains usable depends on the other network paths into that host.
Look for credentials the tester can read after signing in, including environment files, deployment scripts and shared secret stores. If a contractor can copy a usable service key, removing their personal account alone leaves that copied key available. Record the service identity beside the personal account and plan how to replace any shared credential the contractor could retain.
For AWS workforce access, AWS recommends federation with temporary credentials and multifactor authentication. Its IAM guidance also recommends temporary role credentials for workloads, least privilege, and removing unused credentials. Use those recommendations when deciding whether a tester needs a long lived key on the QA server.
Check what the expiry setting controls
An end date needs a precise meaning. Record the time zone and whether the setting limits an account, a password, a certificate or a session. The differences below come from the product documentation, and they affect how you write the removal procedure.
| System | Setting | What it controls |
|---|---|---|
| IAM Identity Center | Permission set session duration | AWS account sessions default to 1 hour. The allowed range is 1 to 12 hours. |
| OpenSSH certificates | The -V option when signing | Sets the certificate validity interval. An absolute time uses the system time zone; a trailing Z selects UTC. |
| PostgreSQL | Role VALID UNTIL | Expires the password. Other authentication methods ignore this time. |
| Active Directory | Set-ADAccountExpiration -DateTime | Sets account expiration. A date without a time means 12:00 AM local time. |
| SQL Server | ALTER LOGIN ... DISABLE | Disables the login while existing connections continue. The login retains its permissions. |
Suppose an invented test engagement ends at 18:00 UTC on November 13, 2026. Write that exact cutoff in the access record and translate it into each system's supported setting. For an OpenSSH certificate, the end of the validity interval would be 20261113180000Z. This date is an example, not a suggested lifetime for contractor access.
Inspect the resulting value after saving it, then test the cutoff with a disposable account before relying on the procedure. In Active Directory, entering only November 13 would select the start of that day in local time. Record an explicit time when the person must retain access through the afternoon.
PostgreSQL's VALID UNTIL is a password control. The manual explicitly says that authentication without a password ignores it. Inventory the authentication method along with the role, and test removal using the same method the contractor uses.
Handle active sessions separately
AWS distinguishes the IAM Identity Center sign in session from the IAM role sessions used to access AWS accounts. Existing role sessions can continue for their configured duration after the user is disabled or their account access is removed. A short session duration bounds that lifetime, but the contract's end date still needs an access removal action.
AWS's revocation procedure first adds the user ID to the prepared deny policy, then removes the user's permission set assignments. Its instructions include removing group memberships and direct assignments, ending the access portal session and disabling user access in the specified order. Follow the complete procedure and prepare its prerequisites in advance. AWS says to leave the deny policy in place for at least 12 hours, allowing existing role sessions to expire. Signing the user out of the access portal alone leaves those independent role sessions to expire.
SQL Server needs similar attention to existing connections. Microsoft's ALTER LOGIN reference says disabling a login leaves connected sessions unaffected. It also says a disabled login retains its permissions and can still be impersonated. A separate account that can impersonate it therefore belongs in the access review.
For a connection that must end, SQL Server provides KILL. Ending a session can require transaction rollback, and Microsoft documents KILL ... WITH STATUSONLY for checking rollback progress. Have the database owner identify the contractor's sessions and decide when to end them, especially if a test is writing data.
Test two things at the cutoff: a fresh sign in and an operation from a session opened earlier. Record both results. A rejected fresh login only proves that the new login was rejected; the earlier connection needs its own check.
Decide which test data contractors can read
Choose the database restore after deciding which records the contractor may read. If a QA copy contains customer records and the tester can query those records, the environment's name does not change what they can see. Document any approved access to customer data alongside the account permissions.
Prefer an invented dataset for tests that can use one. Include the states the contractor must exercise, such as an overdue invoice or a failed import, and keep real secrets out of the fixture. Invented names alone are insufficient if the same fixture carries customer messages, uploaded documents or a copied production token.
For a defect that depends on a production record, ask the application owner to identify the smallest set of fields needed to reproduce it. Review the resulting fixture before granting access. Record any approved customer data and the reason for using it, with a removal date for the test copy.
Keep evidence of the removal
Assign one owner to close the contractor's access record. That person should collect the results from the people who administer the VPN, cloud accounts, servers, application and database. Store each removal action beside its verification result, including any sessions or credentials that still need work.
| Record item | Evidence to keep |
|---|---|
| Account or assignment | The identifier, affected system, removal action and completion time. |
| Existing session | The session identifier and the result after termination or the documented expiry. |
| Reusable credential | The key or secret identifier and its revocation or replacement result. Keep secret values out of the record. |
| Verification | The fresh login result and the result from a previously open session, checked by the system owner. |
An AWS IAM credential report helps with the IAM user part of this inventory. It includes password and access key usage fields, but AWS documents limits: the report covers the first two access keys per user and omits service specific credentials. AWS points to ListAccessKeys and ListServiceSpecificCredentials for fuller credential visibility.
Treat that report as one input to the record. It cannot verify the removal of a local database login, an application account or a VPN profile. Close each of those rows with evidence from the system that owns it.
For the next engagement, reuse the account inventory and the checks that worked. Review access again if the contract is extended or the testing scope changes. Hand over the completed record with the end time and verification result for each account.
Sources
Product behavior in this guide was checked against these primary sources on November 11, 2026. The workflow recommendations describe a proposed process for your own environment.
- Security best practices for AWS IAM
- Session duration in IAM Identity Center
- Authentication sessions in IAM Identity Center
- Revoking IAM Identity Center access
- Certificate signing in OpenSSH
- PostgreSQL 18 CREATE ROLE
- Active Directory account expiration
- Disabling a SQL Server login
- Ending a SQL Server session
- Credential reports in AWS IAM