Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b1610f7
feat(bigquery): support authorized views with dataset restrictions
Genesis929 Feb 25, 2026
fe8d967
merge origin/main into allowed_view_fix and resolve conflicts
Genesis929 Feb 25, 2026
0fba781
support authorized views and align util/tests with latest main archit…
Genesis929 Feb 25, 2026
74f4795
resolve linting errors and test failures
Genesis929 Feb 25, 2026
88f3248
Merge branch 'main' into allowed_view_fix
Genesis929 Feb 25, 2026
49d732d
Merge branch 'main' into allowed_view_fix
Genesis929 Feb 25, 2026
8de9da3
update
Genesis929 Feb 25, 2026
36c12ee
update
Genesis929 Feb 25, 2026
ffd1983
Merge branch 'main' into allowed_view_fix
Genesis929 Feb 26, 2026
12f6438
Merge branch 'main' into allowed_view_fix
Genesis929 Feb 26, 2026
bf29315
Merge branch 'main' into allowed_view_fix
Genesis929 Mar 2, 2026
0b44a51
Merge branch 'main' into allowed_view_fix
duwenxin99 Mar 24, 2026
3ae04c9
merge: origin/main into allowed_view_fix and resolve conflicts
Genesis929 Jun 1, 2026
3192c37
improve dataset restriction reporting and increase test timeout
Genesis929 Jun 2, 2026
ff44955
improve bigquery parser and optimize test cleanup
Genesis929 Jun 2, 2026
c1033af
fix cleanup race and parser bugs in bigquery integration
Genesis929 Jun 2, 2026
130b213
align BigQuery dataset restriction with main and improve system funct…
Genesis929 Jun 9, 2026
d6e799d
fix formatting in bigquerycommon utils
Genesis929 Jun 9, 2026
cd330c3
Merge branch 'main' into allowed_view_fix
Genesis929 Jun 9, 2026
c415b74
Merge branch 'main' into allowed_view_fix
Genesis929 Jun 10, 2026
681f966
Merge branch 'main' into allowed_view_fix
Genesis929 Jun 17, 2026
e757340
Merge branch 'origin/main' into allowed_view_fix and resolve conflicts
Genesis929 Jun 25, 2026
017409c
relocate CleanupBigQueryDatasets helper to bigquery integration tests
Genesis929 Jun 25, 2026
1b85448
remove redundant error wrappers from bigquerycommon utility
Genesis929 Jun 25, 2026
791d4a8
centralize and structure query validation errors in bigquery tools
Genesis929 Jun 25, 2026
0be4333
centralize and structure query validation errors in bigquery tools
Genesis929 Jun 25, 2026
cb5b67e
add unit tests for bigquery utility and validation functions
Genesis929 Jun 25, 2026
78f82b1
run gofmt and goimports to fix formatting and imports order
Genesis929 Jun 25, 2026
d4883ad
Merge branch 'main' into allowed_view_fix
Genesis929 Jun 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions docs/en/resources/tools/bigquery/bigquery-execute-sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ layer of security by controlling which datasets can be accessed:

- **Without `allowedDatasets` restriction:** The tool can execute any valid
GoogleSQL query.
- **With `allowedDatasets` restriction:** Before execution, the tool performs a
dry run to analyze the query.
It will reject the query if it attempts to access any table outside the
allowed `datasets` list. To enforce this restriction, the following operations
are also disallowed:
- **With `allowedDatasets` restriction:** The tool analyzes the query before execution to ensure that it only accesses the allowed datasets.
This check also supports authorized views by validating direct references against the allowed list.
To enforce this restriction, the following operations are also disallowed:

- **Dataset-level operations** (e.g., `CREATE SCHEMA`, `ALTER SCHEMA`).
- **Unanalyzable operations** where the accessed tables cannot be determined
statically (e.g., `EXECUTE IMMEDIATE`, `CREATE PROCEDURE`, `CALL`).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,24 +214,9 @@ func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, para
{Key: "session_id", Value: session.ID},
}
}
dryRunJob, err := bqutil.DryRunQuery(ctx, restService, source.BigQueryClient().Project(), source.BigQueryClient().Location, inputData, nil, connProps)
if err != nil {
return nil, fmt.Errorf("query validation failed: %w", err)
}
statementType := dryRunJob.Statistics.Query.StatementType
if statementType != "SELECT" {
return nil, fmt.Errorf("the 'input_data' parameter only supports a table ID or a SELECT query. The provided query has statement type '%s'", statementType)
}

queryStats := dryRunJob.Statistics.Query
if queryStats != nil {
for _, tableRef := range queryStats.ReferencedTables {
if !source.IsDatasetAllowed(tableRef.ProjectId, tableRef.DatasetId) {
return nil, fmt.Errorf("query in input_data accesses dataset '%s.%s', which is not in the allowed list", tableRef.ProjectId, tableRef.DatasetId)
}
}
} else {
return nil, fmt.Errorf("could not analyze query in input_data to validate against allowed datasets")
if _, err := bqutil.ValidateQueryAgainstAllowedDatasets(ctx, restService, source.BigQueryClient().Project(), source.BigQueryClient().Location, inputData, nil, connProps, source); err != nil {
return nil, err
}
Comment thread
Genesis929 marked this conversation as resolved.
Outdated
}
inputDataSource = fmt.Sprintf("(%s)", inputData)
Expand Down
Loading