Verify SDK access and revoke a read-only integration
Verify SDK access and revoke a read-only integration
Loading video…
What you will accomplish
After choosing an automation identity, verify it before building a workflow. This lesson checks JavaScript and Python SDK identity, follows inventory pagination, confirms a viewer permission boundary, and verifies that revocation actually stops access. It follows account setup and precedes scan automation or CI integration.
The workspace interface and API responses are real. Terminal output comes from real Windows ConPTY processes running the current SDKs. A dedicated viewer credential, Node and Python runtimes, and reviewed example files were prepared before recording. No cloud provider is mocked or contacted, and no scan is started.
The Administrator reference console is a training helper, not a built-in QScan screen. Its button sends the actual administrator-authorized credential revocation request. It can revoke only this demonstration credential. The viewer SDK cannot perform that operation.
Before you begin
- Download and verify the signed SDK bundle from Integrations. Retain its release manifest and keep the extracted SDK directory structure intact.
- Use Node.js 22 or newer for JavaScript, or Python 3.12 or newer for this Python example. The SDK identity examples do not require a database driver.
- Ask a workspace administrator for a dedicated viewer API credential. Do not reuse an administrator token or an agent enrollment token.
- Inject
QSCAN_ENDPOINTandQSCAN_TOKENinto the process environment through your approved secret manager. The endpoint ishttps://qscan.dev. Never paste the token into source, screenshots, command arguments or a shared shell transcript. - Keep an administrator available to revoke this specific credential after the check. Record its identifier separately from the secret.
Verify the workspace before reading inventory
Open Integrations ? JavaScript SDK ? Open setup guide. Read the environment and identity examples. Save the examples from the SDK setup guide beside the extracted SDK bundle, preserving the documented import paths. The filmed files are maintained repository examples; their relative paths are not portable commands for an arbitrary download folder.
Run the JavaScript identity example, then the Python equivalent. Both must report the intended organization and viewer role. Stop if they differ. A successful workspace identity request does not validate an AWS, Azure, Google, repository or database connection.
The recording executes verify-workspace.mjs identity and verify_workspace.py from the maintained training directory. Both call the actual SDK me() method and print only the organization name and role. No credential or user profile is printed.
Traverse the inventory and preserve missing evidence
Call the assets endpoint with a bounded page size, process items, then pass the returned nextCursor as after. Continue until there is no cursor. Do not mistake the first page for the entire inventory. The filmed workspace returned four pages and 197 assets; your totals will differ.
The demonstration uses a 2,000-asset safety bound for this isolated workspace. A production inventory job needs an explicit resumable traversal policy appropriate to its size, not that arbitrary training bound. Preserve cursors and operation identity on retry. Concurrent inventory changes can require a fresh traversal.
Missing or unknown algorithm values stay unknown. The count of such assets is an evidence gap, not a count of safe assets and not a numerical risk score.
Check the role boundary
Using the same viewer SDK client, request GET /api/v1/credentials. Expect HTTP 403 because credential administration requires an administrator. This is an intentional read-only denial check; it does not create, modify or revoke credentials.
Do not quietly replace the viewer token with an administrator token to make this test pass. If access is unexpectedly granted, stop and investigate the identity and role configuration.
Revoke and verify the outcome
- Have the administrator identify the dedicated test credential by its ID.
- Send the documented
DELETE /api/v1/credentials/{id}request with administrator authorization. The reference console in the video performs this real request without exposing the administrator session. - Inspect the successful response and
revoked: trueresult. - Repeat the SDK identity request with the same revoked viewer token. Expect HTTP 401.
- Remove the revoked token from the process environment and secret manager. If ongoing access is needed, provision replacement access deliberately and repeat identity verification.
The recording revokes its temporary credential and closes every console process and the local reference server, including on failure. It does not revoke another user's credentials or alter any scan configuration.
Recover from common problems
- Missing environment variable: configure the environment of the process actually running the example, then restart that process. Do not print the token to debug it.
- Import not found: verify the bundle and preserve its SDK folders. Use the correct relative import for the file's location; the repository training paths differ from extracted-bundle paths.
- Unexpected workspace or role: stop before reading or modifying data. Obtain the correct scoped credential.
- 401 before revocation: inspect expiry, revocation and credential type through the administrator workflow. Never silently try another account.
- 403: check the operation's required role. The credential-list denial in this lesson is expected.
- 429 or timeout: respect retry guidance and preserve cursors and request identity. Do not restart a mutation blindly after an uncertain response.
- Revoked credential still succeeds: verify that the client reused the same token and endpoint, rather than a cached replacement. Treat unexpected continued access as a defect.
What you completed
You established a read-only integration identity, verified both SDKs, read the complete paginated inventory, checked the permission boundary, and confirmed revocation. Continue with an explicitly authorized scan, CI or assistant workflow; this identity exercise does not claim those integrations have been configured.
Narration transcript
Let's verify a read-only SDK connection. We'll check identity in JavaScript and Python, read inventory, test a permission boundary, and revoke access. A dedicated viewer credential and the reviewed SDK files are already prepared.
Start in Integrations and open the JavaScript setup. The endpoint identifies your workspace service; the token authorizes access. Inject it into the process environment or secret manager. Never paste it into source code or a recording.
Run the JavaScript identity check. Confirm the workspace name and viewer role before doing anything else. If either is wrong, stop and correct the credential. A successful identity check doesn't prove a cloud provider is connected.
Now run the same identity check with Python. Both clients should identify the same workspace and role. These examples use the actual SDKs and API. No access token is printed, and neither check starts a scan.
Read the inventory in pages. Follow the returned cursor until there isn't another page, then report the total. A first page is not the whole inventory. Keep missing algorithms unknown instead of treating them as zero risk.
Try the administrator-only credential list with this viewer client. The expected result is forbidden. That's the permission boundary working. Don't quietly replace the token with an administrator credential just to make the request succeed.
The administrator now revokes this dedicated credential through the workspace API. This reference console shows the real response. Revocation belongs to the administrator; the read-only SDK client cannot grant itself that authority.
Repeat the identity request with the same revoked credential. Unauthorized is the expected outcome now. Don't retry with a cached token or silently switch accounts. Provision replacement access deliberately if the integration still needs it.
You've verified both SDKs, read a paginated inventory, checked the viewer boundary, and confirmed revocation. Build additional automation from that foundation, preserving unknown evidence, explicit permissions, and the identity of each requested operation.