-
Notifications
You must be signed in to change notification settings - Fork 2.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
Try #3: Support encrypted DNS txt records #1828
Conversation
/assign @njuettner |
/kind feature |
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.
Thank you for the PR @vsychov . I did a first pass at reviewing, but error handling and a few other things are a bit off and far from a good enough quality. I would suggest, if you are open to that, that you start refactoring the code following the guidelines that I gave.
In a nutshell:
- error handling according to go guidelines (no valid values when error, don't hide errors, etc.)
- comments that are useful to generate godocs
- use American English for all code.
Once a refactor is done I will proceed with a code review.
@Raffo, I made some code refactoring, fixed error handling, and crypto functions logic little bit, do you have any other comments? |
Hi @Raffo , is all good, or something more changes needed for merge it? |
Anything missing in this PR beside conflicts? I am really interested in this new feature. 😄 |
I fixed conflicts with master, do It need more changes for be merged, @Raffo? |
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.
@vsychov There are still many changes to be done, please check again that all errors are handled, comments are correct and that we do not mask possible errors. Generally speaking we also don't want to log and return err.
endpoint/crypto.go
Outdated
|
||
// EncryptText gzip input data and encrypts it using the supplied AES key | ||
func EncryptText(text string, aesKey []byte) (string, error) { | ||
block, _ := aes.NewCipher(aesKey) |
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.
There is a unhandled error here, please handle it.
endpoint/crypto.go
Outdated
data := []byte(text) | ||
data, err = compressData(data) | ||
if err != nil { | ||
log.Debugf("Failed to compress data based on the text %#v. Got error %#v.", text, err) |
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.
We don't want to log and return the error. If you need to add a message, please wrap the error.
endpoint/crypto.go
Outdated
data := []byte(text) | ||
data, err = compressData(data) |
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.
data := []byte(text) | |
data, err = compressData(data) | |
data, err = compressData([]byte(text)) |
endpoint/crypto.go
Outdated
return string(plaindata), nil | ||
} | ||
|
||
// Decompress gzip compressed data |
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.
code comment is wrong
// Decompress gzip compressed data | |
// decompressData gzip compressed data |
endpoint/crypto.go
Outdated
return b.Bytes(), nil | ||
} | ||
|
||
// Compress data by gzip, for minify data stored in registry |
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.
// Compress data by gzip, for minify data stored in registry | |
// compressData data by gzip, for minify data stored in registry |
endpoint/labels.go
Outdated
} | ||
return NewLabelsFromStringPlain(labelText) | ||
} | ||
|
||
// Serialize transforms endpoints labels into a external-dns recognizable format string |
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.
// Serialize transforms endpoints labels into a external-dns recognizable format string | |
// SerializePlain transforms endpoints labels into a external-dns recognizable format string |
endpoint/labels.go
Outdated
if err != nil { | ||
log.Debugf("Failed to encrypt the text %#v using the encryption key %#v. Got error %#v.", text, aesKey, err) | ||
} |
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.
This error is masked. This function should probably return an error.
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.
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.
@shcherbak, yes, I'm using this feature in a production with the Cloudflare provider since the moment of the PR creation. If you want I can publish a working Docker image for your convenience.
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.
@vsychov this is amazing, thank you
but i think will wait for official chart and image
nicely done, respect
@Raffo, fixed |
@Raffo Sorry for tagging you but it seems you need to approve this change. Is there any way you can look into this? We would like to use the txt-registry but don't want to expose any more information to the outside world. |
Any reason why this PR not merged yet? It is a very good new feature to not leak any data about your cluster |
@Raffo @njuettner Can we help in anything to merge this PR ? It fixes a huge security leak I think. Thanks |
@vsychov could you please change request change to review request? maybe this is the only issue here. |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
We still very much want this feature and it is already a PR, so please |
/remove-lifecycle stale |
Please don't merge remote master but fetch master and rebase your branch on top of master. |
Signed-off-by: Viacheslav Sychov <viacheslav.sychov@gmail.com>
Signed-off-by: Viacheslav Sychov <viacheslav.sychov@gmail.com>
@szuecs, I combined all commits into one and then rebased it onto the master branch. Previously, this was nearly impossible due to numerous conflicts in each commit. Hope now it's ok to merge? |
is there any reason why this PR not merged yet? @Raffo |
Sorry I am really on life support with time. I can't review this. @szuecs please feel free to merge this if you think it's good. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: szuecs, vsychov The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@vsychov thanks for your work and answers. Wow we just merged a PR from 2020, great to see that such old PRs are finally merged and improving the tool for everyone. |
@Raffo please take care of yourself |
@szuecs nicely done! It is time for pushing new tag, isn't it? :) Or talking seriously, when new release is planned? |
Hi guys,
I found few pull request about txt records encryption (#1314, #1115, #1538), that have conflicts now, or not merged.
This PR have latest PR (#1538) with resolved conflicts, hope it will help you to review and merge it.
Fixes #1825
Fixes #854
Checklist