-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Issue UI: redact private data like (user, locations, ...) #25039
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
Merged
Merged
Changes from 15 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
1501b8b
Initial plan
Copilot 0101e2e
Add private data masking support for bug reporter
Copilot 5a99f81
Add e2e test for private data redaction in device configs
Copilot 7e86b2c
Refine e2e test for better compatibility
Copilot 8de4b86
Address feedback: keep host/ip public, mark ski as private
Copilot f1a77b5
Fix e2e test: use semantic selectors and Shelly meter for private dat…
Copilot f3dac0a
Mark lat/lon as private and accesstoken/refreshtoken as masked
Copilot 255f464
Use simulator for Shelly meter test in issue.spec.ts
Copilot e9fbe56
Improve comment style in Param struct
Copilot a0686b8
Remove advanced settings toggle and fix comment style
Copilot 4b95c7e
fix test
naltatis 7046787
clean
naltatis 4aea91b
remove redundancy; use template params also for yaml redact
naltatis d6d19ef
Merge branch 'master' into copilot/mask-private-data-in-bug-reporter
naltatis d1086b6
fmt
naltatis d2b7e09
wip
andig 050273c
minimize diff; shorten fixed values
naltatis ef386cf
Simplify
andig abe5330
wip
andig 86f2017
Apply suggestion from @andig
andig 9bb2ab1
pin > mask
naltatis e05abf9
lint
naltatis c6ea580
Merge branch 'master' into copilot/mask-private-data-in-bug-reporter
naltatis d91a4ea
fix assertion; adjust test
naltatis 28789a6
unmask token for e2e test
naltatis 96a63f9
adjust e2e example
naltatis 3e75079
Simplify
andig File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,9 +1,18 @@ | ||
| import { test, expect } from "@playwright/test"; | ||
| import { start, stop, restart, baseUrl } from "./evcc"; | ||
| import { startSimulator, stopSimulator, simulatorHost } from "./simulator"; | ||
| import { enableExperimental, expectModalVisible, expectModalHidden } from "./utils"; | ||
|
|
||
| test.use({ baseURL: baseUrl() }); | ||
|
|
||
| test.beforeAll(async () => { | ||
| await startSimulator(); | ||
| }); | ||
|
|
||
| test.afterAll(async () => { | ||
| await stopSimulator(); | ||
| }); | ||
|
|
||
| test.afterEach(async () => { | ||
| await stop(); | ||
| }); | ||
|
|
@@ -47,16 +56,18 @@ test.describe("issue creation", () => { | |
| // Enable experimental features | ||
| await enableExperimental(page, false); | ||
|
|
||
| // Create a battery meter | ||
| await page.getByRole("button", { name: "Add solar or battery" }).click(); | ||
| await page.getByRole("button", { name: "Add battery meter" }).click(); | ||
| // Create a Shelly meter with username (to test private data redaction) | ||
| await page.getByRole("button", { name: "Add grid meter" }).click(); | ||
| const meterModal = page.getByTestId("meter-modal"); | ||
| await expectModalVisible(meterModal); | ||
| await meterModal.getByLabel("Title").fill("BigBlueBattery"); | ||
| await meterModal.getByLabel("Manufacturer").selectOption("Demo battery"); | ||
| await meterModal.getByLabel("Manufacturer").selectOption("Shelly 1PM"); | ||
| await meterModal.getByLabel("IP address or hostname").fill(simulatorHost()); | ||
| await meterModal.getByLabel("Username").fill("[email protected]"); | ||
| await meterModal.getByLabel("Password").fill("secretpass"); | ||
|
|
||
| await meterModal.getByRole("button", { name: "Validate & save" }).click(); | ||
| await expectModalHidden(meterModal); | ||
| await expect(page.getByTestId("battery")).toBeVisible(); | ||
| await expect(page.getByTestId("grid")).toBeVisible(); | ||
|
|
||
| // Restart to apply changes | ||
| await restart(CONFIG); | ||
|
|
@@ -77,7 +88,7 @@ test.describe("issue creation", () => { | |
| .fill("This is a test issue created from the config page workflow"); | ||
| await page | ||
| .getByLabel("Steps to reproduce") | ||
| .fill("1. Go to config\n2. Enable experimental\n3. Add battery\n4. Report issue"); | ||
| .fill("1. Go to config\n2. Enable experimental\n3. Add meter\n4. Report issue"); | ||
|
|
||
| // check yaml data | ||
| const yamlItem = page.getByTestId("issueYamlConfig-additional-item"); | ||
|
|
@@ -88,12 +99,19 @@ test.describe("issue creation", () => { | |
| await yamlModal.getByRole("button", { name: "Close" }).first().click(); | ||
| await expectModalHidden(yamlModal); | ||
|
|
||
| // check ui data | ||
| // check ui data and verify private data redaction | ||
| const uiItem = page.getByTestId("issueUiConfig-additional-item"); | ||
| await uiItem.getByRole("button", { name: "show details" }).click(); | ||
| const uiModal = page.getByTestId("issueUiConfig-modal"); | ||
| await expectModalVisible(uiModal); | ||
| await expect(uiModal.getByRole("textbox")).toHaveValue(/BigBlueBattery/); | ||
| const uiContent = await uiModal.getByRole("textbox").inputValue(); | ||
|
|
||
| // Verify meter is present but private data is redacted | ||
| expect(uiContent).toContain("shelly"); // meter type should be visible | ||
| expect(uiContent).not.toContain("[email protected]"); // user should be redacted | ||
| expect(uiContent).not.toContain("secretpass"); // password should be redacted | ||
| expect(uiContent).toContain("***"); // redaction marker should be present | ||
|
|
||
| await uiModal.getByRole("button", { name: "Close" }).first().click(); | ||
| await expectModalHidden(uiModal); | ||
|
|
||
|
|
@@ -133,7 +151,7 @@ test.describe("issue creation", () => { | |
| await expect(textarea).toBeVisible(); | ||
| const textareaContent = await textarea.inputValue(); | ||
| expect(textareaContent).toContain("carport_pv"); // from evcc.yaml | ||
| expect(textareaContent).toContain("BigBlueBattery"); // from ui config | ||
| expect(textareaContent).toContain("shelly"); // from ui config | ||
| expect(textareaContent).toContain("DEBUG"); // from logs | ||
| expect(textareaContent).toContain('"telemetry":'); // from state | ||
|
|
||
|
|
@@ -142,7 +160,7 @@ test.describe("issue creation", () => { | |
| .getByRole("link", { name: "Create GitHub Issue" }) | ||
| .getAttribute("href"); | ||
| expect(href).toContain("https://github.com/evcc-io/evcc/issues/new?title=Kaboom&body="); | ||
| expect(href).not.toContain("BigBlueBattery"); // from ui config | ||
| expect(href).not.toContain("TestShelly"); // from ui config | ||
| expect(href).not.toContain("carport_pv"); // from evcc.yaml | ||
|
|
||
| // close modal | ||
|
|
@@ -167,7 +185,7 @@ test.describe("issue creation", () => { | |
| .getByRole("link", { name: "Create GitHub Issue" }) | ||
| .getAttribute("href"); | ||
| expect(href).toContain("https://github.com/evcc-io/evcc/issues/new?title=Kaboom&body="); | ||
| expect(href).toContain("BigBlueBattery"); // from ui config | ||
| expect(href).toContain("shelly"); // from ui config | ||
| expect(href).toContain("carport_pv"); // from evcc.yaml | ||
| expect(href).toContain("DEBUG"); // from logs | ||
| expect(href).toContain("MyFancyState"); // from state | ||
|
|
||
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Du meinst
slices.ContainsFunc;)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.
Siehe