Skip to content

feat: grant query permissions from CDK - #91

Merged
hughgrigg merged 1 commit into
mainfrom
feat/grant-query-permissions
Aug 28, 2026
Merged

feat: grant query permissions from CDK#91
hughgrigg merged 1 commit into
mainfrom
feat/grant-query-permissions

Conversation

@hughgrigg

Copy link
Copy Markdown
Contributor

Downstream projects have been retyping a fourteen-action PolicyStatement out of the prose in docs/query-workgroup/, keeping whatever was true on the day they copied it. Two grants replace that with one line per identity. queries.grantQuerying(role, table) attaches everything one query touches, scoped to this deployment: Athena on the workgroup, Glue on the catalog, the database and the table, reads on the log bucket, and reads and writes on the results bucket. summaries.grantReadingSummaries(role) attaches the one s3:GetObject the summary path sends. Either call hands out kms:Decrypt for a bucket kept under a customer key. The statements sit beside the ones the scheduled job already held, so one definition now covers both callers, which gained the results bucket (the job was taking that through Bucket.grantReadWrite, and so loses the s3:DeleteObject it never sent) and the two named-query actions rainlytics saved-query needs. docs/query-workgroup/ now opens its permissions section with the four actions ReadOnlyAccess denies, measured on 2026-08-28 with aws iam simulate-principal-policy against an AWSReservedSSO_ReadOnly role, with the written-out policy below it for an identity built outside CDK. SummariesBucket gains bucketArn and encryptionKey, which IBucket and Bucket both still satisfy.

No new AWS service, so nothing changes about the pricing shape. IAM carries no charge.

Resolves #83

  • Conventional commit message, used as the title

  • Conventional branch name, like feat/concise-description

  • Full check with pnpm run check passed

  • Rebased off latest main

  • User-facing behaviour is documented in docs/

A downstream project retyped a fourteen-action PolicyStatement out of
docs/query-workgroup/, and kept whatever was true on the day it copied.
Two grants replace that with one line per identity.

    queries.grantQuerying(role, table);
    summaries.grantReadingSummaries(role);

grantQuerying attaches everything one query touches, scoped to this
deployment. Athena on the workgroup, Glue on the catalog, the database
and the table, reads on the log bucket, and reads and writes on the
results bucket. grantReadingSummaries attaches the one GetObject the
summary path sends. Either call hands out kms:Decrypt for a bucket kept
under a customer key.

The statements live beside the ones the scheduled job already held, so
one definition now covers both callers. That gained the results bucket,
which the job was taking through Bucket.grantReadWrite, and the job
therefore loses the s3:DeleteObject it never sent. It gained the two
named-query actions rainlytics saved-query needs as well, kept apart
from the job, which is handed its SQL at deploy time.

docs/query-workgroup/ now opens its permissions section with the four
actions ReadOnlyAccess denies, measured on 2026-08-28 with
aws iam simulate-principal-policy against an AWSReservedSSO_ReadOnly
role. The written-out policy stays below, for an identity built outside
CDK, and gains athena:GetWorkGroup and the two named-query actions.

SummariesBucket gains bucketArn and encryptionKey. IBucket and Bucket
both still satisfy it, and a consumer assembling one by hand has two
more fields to supply.

Closes #83
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 53 minutes.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 88 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 017721e0-ebef-4b65-838d-a02005103f68

📥 Commits

Reviewing files that changed from the base of the PR and between 55ebd47 and e74368e.

📒 Files selected for processing (12)
  • docs/query-workgroup/README.md
  • docs/summaries/README.md
  • src/cdk/index.ts
  • src/cdk/query-results-bucket.ts
  • src/cdk/query-workgroup.test.ts
  • src/cdk/query-workgroup.ts
  • src/cdk/rollup-summaries.test.ts
  • src/cdk/rollup-summaries.ts
  • src/cdk/summary-bucket.ts
  • src/cdk/summary-function.ts
  • src/cdk/summary-permissions.test.ts
  • src/cdk/summary-permissions.ts

Comment @coderabbitai help to get the list of available commands.

@hughgrigg
hughgrigg merged commit aaffdc6 into main Aug 28, 2026
7 checks passed
@hughgrigg
hughgrigg deleted the feat/grant-query-permissions branch August 28, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Grant query permissions from CDK, and document the ReadOnlyAccess delta

1 participant