Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
54fb1b1
Honor field permissions when reading table schema
joymaxnascimento Sep 4, 2026
c330065
Add MSSQL fixture and test for column excluded by field permissions
joymaxnascimento Sep 5, 2026
0d13303
Match column names case-insensitively when resolving field permissions
joymaxnascimento Sep 5, 2026
9b7d458
Only narrow the schema projection when the primary key is configured
joymaxnascimento Sep 5, 2026
7a82fa7
Skip columns whose data type the provider cannot map, instead of hono…
joymaxnascimento Sep 5, 2026
0df9ee4
Reject unsupported primary keys and read the catalog once per object
joymaxnascimento Sep 11, 2026
3207712
Resolve the schema projection before opening the connection and disam…
joymaxnascimento Sep 11, 2026
60ffd4c
Add MSSQL test for an object whose every column has an unsupported da…
joymaxnascimento Sep 11, 2026
5d65bda
Compare cached object names ordinally and cover the primary key guard
joymaxnascimento Sep 11, 2026
9b47156
Keep the narrowed projection authoritative and reject stale configure…
joymaxnascimento Sep 15, 2026
fc0e094
Correct identifier delimiting, identity typing and key inference on t…
joymaxnascimento Sep 15, 2026
f4eacf6
Reject database policies over skipped columns and cover identity meta…
joymaxnascimento Sep 15, 2026
7584b52
Infer view keys from the base object catalog
joymaxnascimento Sep 21, 2026
c07df8e
Report an unreachable view key only when no key is in effect
joymaxnascimento Sep 22, 2026
79865db
Decline view key inference for a self-join and check relationship fields
joymaxnascimento Sep 22, 2026
fd33285
Exclude hypothetical indexes from unique key candidates
joymaxnascimento Sep 22, 2026
90f3bbb
Merge main into fix/schema-discovery-honors-field-permissions
aaronburtle Nov 12, 2026
997d3f6
Skip columns the data provider can't read during schema discovery
aaronburtle Nov 12, 2026
05fcc1f
Rework tests for columns with unsupported data types
aaronburtle Nov 12, 2026
e54f1d7
Merge main into fix/schema-discovery-honors-field-permissions
aaronburtle Nov 13, 2026
e8cf928
Merge branch 'main' into fix/schema-discovery-honors-field-permissions
aaronburtle Nov 13, 2026
219287a
Merge branch 'main' into fix/schema-discovery-honors-field-permissions
aaronburtle Nov 13, 2026
46d3863
Generate autoentities for tables with skipped columns and extend test…
aaronburtle Nov 13, 2026
4ca3d5b
Merge branch 'main' into fix/schema-discovery-honors-field-permissions
aaronburtle Nov 13, 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
2 changes: 2 additions & 0 deletions config-generators/mssql-commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ add VectorType --config "dab-config.MsSql.json" --source vector_type_table --res
update VectorType --config "dab-config.MsSql.json" --permissions "authenticated:create,read,delete,update"
update VectorOwner --config "dab-config.MsSql.json" --relationship vectors --target.entity VectorType --cardinality many --relationship.fields "id:owner_id"
update VectorType --config "dab-config.MsSql.json" --relationship owner --target.entity VectorOwner --cardinality one --relationship.fields "owner_id:id"
add GeometryType --config "dab-config.MsSql.json" --source geometry_type_table --rest true --graphql true --permissions "anonymous:read"
add TemporalGeometryType --config "dab-config.MsSql.json" --source temporal_geometry_type_table --rest true --graphql true --permissions "anonymous:create,read,update"
add Profile --config "dab-config.MsSql.json" --source profiles --rest true --graphql true --permissions "anonymous:create,read,delete,update"
update Profile --config "dab-config.MsSql.json" --permissions "authenticated:create,read,delete,update"
add XmlProfile --config "dab-config.MsSql.json" --source xml_profiles --rest true --graphql true --permissions "anonymous:create,read,delete,update"
Expand Down
56 changes: 56 additions & 0 deletions src/Core/Authorization/AuthorizationResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,62 @@ private static ResolvedDatabasePolicy GetPolicyWithClaimValues(string policy, Di
return new ResolvedDatabasePolicy(processedPolicy, claimValues);
}

