Skip to content
tempkey ← Back to blog

Tempkey Blog

Who Still Has the Pub/Sub Keys? Managing Contractor Access to Event Streams

Learn how to give freelancers and agencies only the Pub/Sub topics and subscriptions they need, put an end date on that access, and prove it was removed when the engagement closes.

To safely manage contractor access to Google Cloud Pub/Sub, you must bind identity roles to individual topics or subscriptions instead of granting project-wide permissions. This approach confines an external engineer to the exact message stream they need, automates expiry, and prevents retained payloads from leaking after an engagement ends.

When engineering teams bring in freelancers to wire up event ingestion, build analytics pipelines, or debug message consumers, the easiest path often feels like adding the user to the Google Cloud project console as an editor. Doing that opens your entire messaging bus. Understanding how to manage contractor access to google cloud pub/sub requires balancing operational speed with defensive boundary setting. Granular access prevents leaks. By isolating message streams, implementing strict time limits, and verifying removal, operations leads can maintain reliable control over sensitive production pipelines.

Start with the blast radius: what a contractor can do inside Pub/Sub

Google Cloud Pub/Sub decouples services that produce events from services that process them. Outside contractors typically need to do one of three things: publish payload events to an ingestion topic, pull messages from a specific subscription to test an ingestion worker, or inspect schemas to format records correctly. Each task requires specific roles. Each of these activities demands completely distinct google cloud pub/sub permissions.

Granting broad roles exposes sensitive organizational data. Google Cloud provides several predefined roles for Pub/Sub, but their default scopes vary dramatically:

  • roles/pubsub.publisher: Allows an identity to publish messages to topics via pubsub.topics.publish.
  • roles/pubsub.subscriber: Allows an identity to consume and acknowledge messages via pubsub.subscriptions.consume.
  • roles/pubsub.viewer: Grants read-only access to topic and subscription configurations, message metrics, and schemas without message-payload consumption.
  • roles/pubsub.editor: Allows creating, altering, and deleting arbitrary topics and subscriptions across the resource hierarchy.

The roles/pubsub.editor role is almost often too broad for an external freelancer. If you assign it at the project level, that user can delete existing subscriptions, detach snapshots, or reconfigure ingest pipelines used by other production microservices.

Pub/Sub permissions are inherited down the Google Cloud resource hierarchy. When you assign a contractor a role at the project level, that binding applies to every topic and subscription in that project. A freelancer hired to debug an e-commerce webhook stream gains read access to customer billing topics, user registration streams, and internal audit buses.

Beyond structural changes, granting open subscriber permissions introduces subtle secondary risks. Subscribers can rewind subscriptions using snapshots to replay days of historical event data. If your systems deliver sensitive customer data into messages, an external party can inspect payloads long after real-time processing has finished.

Furthermore, misconfigured error handling frequently routes failed messages to secondary endpoints. According to Google Cloud documentation on dead-letter topics, unacknowledged events land in separate dead-letter queues after repeated delivery attempts. If an external developer has access to an ingestion topic but dead-letter payloads route to an open bucket or secondary topic, message payloads bypass your intended boundaries.

Contractor Task Minimum IAM Role Resource Scope
Push sample telemetry or events roles/pubsub.publisher Individual Topic
Debug consumer processing workers roles/pubsub.subscriber Individual Subscription
Validate Protobuf or Avro schemas roles/pubsub.viewer Individual Schema or Topic
Build new worker infrastructure roles/pubsub.editor Isolated Staging Project

Grant access to one topic, not the whole project

The safest operational pattern is scoping IAM policy bindings directly to the target topic or subscription. Resource-level IAM bindings keep external users restricted to their assigned areas while keeping them out of unrelated message streams and project-level settings. Keep the scope tight.

You can grant targeted publisher access using the Google Cloud console or the command line. To assign permissions on an individual topic using the gcloud CLI tool, bind the publisher role directly to the resource URI:

gcloud pubsub topics add-iam-policy-binding projects/acme-prod-123/topics/order-events \
    --member="user:freelancer@externalagency.com" \
    --role="roles/pubsub.publisher"

If the contractor needs to pull messages to verify event receipt, create a dedicated subscription for their work and grant access only to that subscription:

gcloud pubsub subscriptions add-iam-policy-binding projects/acme-prod-123/subscriptions/order-events-dev-sub \
    --member="user:freelancer@externalagency.com" \
    --role="roles/pubsub.subscriber"

