datasecops-cli 0.7.0b5__tar.gz → 0.7.0b6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/CHANGELOG.md +9 -1
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/PKG-INFO +4 -4
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/README.md +3 -3
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/docs/getting-started.md +4 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/pyproject.toml +1 -1
- datasecops_cli-0.7.0b6/src/datasecops_cli/__init__.py +1 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/dbt_project_generator.py +60 -1
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/snowflake_service.py +6 -1
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/tests/test_dbt_project_generator_profiles.py +51 -0
- datasecops_cli-0.7.0b5/src/datasecops_cli/__init__.py +0 -1
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/.github/workflows/auto-tag.yml +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/.github/workflows/publish-cli.yml +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/.github/workflows/test.yml +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/.gitignore +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/AGENTS.md +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/DEVELOPMENT.md +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/LICENSE +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/docs/dcm.md +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/docs/git-operations.md +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/docs/legacy.md +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/docs/legacy_plan_of_action.md +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/docs/mcp-server.md +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/mcp-servers.json +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/scripts/vendor_model.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/setup.ps1 +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/setup.sh +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/config.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/main.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/menus/__init__.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/menus/configuration.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/menus/dcm_operations.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/menus/development.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/menus/downloads.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/menus/git_operations.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/models/__init__.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/models/git_helpers.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/models/project_config.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/__init__.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/bootstrap_service.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/dbt_runner.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/dcm_orchestrator.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/dcm_pipelines.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/dcm_registry.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/dcm_service.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/directory_scaffolder.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/download_service.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/git_service.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/linting_service.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/model_commands.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/pipeline_env.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/skill_service.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/upstream_service.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/utilities/__init__.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/utilities/display.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/utilities/file_utils.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/utilities/mcp.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/utilities/yaml_utils.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_mcp/__init__.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_mcp/__main__.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_mcp/connection.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_mcp/server.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_model/__init__.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_model/convert.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_model/diagram.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_model/expand.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_model/extract.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_model/render.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_model/schema.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_model/scope.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_model/scripts.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_model/starter.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_model/templates/macros/role.sql +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_model/templates/macros/role_guard.sql +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_model/templates/macros/warehouse.sql +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_model/validate.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/tests/__init__.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/tests/test_config.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/tests/test_dbt_runner.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/tests/test_dcm_model.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/tests/test_dcm_orchestrator.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/tests/test_dcm_service.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/tests/test_download_service.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/tests/test_file_utils.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/tests/test_linting_service.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/tests/test_main.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/tests/test_model_commands.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/tests/test_models.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/tests/test_pipeline_env.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/tests/test_version.py +0 -0
- {datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/tests/test_yaml_utils.py +0 -0
|
@@ -4,7 +4,15 @@ All notable changes to the DataSecOps CLI are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- **`datasecops bootstrap`/`setup` crashed writing `profiles.yml`** — `get_connection_params()` returned raw `tomlkit` value objects from `connections.toml`; dumping those into `profiles.yml` wrote a `!!python/object/apply:tomlkit.items.String` tag that `yaml.safe_load()` can't read back, crashing the *next* run (and any other profile sharing that file) with a `ConstructorError`. Values are now unwrapped to plain Python types before use, and `write_profiles_yml()` repairs a file already corrupted by this bug via a restricted loader that only reconstructs the known legacy tomlkit tags (never arbitrary objects, unlike `yaml.unsafe_load`), instead of crashing on it.
|
|
10
|
+
|
|
11
|
+
### Docs
|
|
12
|
+
|
|
13
|
+
- **Unblock `setup.ps1` before running it** — getting-started.md now runs `Unblock-File .\setup.ps1` first: Windows marks a downloaded script as coming from the internet, and the `RemoteSigned` execution policy then refuses it as "not digitally signed".
|
|
14
|
+
|
|
15
|
+
## [0.7.0b6] - 2026-10-26
|
|
8
16
|
|
|
9
17
|
### Added
|
|
10
18
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: datasecops-cli
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.0b6
|
|
4
4
|
Summary: DataSecOps Framework CLI for Snowflake Native App
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -20,11 +20,11 @@ Description-Content-Type: text/markdown
|
|
|
20
20
|
|
|
21
21
|
# DataSecOps CLI
|
|
22
22
|
|
|
23
|
-
A command-line interface for the [
|
|
23
|
+
A command-line interface for the [Monitorial Orbit Native App](https://app.snowflake.com/marketplace) on Snowflake. Streamlines dbt development, source control workflows, and framework configuration management for teams using the DataSecOps Framework.
|
|
24
24
|
|
|
25
25
|
## What is this?
|
|
26
26
|
|
|
27
|
-
The DataSecOps CLI is the local developer companion to the **
|
|
27
|
+
The DataSecOps CLI is the local developer companion to the **Monitorial Orbit Native App** — a Snowflake Native App that provides governance, configuration management, and standardised development workflows for data teams.
|
|
28
28
|
|
|
29
29
|
This CLI connects to the native app and gives developers:
|
|
30
30
|
|
|
@@ -46,7 +46,7 @@ With MCP server support:
|
|
|
46
46
|
pip install "datasecops-cli[mcp]"
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
Requires Python 3.
|
|
49
|
+
Requires Python 3.11 or later.
|
|
50
50
|
|
|
51
51
|
## Prerequisites
|
|
52
52
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# DataSecOps CLI
|
|
2
2
|
|
|
3
|
-
A command-line interface for the [
|
|
3
|
+
A command-line interface for the [Monitorial Orbit Native App](https://app.snowflake.com/marketplace) on Snowflake. Streamlines dbt development, source control workflows, and framework configuration management for teams using the DataSecOps Framework.
|
|
4
4
|
|
|
5
5
|
## What is this?
|
|
6
6
|
|
|
7
|
-
The DataSecOps CLI is the local developer companion to the **
|
|
7
|
+
The DataSecOps CLI is the local developer companion to the **Monitorial Orbit Native App** — a Snowflake Native App that provides governance, configuration management, and standardised development workflows for data teams.
|
|
8
8
|
|
|
9
9
|
This CLI connects to the native app and gives developers:
|
|
10
10
|
|
|
@@ -26,7 +26,7 @@ With MCP server support:
|
|
|
26
26
|
pip install "datasecops-cli[mcp]"
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
Requires Python 3.
|
|
29
|
+
Requires Python 3.11 or later.
|
|
30
30
|
|
|
31
31
|
## Prerequisites
|
|
32
32
|
|
|
@@ -46,9 +46,13 @@ Navigate to your dbt project root and run the setup script:
|
|
|
46
46
|
**Windows (PowerShell):**
|
|
47
47
|
|
|
48
48
|
```powershell
|
|
49
|
+
Unblock-File .\setup.ps1
|
|
49
50
|
.\setup.ps1
|
|
50
51
|
```
|
|
51
52
|
|
|
53
|
+
A downloaded script is marked as coming from the internet, and the `RemoteSigned` execution policy then
|
|
54
|
+
refuses it as "not digitally signed"; `Unblock-File` clears that mark.
|
|
55
|
+
|
|
52
56
|
**Linux / macOS:**
|
|
53
57
|
|
|
54
58
|
```bash
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.7.0b6"
|
|
@@ -243,6 +243,65 @@ def generate_local_dev_target(
|
|
|
243
243
|
return output
|
|
244
244
|
|
|
245
245
|
|
|
246
|
+
def _to_plain(value: Any) -> Any:
|
|
247
|
+
"""Recursively strip non-standard object types (e.g. tomlkit's str/int/bool subclasses)
|
|
248
|
+
down to plain dict/list/str/int/float/bool/None, so the result is always safe to
|
|
249
|
+
`yaml.safe_load()` back after a `yaml.dump()` round-trip."""
|
|
250
|
+
if isinstance(value, dict):
|
|
251
|
+
return {k: _to_plain(v) for k, v in value.items()}
|
|
252
|
+
if isinstance(value, list):
|
|
253
|
+
return [_to_plain(v) for v in value]
|
|
254
|
+
if isinstance(value, bool) or value is None or isinstance(value, (int, float)):
|
|
255
|
+
return value
|
|
256
|
+
if isinstance(value, str):
|
|
257
|
+
return str(value)
|
|
258
|
+
return value
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
class _LegacyTomlkitSafeLoader(yaml.SafeLoader):
|
|
262
|
+
"""A `SafeLoader` that additionally repairs the one known legacy corruption - a
|
|
263
|
+
`tomlkit.items.String` (or `.Integer`/`.Float`/`.Bool`) value dumped straight into
|
|
264
|
+
profiles.yml by an older CLI bug (fixed in `get_connection_params`) - without executing
|
|
265
|
+
any object constructor. Every other tag (including the nested `StringType`/`Trivia`
|
|
266
|
+
tags tomlkit's own `!!python/object/apply:tomlkit.items.String` sequence carries) is
|
|
267
|
+
still rejected exactly like `yaml.SafeLoader`, so this never introduces `yaml.unsafe_load`'s
|
|
268
|
+
arbitrary-code-execution risk: the extra constructors below only pick a single already-plain
|
|
269
|
+
scalar out of the YAML node by position, they never call into tomlkit (or any other) code.
|
|
270
|
+
"""
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
def _construct_legacy_tomlkit_scalar(loader: yaml.SafeLoader, node: yaml.Node) -> Any:
|
|
274
|
+
# tomlkit dumps e.g. `String` as a sequence: [StringType-tag, value, original, Trivia-tag].
|
|
275
|
+
# `value` (index 1) is the plain scalar we want; the rest is tomlkit-internal bookkeeping
|
|
276
|
+
# we deliberately never construct. construct_object (not construct_scalar) is used so the
|
|
277
|
+
# value's own tag (str/int/float/bool, auto-resolved by the safe resolver) still picks the
|
|
278
|
+
# right already-safe constructor, instead of collapsing everything to a string.
|
|
279
|
+
if not isinstance(node, yaml.SequenceNode) or len(node.value) < 2:
|
|
280
|
+
raise yaml.constructor.ConstructorError(
|
|
281
|
+
None, None, "unexpected legacy tomlkit value structure", node.start_mark)
|
|
282
|
+
return loader.construct_object(node.value[1], deep=True)
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
for _tomlkit_type in ("String", "Integer", "Float", "Bool"):
|
|
286
|
+
_LegacyTomlkitSafeLoader.add_constructor(
|
|
287
|
+
f"tag:yaml.org,2002:python/object/apply:tomlkit.items.{_tomlkit_type}",
|
|
288
|
+
_construct_legacy_tomlkit_scalar,
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
def _load_profiles_yml_text(text: str) -> dict[str, Any]:
|
|
293
|
+
"""Load an existing profiles.yml, tolerating a file corrupted by an older CLI bug that
|
|
294
|
+
wrote `!!python/object/apply` tags (tomlkit values dumped without being unwrapped first -
|
|
295
|
+
fixed in `get_connection_params`). `yaml.safe_load()` can't read those tags back; falling
|
|
296
|
+
back to `_LegacyTomlkitSafeLoader` repairs only that specific, known corruption - never
|
|
297
|
+
executing arbitrary code like `yaml.unsafe_load()` would - and the result is sanitized to
|
|
298
|
+
plain types so future writes round-trip through `safe_load` again."""
|
|
299
|
+
try:
|
|
300
|
+
return yaml.safe_load(text) or {}
|
|
301
|
+
except yaml.YAMLError:
|
|
302
|
+
return _to_plain(yaml.load(text, Loader=_LegacyTomlkitSafeLoader) or {})
|
|
303
|
+
|
|
304
|
+
|
|
246
305
|
def write_profiles_yml(
|
|
247
306
|
profiles_dir,
|
|
248
307
|
profile_name: str,
|
|
@@ -270,7 +329,7 @@ def write_profiles_yml(
|
|
|
270
329
|
|
|
271
330
|
existing_profiles: dict[str, Any] = {}
|
|
272
331
|
if profiles_path.exists():
|
|
273
|
-
existing_profiles =
|
|
332
|
+
existing_profiles = _load_profiles_yml_text(profiles_path.read_text(encoding="utf-8"))
|
|
274
333
|
|
|
275
334
|
local_dev_output = generate_local_dev_target(profile, project_settings, connection_params, sandpit_name)
|
|
276
335
|
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/snowflake_service.py
RENAMED
|
@@ -21,13 +21,18 @@ def get_connection_params(connection_name: str) -> dict[str, Any]:
|
|
|
21
21
|
"""Raw connection parameters for a named Snowflake CLI connection, read directly
|
|
22
22
|
from ~/.snowflake/connections.toml (no connection is established).
|
|
23
23
|
|
|
24
|
+
Values are unwrapped to plain Python types: the connector's TOML parser (tomlkit)
|
|
25
|
+
returns its own str/int/bool subclasses, which `yaml.dump()` serializes with a
|
|
26
|
+
`!!python/object/apply` tag that `yaml.safe_load()` can't read back.
|
|
27
|
+
|
|
24
28
|
Returns an empty dict if the connection name isn't found or the config can't be read.
|
|
25
29
|
"""
|
|
26
30
|
try:
|
|
27
31
|
from snowflake.connector.config_manager import CONFIG_MANAGER
|
|
28
32
|
CONFIG_MANAGER.read_config()
|
|
29
33
|
connections = CONFIG_MANAGER["connections"]
|
|
30
|
-
|
|
34
|
+
raw = connections.get(connection_name, {})
|
|
35
|
+
return {k: (v.unwrap() if hasattr(v, "unwrap") else v) for k, v in dict(raw).items()}
|
|
31
36
|
except Exception:
|
|
32
37
|
return {}
|
|
33
38
|
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/tests/test_dbt_project_generator_profiles.py
RENAMED
|
@@ -68,6 +68,57 @@ def test_generate_local_dev_target_omits_missing_connection_fields():
|
|
|
68
68
|
assert "password" not in output
|
|
69
69
|
|
|
70
70
|
|
|
71
|
+
def test_write_profiles_yml_repairs_file_corrupted_by_unwrapped_toml_values(tmp_path):
|
|
72
|
+
"""An older CLI bug wrote raw tomlkit values straight into profiles.yml, producing a
|
|
73
|
+
`!!python/object/apply:tomlkit.items.String` tag that yaml.safe_load() can't parse.
|
|
74
|
+
write_profiles_yml must repair the file in place rather than crash or wipe it."""
|
|
75
|
+
import tomlkit
|
|
76
|
+
|
|
77
|
+
profiles_dir = tmp_path / ".dbt"
|
|
78
|
+
profiles_dir.mkdir(parents=True)
|
|
79
|
+
profiles_path = profiles_dir / "profiles.yml"
|
|
80
|
+
corrupted = {
|
|
81
|
+
"anzco_sds": {
|
|
82
|
+
"target": "local-dev",
|
|
83
|
+
"outputs": {
|
|
84
|
+
"local-dev": {"type": "snowflake", "account": tomlkit.string("old-account")},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
"other_profile": {
|
|
88
|
+
"target": "local-dev",
|
|
89
|
+
"outputs": {"local-dev": {"type": "snowflake", "account": tomlkit.string("untouched")}},
|
|
90
|
+
},
|
|
91
|
+
}
|
|
92
|
+
profiles_path.write_text(yaml.dump(corrupted, default_flow_style=False, sort_keys=False), encoding="utf-8")
|
|
93
|
+
|
|
94
|
+
# Confirm the fixture really does reproduce the unreadable-by-safe_load corruption.
|
|
95
|
+
with pytest.raises(yaml.YAMLError):
|
|
96
|
+
yaml.safe_load(profiles_path.read_text(encoding="utf-8"))
|
|
97
|
+
|
|
98
|
+
status = write_profiles_yml(
|
|
99
|
+
profiles_dir, "anzco_sds", _profile(), _project_settings(), {"account": "acct"}, "jon")
|
|
100
|
+
|
|
101
|
+
assert status == "updated"
|
|
102
|
+
# The file is now readable by safe_load again: the untouched profile's legacy tomlkit
|
|
103
|
+
# value was actually repaired to a plain string (not merely preserved by sheer luck of
|
|
104
|
+
# not being touched), while the profile being written was refreshed.
|
|
105
|
+
data = yaml.safe_load(profiles_path.read_text(encoding="utf-8"))
|
|
106
|
+
assert data["anzco_sds"]["outputs"]["local-dev"]["account"] == "acct"
|
|
107
|
+
assert data["other_profile"]["outputs"]["local-dev"]["account"] == "untouched"
|
|
108
|
+
assert type(data["other_profile"]["outputs"]["local-dev"]["account"]) is str
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def test_load_profiles_yml_text_rejects_unknown_object_tags():
|
|
112
|
+
"""The legacy-repair loader only tolerates the specific tomlkit tags it knows about -
|
|
113
|
+
any other `!!python/object/apply` tag (an attempted exploit, or a genuinely different
|
|
114
|
+
kind of corruption) must still be rejected, unlike a plain yaml.unsafe_load() would."""
|
|
115
|
+
from datasecops_cli.services.dbt_project_generator import _load_profiles_yml_text
|
|
116
|
+
|
|
117
|
+
malicious = "a: !!python/object/apply:os.system ['echo pwned']\n"
|
|
118
|
+
with pytest.raises(yaml.YAMLError):
|
|
119
|
+
_load_profiles_yml_text(malicious)
|
|
120
|
+
|
|
121
|
+
|
|
71
122
|
def test_write_profiles_yml_creates_folder_and_file(tmp_path):
|
|
72
123
|
profiles_dir = tmp_path / ".dbt"
|
|
73
124
|
assert not profiles_dir.exists()
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.7.0b5"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/menus/dcm_operations.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/menus/git_operations.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/models/project_config.py
RENAMED
|
File without changes
|
|
File without changes
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/bootstrap_service.py
RENAMED
|
File without changes
|
|
File without changes
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/dcm_orchestrator.py
RENAMED
|
File without changes
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/dcm_pipelines.py
RENAMED
|
File without changes
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/dcm_registry.py
RENAMED
|
File without changes
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/dcm_service.py
RENAMED
|
File without changes
|
|
File without changes
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/download_service.py
RENAMED
|
File without changes
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/git_service.py
RENAMED
|
File without changes
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/linting_service.py
RENAMED
|
File without changes
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/model_commands.py
RENAMED
|
File without changes
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/pipeline_env.py
RENAMED
|
File without changes
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/skill_service.py
RENAMED
|
File without changes
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/services/upstream_service.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/utilities/file_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_cli/utilities/yaml_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datasecops_cli-0.7.0b5 → datasecops_cli-0.7.0b6}/src/datasecops_model/templates/macros/role.sql
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|