/// <summary>
/// Returns the field names a database policy references through "@item.", skipping single-quoted
/// literals, in which a doubled quote is an escaped quote.
/// </summary>
internal static IEnumerable<string> GetFieldReferencesInDatabasePolicy(string? policy)
{
if (string.IsNullOrEmpty(policy))
{
yield break;
}

int index = 0;
while (index < policy.Length)
{
if (policy[index] == '\'')
{
index++;
while (index < policy.Length)
{
if (policy[index++] != '\'')
{
continue;
}

if (index < policy.Length && policy[index] == '\'')
{
index++;
continue;
}

break;
}

continue;
}

if (string.CompareOrdinal(policy, index, FIELD_PREFIX, 0, FIELD_PREFIX.Length) != 0)
{
index++;
continue;
}

int fieldStart = index + FIELD_PREFIX.Length;
index = fieldStart;
while (index < policy.Length && (char.IsAsciiLetterOrDigit(policy[index]) || policy[index] == '_'))
{
index++;
}

if (index > fieldStart)
{
yield return policy[fieldStart..index];
}
}
}

/// <summary>
/// Emits a structured audit signal when a configured (non-empty) database authorization
/// policy resolves to an empty predicate, which silently removes the intended row/column
Expand Down
58 changes: 26 additions & 32 deletions src/Core/Resolvers/MsSqlQueryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,30 @@ END AS is_system_object
FROM all_tables AS o
JOIN sys.objects AS so
ON so.object_id = o.object_id
),
tables_with_invalid_types AS
(
SELECT c.object_id
FROM sys.columns AS c
JOIN sys.types AS ty
ON c.user_type_id = ty.user_type_id
WHERE ty.name IN (N'sql_variant', N'rowversion')
-- Columns of CLR types such as geometry are skipped, which only fails when they are in the primary key.
OR
(
ty.is_assembly_type = 1
AND EXISTS
(
SELECT 1
FROM sys.index_columns AS ic
JOIN sys.indexes AS i
ON i.object_id = ic.object_id
AND i.index_id = ic.index_id
WHERE ic.object_id = c.object_id
AND ic.column_id = c.column_id
AND i.is_primary_key = 1
)
)
)
SELECT
a.schema_name AS [schema],
Expand All @@ -698,22 +722,7 @@ ELSE REPLACE(
)
END AS entity_name,
CASE
WHEN EXISTS
(
SELECT 1
FROM sys.columns AS c
JOIN sys.types AS ty
ON c.user_type_id = ty.user_type_id
WHERE c.object_id = a.object_id
AND ty.name IN
(
N'geography',
N'geometry',
N'hierarchyid',
N'sql_variant',
N'rowversion'
)
) THEN 1
WHEN a.object_id IN (SELECT object_id FROM tables_with_invalid_types) THEN 1
ELSE 0
END AS contains_invalid_types
FROM eligible_tables AS a
Expand Down Expand Up @@ -742,22 +751,7 @@ WHERE a.full_name LIKE ip.pattern COLLATE DATABASE_DEFAULT ESCAPE '\'
AND
(
@exclude_invalid_types = 0
OR NOT EXISTS
(
SELECT 1
FROM sys.columns AS c
JOIN sys.types AS ty
ON c.user_type_id = ty.user_type_id
WHERE c.object_id = a.object_id
AND ty.name IN
(
N'geography',
N'geometry',
N'hierarchyid',
N'sql_variant',
N'rowversion'
)
)
OR a.object_id NOT IN (SELECT object_id FROM tables_with_invalid_types)
)
ORDER BY
a.schema_name,
Expand Down
Loading