-
Notifications
You must be signed in to change notification settings - Fork 233
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 sensitive data in request/response logs #2
Comments
Potentially related to work for #201 depending on if there is a more holistic approach to sensitive handling FWIW I do think its valuable to get raw request/response though in trace/debug logs, so this may be more effort than its worth. |
There is now a system in core related to scrubbing sensitive values in stdout that will be part of 0.14: https://www.hashicorp.com/blog/announcing-hashicorp-terraform-0-14-beta
For more specific sensitive handling enhancements, we should just open new specific issues. |
Allow plugin-go provider factories in acc tests
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Reopening this as there was some confusion. The Fundamentally, the issue at play here is that providers are writing values to stderr that they don't want written to stderr. This is a little bit on the SDK, for providing a logging transport that doesn't offer any controls for filtering, but provider developers can also just do the filtering themselves. The SDK is in a bit of an awkward position here, because it doesn't have the information the providers have about what fields it should consider sensitive, or what values to consider sensitive, and so would need to know about them to do any sort of filtering, realistically. Ideally this would be solved by us providing options for providers to filter log output, and having the SDK own the filtering implementation and the provider just configure it, or Terraform core can also filter log output (all the log output goes through it, anyways) and could in theory use the Sensitive schema marker to filter values from logs, or could ask the user or provider to configure its log filters. Fundamentally, I think this is blocked on the SDK team and the core team coming to a better understanding of the logging architecture we want to pursue in the future and the philosophy about who owns log output, Terraform or the providers. |
#695 lays out another step in the direction of enabling this, and calls this out as a future direction. If people have input on that, we're definitely interested in hearing it. |
There has been a lot of work to create the separate terraform-plugin-log Go module, which contains the Recent enhancements to the One starting caveat to using the Provider developers must ensure that any additional provider-defined configuration of the context, such as filtering, is done for each provider RPC. This means calls to the // Example log context configuration function. Other Go techniques can be used to
// deduplicate this logic as well, however this is shown to highlight the concept.
//
// This function could also handle advanced log configuration such as setting up
// additional log subsystems, etc. Pass the resource "meta" interface{} parameter
// (or its concrete type) to this function if provider-level data is needed.
func setupLogContext(ctx context.Context) context.Context {
// Example update to the context to add log filtering
ctx = tflog.MaskMessageStrings(ctx, "my-sensitive-value")
return ctx
}
// Example usage in create, etc. functionality
func resourceExampleThingCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
ctx = setupLogContext(ctx)
// ... other creation logic ...
}
func resourceExampleThingRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
ctx = setupLogContext(ctx)
// ... other read logic ...
} SDK-based simplification of this type of "context configuration" logic can be discussed and tracked in the feature request: #858 One additional edge case for this type of functionality within this SDK is the currently undocumented Since terraform-plugin-log functionality, once configured by provider developers, should cover this issue, I'm going to close it out. If there are specific bug reports or feature requests for the log filtering capabilities, please open an issue in the terraform-plugin-log issue tracker. If there are specific bug reports or feature requests with log configuration handling in this SDK, please open a new issue in the terraform-plugin-sdk issue tracker. If there are questions about provider logging or its configuration, please open a new topic in the Terraform Plugin SDK section of HashiCorp Discuss. Thanks. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
This will probably require further investigation (and possibly an RFC), but the high-level idea is that we could:
Authorization
,X-Auth-*
,X-*-Token
This is mainly about helper/logging which many providers already utilize today to log requests and responses:
https://github.com/hashicorp/terraform/tree/master/helper/logging
The text was updated successfully, but these errors were encountered: