-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scrub secret vars #9733
Scrub secret vars #9733
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9733 +/- ##
==========================================
+ Coverage 88.09% 88.11% +0.01%
==========================================
Files 180 180
Lines 22546 22557 +11
==========================================
+ Hits 19863 19877 +14
+ Misses 2683 2680 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
bea03f4
to
638fbdb
Compare
638fbdb
to
a12e752
Compare
@dbeatty10 any reviewers available for this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nielspardon I looked at this along with @ChenyuLInx
The main question we have is regarding the test coverage. Could you take a look?
e3fb9c2
to
d3b3336
Compare
@@ -108,7 +108,7 @@ def _new_file(self, searched, name, match): | |||
class TestPartialParse(unittest.TestCase): | |||
def setUp(self) -> None: | |||
mock_project = MagicMock(RuntimeConfig) | |||
mock_project.cli_vars = "" | |||
mock_project.cli_vars = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChenyuLInx looks like you accidentally initialized this to a str but this should be a dict. I fixed it since it broke the tests with my changes.
63cb9c0
to
e687342
Compare
- Scrub secret vars in RequiredVarNotFoundError - Scrub secret vars in StateCheckVarsHash event - Scrub secret vars in run results
e687342
to
457fd68
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nielspardon Thanks a bunch for adding this!!!
} | ||
|
||
def test__run_results_scrubbing(self, project): | ||
results = run_dbt(["run", "--vars", "{DBT_ENV_SECRET_simple: abc, unused: def}"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we do both run and test at the same time?
resolves #7247
Problem
Currently, dbt only supports secret env variables and only scrubs the values of those secret env variables from log messages. Secret variables being provided via the
--vars
flag are not being scrubbed and the plaintext values appear in a couple of places.Solution
With this PR secret variables being provided via the
--vars
flag are also scrubbed just like env variables reusing the same prefix as for env variables.Checklist