lfguard 0.1.0__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.
Files changed (60) hide show
  1. lfguard-0.1.0/CHANGELOG.md +105 -0
  2. lfguard-0.1.0/CONTRIBUTING.md +38 -0
  3. lfguard-0.1.0/LICENSE +156 -0
  4. lfguard-0.1.0/MANIFEST.in +12 -0
  5. lfguard-0.1.0/PKG-INFO +418 -0
  6. lfguard-0.1.0/README.md +356 -0
  7. lfguard-0.1.0/SECURITY.md +17 -0
  8. lfguard-0.1.0/docs/adoption-checklist.md +196 -0
  9. lfguard-0.1.0/docs/architecture.md +98 -0
  10. lfguard-0.1.0/docs/aws-api-coverage.md +80 -0
  11. lfguard-0.1.0/docs/aws-permissions.md +117 -0
  12. lfguard-0.1.0/docs/cli.md +478 -0
  13. lfguard-0.1.0/docs/faq.md +67 -0
  14. lfguard-0.1.0/docs/github-actions.md +137 -0
  15. lfguard-0.1.0/docs/lake-formation-guide.md +172 -0
  16. lfguard-0.1.0/docs/positioning.md +61 -0
  17. lfguard-0.1.0/docs/publishing.md +71 -0
  18. lfguard-0.1.0/docs/recipes.md +392 -0
  19. lfguard-0.1.0/docs/release-notes/v0.1.0.md +81 -0
  20. lfguard-0.1.0/docs/report-formats.md +312 -0
  21. lfguard-0.1.0/docs/roadmap.md +65 -0
  22. lfguard-0.1.0/docs/safety-model.md +90 -0
  23. lfguard-0.1.0/docs/schema.json +364 -0
  24. lfguard-0.1.0/docs/state-format.md +231 -0
  25. lfguard-0.1.0/docs/tag-permission-matrix.md +261 -0
  26. lfguard-0.1.0/docs/troubleshooting.md +96 -0
  27. lfguard-0.1.0/examples/README.md +149 -0
  28. lfguard-0.1.0/examples/current-snapshot.json +19 -0
  29. lfguard-0.1.0/examples/desired.json +33 -0
  30. lfguard-0.1.0/examples/desired.yaml +32 -0
  31. lfguard-0.1.0/examples/github-actions/lakeformation-code-scanning.yml +89 -0
  32. lfguard-0.1.0/examples/github-actions/lakeformation-drift.yml +86 -0
  33. lfguard-0.1.0/examples/pre-commit/pre-commit-config.yaml +9 -0
  34. lfguard-0.1.0/pyproject.toml +8 -0
  35. lfguard-0.1.0/setup.cfg +105 -0
  36. lfguard-0.1.0/setup.py +4 -0
  37. lfguard-0.1.0/src/lakeformation_guard/__init__.py +38 -0
  38. lfguard-0.1.0/src/lakeformation_guard/__main__.py +7 -0
  39. lfguard-0.1.0/src/lakeformation_guard/_version.py +3 -0
  40. lfguard-0.1.0/src/lakeformation_guard/audit.py +180 -0
  41. lfguard-0.1.0/src/lakeformation_guard/aws.py +296 -0
  42. lfguard-0.1.0/src/lakeformation_guard/cli.py +2485 -0
  43. lfguard-0.1.0/src/lakeformation_guard/io.py +130 -0
  44. lfguard-0.1.0/src/lakeformation_guard/lint.py +362 -0
  45. lfguard-0.1.0/src/lakeformation_guard/models.py +376 -0
  46. lfguard-0.1.0/src/lakeformation_guard/planner.py +256 -0
  47. lfguard-0.1.0/src/lakeformation_guard/py.typed +1 -0
  48. lfguard-0.1.0/src/lakeformation_guard/schema.py +181 -0
  49. lfguard-0.1.0/src/lfguard.egg-info/PKG-INFO +418 -0
  50. lfguard-0.1.0/src/lfguard.egg-info/SOURCES.txt +59 -0
  51. lfguard-0.1.0/src/lfguard.egg-info/dependency_links.txt +1 -0
  52. lfguard-0.1.0/src/lfguard.egg-info/entry_points.txt +3 -0
  53. lfguard-0.1.0/src/lfguard.egg-info/requires.txt +14 -0
  54. lfguard-0.1.0/src/lfguard.egg-info/top_level.txt +1 -0
  55. lfguard-0.1.0/tests/test_audit_cli.py +1862 -0
  56. lfguard-0.1.0/tests/test_aws_adapter.py +120 -0
  57. lfguard-0.1.0/tests/test_docs_examples.py +162 -0
  58. lfguard-0.1.0/tests/test_models.py +58 -0
  59. lfguard-0.1.0/tests/test_package_metadata.py +121 -0
  60. lfguard-0.1.0/tests/test_planner.py +110 -0