For automated processing or server-side scripts, avoid binding personal Google accounts to production services. Instead, create a dedicated service account specifically for that contractor's engagement. Learn more about scoping these identities in our guide on managing contractor access to Google Cloud IAM service accounts. Once their contract ends, disabling that single service account removes their downstream access without requiring you to audit complex project-level user lists.

Google Cloud IAM also supports conditional bindings. You can use native IAM conditions such as request.time to configure access that automatically stops working after a calendar deadline. For teams learning how to manage contractor access with Google Cloud IAM conditions, conditional bindings look like this:

gcloud pubsub topics add-iam-policy-binding projects/acme-prod-123/topics/order-events \
    --member="user:freelancer@externalagency.com" \
    --role="roles/pubsub.publisher" \
    --condition='title=expires_end_of_month,expression=request.time < timestamp("2026-11-30T00:00:00Z")'

While native conditions evaluate accurately, managing them at scale can be difficult. Google Cloud does not provide a single dashboard showing every expiring resource condition across all projects. Conditional bindings remain visible on the resource policy, meaning teams must inspect every topic, bucket, and subscription individually to verify which conditional grants are still active.

Whenever you grant access, log the core parameters in your internal records: the identity granted, the specific topic or subscription path, the exact role applied, the planned end date, and the originating ticket link.

Put an end date on the grant before the work starts

Avoid open-ended arrangements for contractor access. Include an explicit access termination date directly inside the work order and the internal tracking ticket. Stating an offboarding date up front ensures that external developers and internal project owners agree on when credentials will be revoked. Deadlines protect production systems.

Operations teams usually pick between three native approaches for time-boxing access:

  1. IAM conditions with request.time timestamps configured directly on the resource.
  2. Short-lived federated credentials using external identity pools. According to Google Cloud Workload Identity Federation documentation, external platforms can exchange short-lived tokens for Google Cloud credentials without needing permanent service account keys.
  3. Calendar alerts reminding administrators to remove permissions by hand.

Native configuration choices come with practical tradeoffs. While request.time conditions prevent message publishing after the set timestamp, the IAM binding remains attached to the resource policy. It still appears in IAM review exports as an active line item. Furthermore, nobody on your operations team receives an alert when the time-box expires, and Google Cloud does not notify you that the contractor has completed their work.

Tempkey handles this operational pattern systematically. Tempkey grants contractor access for a set period, revokes it automatically when the grant expires, reads provider state back to confirm the removal on natively enforced providers, and records each step in an exportable audit trail. This prevents forgotten accounts from lingering indefinitely across internal tools.

To establish clear accountability with external developers, include a short access control clause in your standard statement of work:

"Access to company message buses, Pub/Sub topics, and related development infrastructure is granted exclusively for the duration of the engagement milestones specified in this document. All credentials and permissions expire on the agreed completion date. The contractor agrees not to extract, retain, or store event payloads locally outside approved corporate environments."

Verify the removal instead of assuming it

Revoking an access grant is only half the task. You must confirm that permissions are gone at the provider level. Assuming a user no longer has access because an offboarding ticket was closed can leave systems exposed. Verify every change.

To verify that permissions have been completely revoked from an individual Pub/Sub topic, run an explicit policy inspection via the command line:

gcloud pubsub topics get-iam-policy projects/acme-prod-123/topics/order-events \
    --format="json"

Review the JSON output and confirm that the contractor's identity string or dedicated service account is completely absent from the bindings array. Repeat this inspection for any dedicated subscriptions created during the project:

gcloud pubsub subscriptions get-iam-policy projects/acme-prod-123/subscriptions/order-events-dev-sub \
    --format="json"

Removing an identity from an individual topic does not guarantee that the contractor has lost access to the message stream. A contractor may still retain permissions through several hidden avenues:

  • Inherited project roles: If an administrator inadvertently added the user as a project viewer or editor, that role overrides resource-level policy removals.
  • Google Group inheritance: If access was granted to an internal distribution list or technical group, the contractor keeps downstream access until they are removed from the underlying group.
  • Service account keys: If the contractor downloaded an authorized JSON key file for a service account, that key remains valid everywhere until disabled or deleted.

If a service account was configured for the contractor, do not merely disable its access bindings. Rotate any active keys and delete the service account entirely. Leaving unused, disabled service accounts in your Google Cloud environment clutters policy reviews and complicates routine audits.

