Skip to content
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

functon which can redact device log fields #92

Merged
merged 5 commits into from
Jul 29, 2024

Conversation

eelco2k
Copy link
Contributor

@eelco2k eelco2k commented Jul 29, 2024

No description provided.

Copy link
Collaborator

@bobvandevijver bobvandevijver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! It is actually less important in the log (which should remain local as we no longer request people to use the CLI to create their requests), but it does need to be sanitized in the other driver where the settings are generated:

props.settings["deviceSpecification"] = JSON.stringify(

Can you add it there as well, and lets add the following fields as well. For my part you can make this the default list for the function, so we do not need to pass the same list twice.

  • owner_id
  • uid
  • uuid
  • local_key

…added same redacted function for other driver.
@eelco2k
Copy link
Contributor Author

eelco2k commented Jul 29, 2024

added your requests. But i did not use it as default list but as these fields always need to be redacted i combine the list with the incoming array of second param of the redactFields function. that way you cannot override and miss the ip,lat,lon etc. fields

@bobvandevijver bobvandevijver merged commit 307aeff into athombv:master Jul 29, 2024
1 check passed
@bobvandevijver
Copy link
Collaborator

Many thanks @eelco2k! I did find a small bug, but fixed that. Will be pushing a release with this soon.

@eelco2k
Copy link
Contributor Author

eelco2k commented Jul 29, 2024

perfect! I did not test the code so good you found that bugger 👍

@eelco2k
Copy link
Contributor Author

eelco2k commented Jul 29, 2024

does the line :
this.log('Device:', JSON.stringify(TuyaOAuth2Util.redactFields(device)));
not be:
this.log('Device:', JSON.stringify(TuyaOAuth2Util.redactFields(device.device)));

i'm not completely sure...? as the json has 2 keys, "device" and "specifications" ...

@bobvandevijver
Copy link
Collaborator

bobvandevijver commented Jul 29, 2024

No, that was actually the source of the bug. The JSON with two keys is not returned by Tuya, but constructed by us in the other driver.

const combinedSpecification = {

@eelco2k
Copy link
Contributor Author

eelco2k commented Jul 29, 2024

yes i understand, on the driver.js i understand, but i mean in the [lib/TuyaOAuth2Driver.js] file in the onPairListDevices() function. is it there also correct? if so. i have said nothing.. :)

@bobvandevijver
Copy link
Collaborator

The TuyaOAuth2Driver.js onPairListDevices function does not yet have the specification part (that is line 23), so yes, it is correct as it is now 👍🏻

@bobvandevijver bobvandevijver added the enhancement New feature or request label Aug 1, 2024
@bobvandevijver bobvandevijver added this to the Release 1.2.0 milestone Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

2 participants