Skip to content

Commit f8d2556

Browse files
committed
Rework AUTHENTICATION_POLICY; Fix STAGE_FILE path delimiter issues on Windows
1 parent 033c88a commit f8d2556

File tree

18 files changed

+240
-191
lines changed

18 files changed

+240
-191
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## [0.59.0] - 2025-10-24
4+
5+
- All `AUTHENTICATION_POLICY` parameters are now optional.
6+
- Added parameters `mfa_policy`, `pat_policy`, `workload_identity_policy` for `AUTHENTICATION POLICY`.
7+
- Switched `AUTHENTICATION_POLICY` to short-hash approach instead of comparing each individual parameter.
8+
- Switched `AUTHENTICATION_POLICY` to `CREATE OR ALTER` approach instead of `ALTER`.
9+
- Switched `AUTHENTICATION_POLICY` new references to `FORCE` mode instead of explicitly finding and dropping currently existing references.
10+
- Fixed `STAGE_FILE` path delimiter issue for existing files on Windows.
11+
312
## [0.58.2] - 2025-10-16
413

514
- Excluded all non-standard `DATABASE` objects while processing `SHOW DATABASES` for "schema cache". It includes personal databases, inbound shares and application databases.

snowddl/blueprint/blueprint.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,14 @@ class AlertBlueprint(SchemaObjectBlueprint):
8484

8585

8686
class AuthenticationPolicyBlueprint(SchemaObjectBlueprint):
87-
authentication_methods: List[str]
88-
mfa_authentication_methods: List[str]
89-
mfa_enrollment: str
90-
client_types: List[str]
91-
security_integrations: List[str]
87+
authentication_methods: Optional[List[str]] = None
88+
mfa_authentication_methods: Optional[List[str]] = None
89+
mfa_enrollment: Optional[str] = None
90+
mfa_policy: Optional[Dict[str, Union[bool, float, int, str, list]]] = None
91+
client_types: Optional[List[str]] = None
92+
security_integrations: Optional[List[str]] = None
93+
pat_policy: Optional[Dict[str, Union[bool, float, int, str, list]]] = None
94+
workload_identity_policy: Optional[Dict[str, Union[bool, float, int, str, list]]] = None
9295
references: List[AuthenticationPolicyReference] = []
9396

9497

snowddl/parser/authentication_policy.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
"mfa_enrollment": {
2424
"type": "string"
2525
},
26+
"mfa_policy": {
27+
"type": "object",
28+
"additionalProperties": {
29+
"type": ["array", "boolean", "number", "string"]
30+
}
31+
},
2632
"client_types": {
2733
"type": "array",
2834
"items": {
@@ -37,18 +43,23 @@
3743
},
3844
"minItems": 1
3945
},
46+
"pat_policy": {
47+
"type": "object",
48+
"additionalProperties": {
49+
"type": ["array", "boolean", "number", "string"]
50+
}
51+
},
52+
"workload_identity_policy": {
53+
"type": "object",
54+
"additionalProperties": {
55+
"type": ["array", "boolean", "number", "string"]
56+
}
57+
},
4058
"comment": {
4159
"type": "string"
4260
}
4361
},
4462
"additionalProperties": False,
45-
"required": [
46-
"authentication_methods",
47-
"mfa_authentication_methods",
48-
"mfa_enrollment",
49-
"client_types",
50-
"security_integrations",
51-
],
5263
}
5364
# fmt: on
5465

@@ -60,16 +71,16 @@ def load_blueprints(self):
6071
)
6172

6273
def process_authentication_policy(self, f: ParsedFile):
63-
# All parameters are required, since Snowflake keeps changing defaults liberally
64-
# We cannot trust defaults on this object type
65-
# https://docs.snowflake.com/en/sql-reference/sql/create-authentication-policy
6674
bp = AuthenticationPolicyBlueprint(
6775
full_name=SchemaObjectIdent(self.env_prefix, f.database, f.schema, f.name),
6876
authentication_methods=self.normalise_params_list(f.params.get("authentication_methods")),
6977
mfa_authentication_methods=self.normalise_params_list(f.params.get("mfa_authentication_methods")),
7078
mfa_enrollment=f.params.get("mfa_enrollment").upper(),
79+
mfa_policy=self.normalise_params_dict(f.params.get("mfa_policy")),
7180
client_types=self.normalise_params_list(f.params.get("client_types")),
7281
security_integrations=self.normalise_params_list(f.params.get("security_integrations")),
82+
pat_policy=self.normalise_params_dict(f.params.get("pat_policy")),
83+
workload_identity_policy=self.normalise_params_dict(f.params.get("workload_identity_policy")),
7384
comment=f.params.get("comment"),
7485
)
7586

0 commit comments

Comments
 (0)