-
Notifications
You must be signed in to change notification settings - Fork 895
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BufFix] Redact data when printing secret in the node (#860)
# Description [BUG] [VSCode Extension] secrets in CustomConnection are not redacted when we print it Add connection secret to context credential list, so that all the secret which is printed during the flow run and node run will be redacted as **data_scrubbed**. local test result: for flow.dag: ![1698054488148](https://github.com/microsoft/promptflow/assets/39176492/a2e80fac-45bc-4912-bf1c-c4eade664c3b) flow run: ![1698054650556](https://github.com/microsoft/promptflow/assets/39176492/c80cfcc0-7d29-4af3-87b2-08326a8afbaa) node run: ![1698054591865](https://github.com/microsoft/promptflow/assets/39176492/881b87f2-ba13-48fe-80c5-4d88d3b8bfbb) # All Promptflow Contribution checklist: - [ ] **The pull request does not introduce [breaking changes].** - [ ] **CHANGELOG is updated for new features, bug fixes or other significant changes.** - [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).** - [ ] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#suggested-workflow).** ## General Guidelines and Best Practices - [ ] Title of the pull request is clear and informative. - [ ] There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, [see this page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [ ] Pull request includes test coverage for the included changes. --------- Co-authored-by: Min Shi <[email protected]>
- Loading branch information
Showing
4 changed files
with
82 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/promptflow/tests/test_configs/flows/print_secret_flow/flow.dag.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
inputs: | ||
key: | ||
type: string | ||
default: text | ||
outputs: | ||
output: | ||
type: string | ||
reference: ${print_secret.output} | ||
nodes: | ||
- name: print_secret | ||
type: python | ||
source: | ||
type: code | ||
path: print_secret.py | ||
inputs: | ||
connection: custom_connection | ||
text: ${inputs.key} |
11 changes: 11 additions & 0 deletions
11
src/promptflow/tests/test_configs/flows/print_secret_flow/print_secret.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import os | ||
|
||
from promptflow import tool | ||
from promptflow.connections import CustomConnection | ||
|
||
|
||
@tool | ||
def print_secret(text: str, connection: CustomConnection): | ||
print(connection["key1"]) | ||
print(connection["key2"]) | ||
return text |