Automated revocation depends on third-party provider APIs. Tempkey executes revocation and reads provider state back to confirm it. Because revocation depends on third-party provider APIs, Tempkey does not guarantee removal within any specific time and surfaces failed or unenforceable revokes in the audit log.

Follow this checklist when offboarding an external developer from event-driven workloads:

  1. Inspect the topic IAM policy to confirm the identity binding is absent.
  2. Inspect the subscription IAM policy to verify consumer roles are cleared.
  3. Verify that no orphaned test subscriptions remain active on the topic.
  4. Delete or revoke contractor-specific service account key pairs.
  5. Audit project-level IAM bindings to ensure no broad inherited permissions remain.

Keep a record you can hand to an auditor or a client

Securing event streams for freelancers requires maintaining clear documentation. When an enterprise client or external compliance reviewer asks who had access to production event streams during an integration, an unorganized list of completed tickets is rarely sufficient. Records must be clear.

A complete access record must capture six specific data points:

  • Identity: The precise email address or service account principal.
  • Resource target: The exact topic or subscription URI.
  • Assigned role: The minimum IAM role granted for the work.
  • Approver: The internal team member who authorized the access request.
  • Duration: The exact timestamp the grant became active and when it expired.
  • Verification outcome: The post-revocation confirmation showing permissions were validated as removed.

Google Cloud logs resource modifications through Cloud Audit Logs. Admin Activity logs capture administrative events, such as adding or removing IAM policy bindings on topics, and are retained for 400 days at no cost. However, Data Access audit logs, which record when individual messages are published or consumed via API calls, are disabled by default due to high event volumes.

If your compliance procedures require inspecting every message access event, you must turn on Data Access logging manually in your Google Cloud IAM settings. Because standard log retention is limited, organizations often route their activity streams to long-term storage. According to Google Cloud log routing documentation, you can configure log sinks to export audit logs to Cloud Storage buckets or BigQuery datasets for extended retention and detailed analysis.

For operations managers seeking simpler tracking without managing cloud log sinks, dedicated access tools streamline record keeping. Tempkey keeps an append-only audit trail you can export to CSV or PDF. Plans are month-to-month across Free, Team, and Business tiers with active-grant limits of 2, 10, and 30. Business includes extended audit-history retention. Tempkey gives you an exportable, append-only audit trail to support your own compliance and offboarding records. Tempkey does not hold SOC 2, ISO 27001, HIPAA, or PCI certification.

Where contractor access usually leaks

Even structured engineering teams occasionally leave permissions open after an engagement finishes. Securing event-driven systems requires understanding where orphaned access tends to hide. Keys often get overlooked.

The most common vulnerability involves persistent service account keys. An external engineer requests a service account key to test an ingestion script locally. The administrator generates a JSON key, sends it via a private chat, and closes the ticket. That key remains valid indefinitely unless an administrator actively deletes it from the console.

Another common leakage path occurs through Google Groups. If an agency worker is added to an internal group like engineers@company.com, they inherit every project role and topic binding assigned to that group. When the engagement ends, the team might remove their standalone Google Cloud account while leaving their external address active inside the Google Workspace group.

Development and staging projects also create security blind spots. Teams often mirror production permissions into staging environments so freelancers can build without friction. However, staging environments frequently process real customer records, sanitized database backups, or webhook events. Teams diligently clean up production access while leaving staging Pub/Sub permissions intact for months.

Finally, forgotten test subscriptions present a quiet data exposure risk. A contractor debugging a topic often creates a custom subscription (such as debug-events-test) using the gcloud CLI. If that subscription is not deleted when their contract ends, it continues to pull and store messages up to your message retention limit, creating a cache of sensitive payloads accessible to anyone with basic project viewing rights.

Before closing out a contractor engagement, run this quick pre-offboarding sweep:

  1. Audit and delete service account keys generated during the engagement.
  2. Remove the contractor's address from all internal Google Groups and distribution lists.
  3. Purge temporary or debugging subscriptions created on target topics.
  4. Review non-production environments to confirm permissions were cleared across staging projects.

Fit Pub/Sub into the rest of the offboarding

A contractor hired to wire up a message queue rarely touches Pub/Sub in isolation. Usually, they also need access to upstream data warehouses, cloud infrastructure, or code repositories. A freelancer building an event consumer frequently requires permissions in Google Cloud BigQuery to inspect downstream tables. For detailed guidance on securing warehouse tables, read our walkthrough on how to manage contractor access to Google Cloud BigQuery.

Relying on disconnected offboarding checklists across multiple systems creates administrative overhead. If an ops manager must remember to revoke GitHub access, remove a Slack guest account, and delete a Google Cloud IAM binding on three separate calendars, omissions inevitably occur. A centralized management strategy establishes a single grant record that tracks all external access across your toolchain. Centralized tracking saves time.

When selecting tools to coordinate contractor offboarding, review native enforcement capabilities carefully. Tempkey natively enforces access on 10 providers: Slack, Google Workspace, Microsoft 365, GitHub, GitLab, Zoom, AWS IAM, Figma, Dropbox, and Asana. Notion and Trello are limited-native (tracked, not fully enforced) and Zapier/Make are best-effort webhook bridges without automated verification. Automatic Slack deactivation uses Slack's SCIM API, which Slack offers on its Business+ and Enterprise plans. On other Slack plans, Tempkey verifies that access was removed rather than removing it.

Because Google Cloud Pub/Sub is managed through Google Cloud IAM, the practical operational workflow pairs short-lived Google Cloud grants with unified lifecycle tracking. Managing access durations centrally ensures external contractors lose access to your event buses, source code, and shared folders simultaneously.

When organizing cross-tool offboarding, sequence your revocations starting with the highest-risk systems:

  1. Data pipelines and message brokers (Pub/Sub, BigQuery, AWS IAM).
  2. Source code repositories and deployment pipelines (GitHub, GitLab).
  3. Internal communications and knowledge bases (Slack, Google Workspace, Notion).

A repeatable process for the next contractor

Standardizing contractor lifecycle management replaces haphazard offboarding with a reliable, predictable routine. Follow this repeatable operational framework whenever bringing on external engineering help:

  1. Scope precisely: Identify the exact topic or subscription required. Assign resource-level bindings instead of project-wide roles whenever Google Cloud supports them.
  2. Grant access: Apply the lowest functional role to an isolated service account or user identity, avoiding inherited group policies.
  3. Record details: Log the identity, assigned resource paths, internal approver, and agreed project conclusion date.
  4. Conduct a midpoint review: For engagements lasting longer than 30 days, run a midpoint check. Assess whether the contractor still needs access to the original topics or if scope creep has expanded their permissions.
  5. Revoke promptly: Remove IAM bindings and delete associated service account keys the moment the contract ends.
  6. Verify removal: Query the resource IAM policy directly to confirm the identity no longer appears on any policy binding.
  7. Export logs: Export the grant record and verification receipt to your compliance archive for future client audits.

Frequently asked questions

Which permissions control access to Google Cloud Pub/Sub?

Google Cloud Pub/Sub access is governed by IAM roles that define specific actions on topics, subscriptions, snapshots, and schemas. Key permissions include pubsub.topics.publish for pushing events, pubsub.subscriptions.consume for receiving messages, and pubsub.topics.get for viewing configuration details. These permissions are grouped into predefined roles like roles/pubsub.publisher, roles/pubsub.subscriber, and roles/pubsub.viewer.

What is the minimum Pub/Sub role a contractor needs to publish messages?

The minimum role required to push events to a stream is roles/pubsub.publisher. Apply this role directly to the specific topic resource instead of the entire project. For detailed permission breakdowns, review the role decision table in the opening section of this guide.

Can I set an automatic expiry on a Google Cloud IAM binding?

Yes. Google Cloud IAM supports conditional policy bindings using the request.time attribute. By adding an IAM condition to a policy binding, you can configure permissions to stop working after a specified date and timestamp. Note that the binding remains attached to the resource policy until manually removed, and administrators do not receive native expiration alerts.

Does removing a user from a Google group remove their Pub/Sub access?

Removing a user from a Google Group will remove any Pub/Sub permissions that were inherited exclusively through that group. However, if the user was also assigned direct IAM roles on the topic, retains access through another group, or possesses an active service account key, they will continue to access the resource. often inspect the effective IAM policy on the resource to ensure access is fully terminated.

How long does Google Cloud keep audit logs for Pub/Sub by default?

Google Cloud retains Admin Activity audit logs for 400 days at no extra charge. Data Access audit logs, which record individual message publishing and consumption calls, are disabled by default. If enabled, Data Access logs are kept for 30 days unless you set up a log sink to export them to Google Cloud Storage or BigQuery for long-term retention.

Run the free contractor access audit at tempkey.io/contractor-access-audit to score whether your Pub/Sub and other cloud grants actually end when the engagement does. A time-boxed grant with read-back verification and an exportable audit trail closes that gap.