@@ -0,0 +1,105 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ - Initial release of `lfguard`.
6
+ - Adds the `lfguard` CLI with `init`, `schema`, `check`, `validate`, `lint`,
7
+ `audit`, `plan`, `sample`, `bootstrap`, `doctor`, `permissions`,
8
+ `completion`, `snapshot`, and conservative `apply` commands.
9
+ - Adds desired-policy lint checks for undefined LF-Tag keys and values.
10
+ - Adds a `check` command for one-step offline validation and lint gates.
11
+ - Uses `check` in generated policy/demo workflows and release smoke tests.
12
+ - Emphasizes `check` in first-run quickstarts before planning changes.
13
+ - Adds policy summary reports for compact review of desired and current state.
14
+ - Adds text, JSON, and Markdown output for reviewable audit and plan workflows.
15
+ - Adds SARIF output for audit and lint findings.
16
+ - Adds an offline install check for optional AWS and YAML integrations.
17
+ - Adds `doctor --require` checks for failing CI when required optional extras
18
+ are missing.
19
+ - Adds a `permissions` command for generating starter IAM policies for
20
+ read-only, additive apply, and destructive apply workflows.
21
+ - Adds a `completion` command for bash, zsh, and fish shell completions.
22
+ - Adds a `--github-summary` option for GitHub Actions job summaries across
23
+ lint, summary, audit, plan, and apply workflows.
24
+ - Adds a copyable GitHub Code Scanning workflow for lint and audit SARIF
25
+ uploads.
26
+ - Adds a `--fail-on-changes` option for CI plan gates.
27
+ - Adds a `--fail-on-severity` option for error-only audit gates.
28
+ - Adds severity summaries to audit text, JSON, and Markdown reports.
29
+ - Adds `--output-file` report capture for audit, plan, and apply workflows.
30
+ - Adds `--output-file` diagnostics capture for doctor and validate workflows.
31
+ - Documents GitHub Actions report artifact uploads and preserves CI build artifacts.
32
+ - Adds a CLI reference with command semantics, common options, and exit codes.
33
+ - Adds YAML starter policy generation and a YAML example policy.
34
+ - Adds `init --template` starter policies for a data-domain example or blank
35
+ policy skeleton.
36
+ - Ships a JSON Schema for desired/current state files.
37
+ - Adds importable planning and audit APIs under `lakeformation_guard`.
38
+ - Supports LF-Tag definitions, resource tag assignments, and Lake Formation grants.
39
+ - Includes an optional boto3 adapter for live AWS inventory and execution.
40
+ - Ships offline JSON/YAML desired-state workflows and example policy files.
41
+ - Adds an examples guide and PyPI metadata links for first-run discoverability.
42
+ - Adds PyPI discovery keywords for policy-as-code, drift detection, data lake,
43
+ and data governance searches.
44
+ - Adds an adoption checklist for moving from offline demo to CI and controlled
45
+ apply workflows.
46
+ - Adds a report-format guide for audit, plan, apply, and CI artifacts.
47
+ - Adds a safety model guide for conservative defaults and destructive changes.
48
+ - Adds a Lake Formation operating guide covering IAM/Lake Formation interaction,
49
+ LF-Tag best practices, hybrid access mode, `IAMAllowedPrincipals`, and
50
+ antipatterns.
51
+ - Tightens README and CLI guidance around the core `check`, `audit`, `plan`,
52
+ and conservative `apply` workflow while keeping scaffolds secondary.
53
+ - Adds lint coverage and docs for AWS LF-Tag behavior: lower-case storage,
54
+ one resource value per key, expression AND/OR semantics, and `*` value
55
+ wildcards in LF-Tag policy grants.
56
+ - Adds a tag and permission matrix for LF-Tag inheritance, column overrides,
57
+ grant shape interactions, expression matching, permission behavior, and
58
+ `lfguard` support boundaries.
59
+ - Adds opinionated governance lint for broad principals, `ALL`/`SUPER`,
60
+ mutating permissions, grant option, wildcard LF-Tag policies, and named
61
+ database/table grant exceptions.
62
+ - Adds a positioning guide for how `lfguard` fits with infrastructure tools,
63
+ raw boto3, and console workflows.
64
+ - Calls out README scope limits early so new users can evaluate fit quickly.
65
+ - Adds a README capability matrix for quick PyPI-page evaluation.
66
+ - Adds a troubleshooting guide for common install, AWS, planning, and CI issues.
67
+ - Adds GitHub issue and pull request templates for safer community reports.
68
+ - Adds a copyable GitHub Actions drift-check workflow under `examples/`.
69
+ - Adds a copyable pre-commit validation hook example under `examples/`.
70
+ - Adds an architecture guide for package boundaries, data flow, and AWS adapter
71
+ responsibilities.
72
+ - Adds a roadmap with near-term priorities, evaluation questions, and non-goals.
73
+ - Adds publish-ready release notes for the first public PyPI release.
74
+ - Documents `pipx` and `uv tool` install paths for CLI users.
75
+ - Adds a `sample` command for generating a runnable offline demo after install,
76
+ including a local README with copy-paste commands.
77
+ - Adds `sample --include-ci` for generating an offline GitHub Actions demo
78
+ workflow alongside the sample files.
79
+ - Adds a `bootstrap` command for generating a starter policy repository layout
80
+ with schema, CI, pre-commit, and rollout README files.
81
+ - Adds JSON, YAML, and combined output formats for generated sample demos.
82
+ - Adds a state-format guide with examples for each supported resource kind.
83
+ - Adds an AWS API coverage guide for live inventory and apply calls.
84
+ - Adds an FAQ for safety, scope, credentials, and adoption questions.
85
+ - Adds CI and release workflow smoke tests for the built wheel.
86
+ - Adds a release workflow gate that installs and smoke-tests the package from
87
+ PyPI after publishing.
88
+ - Retries the post-publish PyPI install briefly to tolerate index propagation.
89
+ - Verifies the exact PyPI version matching the GitHub release tag.
90
+ - Fails the release workflow early when the GitHub release tag does not match
91
+ package metadata.
92
+ - Verifies release artifact filenames and embedded wheel/sdist metadata before
93
+ upload.
94
+ - Adds an optional `bootstrap --include-live-drift` scaffold for scheduled
95
+ GitHub OIDC drift checks and starter read-only IAM policy JSON.
96
+ - Adds an optional `bootstrap --include-code-scanning` scaffold for uploading
97
+ `lfguard` lint and drift SARIF findings to GitHub Code Scanning.
98
+ - Adds an optional `bootstrap --include-review-template` scaffold for CODEOWNERS
99
+ and Lake Formation policy pull request checklists.
100
+ - Adds an optional `bootstrap --include-editor-config` scaffold for VS Code
101
+ schema validation against generated desired policy files.
102
+ - Adds docs tests for internal Markdown links.
103
+ - Adds package metadata tests for version, console scripts, and project URLs.
104
+ - Modernizes the build backend requirement for current setuptools releases.
105
+ - Uses SPDX license metadata without deprecated license classifiers.
@@ -0,0 +1,38 @@
1
+ # Contributing
2
+
3
+ Thanks for improving `lfguard`.
4
+
5
+ ## Development Setup
6
+
7
+ ```bash
8
+ python -m venv .venv
9
+ . .venv/bin/activate
10
+ python -m pip install -e ".[dev,aws,yaml]"
11
+ python -m unittest discover -s tests
12
+ ```
13
+
14
+ ## Reporting Issues
15
+
16
+ Use the GitHub bug report template for reproducible behavior and include
17
+ sanitized desired/current state when possible. Run `lfguard doctor --output json`
18
+ and remove any sensitive account, principal, catalog, or path details before
19
+ posting output.
20
+
21
+ Use the feature request template for new resource shapes, report formats,
22
+ workflow integrations, or safety-model changes.
23
+
24
+ ## Design Constraints
25
+
26
+ - Keep audit and plan logic deterministic and AWS-free.
27
+ - Keep boto3 calls in the adapter layer.
28
+ - Default plans must remain conservative: no revokes or removals unless the user explicitly enables them.
29
+ - Add tests for every planner, audit, or apply behavior change.
30
+ - Prefer JSON-compatible public payloads so CLI output can be consumed by CI systems.
31
+
32
+ ## Release Checks
33
+
34
+ ```bash
35
+ python -m unittest discover -s tests
36
+ python -m build
37
+ python -m twine check dist/*
38
+ ```
lfguard-0.1.0/LICENSE ADDED
@@ -0,0 +1,156 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
13
+ owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities
16
+ that control, are controlled by, or are under common control with that entity.
17
+ For the purposes of this definition, "control" means (i) the power, direct or
18
+ indirect, to cause the direction or management of such entity, whether by
19
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
23
+ permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications, including
26
+ but not limited to software source code, documentation source, and configuration
27
+ files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical transformation or
30
+ translation of a Source form, including but not limited to compiled object code,
31
+ generated documentation, and conversions to other media types.
32
+
33
+ "Work" shall mean the work of authorship, whether in Source or Object form,
34
+ made available under the License, as indicated by a copyright notice that is
35
+ included in or attached to the work.
36
+
37
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
38
+ is based on (or derived from) the Work and for which the editorial revisions,
39
+ annotations, elaborations, or other modifications represent, as a whole, an
40
+ original work of authorship. For the purposes of this License, Derivative Works
41
+ shall not include works that remain separable from, or merely link (or bind by
42
+ name) to the interfaces of, the Work and Derivative Works thereof.
43
+
44
+ "Contribution" shall mean any work of authorship, including the original version
45
+ of the Work and any modifications or additions to that Work or Derivative Works
46
+ thereof, that is intentionally submitted to Licensor for inclusion in the Work by
47
+ the copyright owner or by an individual or Legal Entity authorized to submit on
48
+ behalf of the copyright owner. For the purposes of this definition, "submitted"
49
+ means any form of electronic, verbal, or written communication sent to the
50
+ Licensor or its representatives, including but not limited to communication on
51
+ electronic mailing lists, source code control systems, and issue tracking
52
+ systems that are managed by, or on behalf of, the Licensor for the purpose of
53
+ discussing and improving the Work, but excluding communication that is
54
+ conspicuously marked or otherwise designated in writing by the copyright owner
55
+ as "Not a Contribution."
56
+
57
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
58
+ of whom a Contribution has been received by Licensor and subsequently
59
+ incorporated within the Work.
60
+
61
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
62
+ License, each Contributor hereby grants to You a perpetual, worldwide,
63
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
64
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
65
+ sublicense, and distribute the Work and such Derivative Works in Source or
66
+ Object form.
67
+
68
+ 3. Grant of Patent License. Subject to the terms and conditions of this License,
69
+ each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
70
+ no-charge, royalty-free, irrevocable patent license to make, have made, use,
71
+ offer to sell, sell, import, and otherwise transfer the Work, where such license
72
+ applies only to those patent claims licensable by such Contributor that are
73
+ necessarily infringed by their Contribution(s) alone or by combination of their
74
+ Contribution(s) with the Work to which such Contribution(s) was submitted. If
75
+ You institute patent litigation against any entity alleging that the Work or a
76
+ Contribution incorporated within the Work constitutes direct or contributory
77
+ patent infringement, then any patent licenses granted to You under this License
78
+ for that Work shall terminate as of the date such litigation is filed.
79
+
80
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
81
+ Derivative Works thereof in any medium, with or without modifications, and in
82
+ Source or Object form, provided that You meet the following conditions:
83
+
84
+ (a) You must give any other recipients of the Work or Derivative Works a copy of
85
+ this License; and
86
+
87
+ (b) You must cause any modified files to carry prominent notices stating that
88
+ You changed the files; and
89
+
90
+ (c) You must retain, in the Source form of any Derivative Works that You
91
+ distribute, all copyright, patent, trademark, and attribution notices from the
92
+ Source form of the Work, excluding those notices that do not pertain to any part
93
+ of the Derivative Works; and
94
+
95
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then
96
+ any Derivative Works that You distribute must include a readable copy of the
97
+ attribution notices contained within such NOTICE file, excluding those notices
98
+ that do not pertain to any part of the Derivative Works, in at least one of the
99
+ following places: within a NOTICE text file distributed as part of the
100
+ Derivative Works; within the Source form or documentation, if provided along
101
+ with the Derivative Works; or, within a display generated by the Derivative
102
+ Works, if and wherever such third-party notices normally appear. The contents of
103
+ the NOTICE file are for informational purposes only and do not modify the
104
+ License. You may add Your own attribution notices within Derivative Works that
105
+ You distribute, alongside or as an addendum to the NOTICE text from the Work,
106
+ provided that such additional attribution notices cannot be construed as
107
+ modifying the License.
108
+
109
+ You may add Your own copyright statement to Your modifications and may provide
110
+ additional or different license terms and conditions for use, reproduction, or
111
+ distribution of Your modifications, or for any such Derivative Works as a whole,
112
+ provided Your use, reproduction, and distribution of the Work otherwise complies
113
+ with the conditions stated in this License.
114
+
115
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
116
+ Contribution intentionally submitted for inclusion in the Work by You to the
117
+ Licensor shall be under the terms and conditions of this License, without any
118
+ additional terms or conditions. Notwithstanding the above, nothing herein shall
119
+ supersede or modify the terms of any separate license agreement you may have
120
+ executed with Licensor regarding such Contributions.
121
+
122
+ 6. Trademarks. This License does not grant permission to use the trade names,
123
+ trademarks, service marks, or product names of the Licensor, except as required
124
+ for reasonable and customary use in describing the origin of the Work and
125
+ reproducing the content of the NOTICE file.
126
+
127
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
128
+ writing, Licensor provides the Work on an "AS IS" BASIS, WITHOUT WARRANTIES OR
129
+ CONDITIONS OF ANY KIND, either express or implied, including, without limitation,
130
+ any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or
131
+ FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the
132
+ appropriateness of using or redistributing the Work and assume any risks
133
+ associated with Your exercise of permissions under this License.
134
+
135
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
136
+ tort (including negligence), contract, or otherwise, unless required by
137
+ applicable law (such as deliberate and grossly negligent acts) or agreed to in
138
+ writing, shall any Contributor be liable to You for damages, including any
139
+ direct, indirect, special, incidental, or consequential damages of any character
140
+ arising as a result of this License or out of the use or inability to use the
141
+ Work, including but not limited to damages for loss of goodwill, work stoppage,
142
+ computer failure or malfunction, or any and all other commercial damages or
143
+ losses, even if such Contributor has been advised of the possibility of such
144
+ damages.
145
+
146
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
147
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
148
+ acceptance of support, warranty, indemnity, or other liability obligations and
149
+ rights consistent with this License. However, in accepting such obligations, You
150
+ may act only on Your own behalf and on Your sole responsibility, not on behalf
151
+ of any other Contributor, and only if You agree to indemnify, defend, and hold
152
+ each Contributor harmless for any liability incurred by, or claims asserted
153
+ against, such Contributor by reason of your accepting any such warranty or
154
+ additional liability.
155
+
156
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,12 @@
1
+ include LICENSE
2
+ include README.md
3
+ include pyproject.toml
4
+ include setup.cfg
5
+ include setup.py
6
+ include src/lakeformation_guard/py.typed
7
+ include CHANGELOG.md
8
+ include CONTRIBUTING.md
9
+ include SECURITY.md
10
+ recursive-include docs *.md *.json
11
+ recursive-include examples *.json *.md *.yaml *.yml
12
+ recursive-include tests *.py