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

Introduce a simple datapolicy library #96097

Merged
merged 1 commit into from Nov 5, 2020
Merged

Conversation

rf232
Copy link
Contributor

@rf232 rf232 commented Nov 2, 2020

What type of PR is this?

/kind feature

What this PR does / why we need it:

The datapolicy fullfills the contracts needed to support the log
sanitization kep
(https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/1753-logs-sanitization)

The external types list is mostly a proof of concept now, and is open to
extension.

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

- [KEP]: https://github.com/kubernetes/enhancements/tree/59e5c698639a8489ee3808c13fc9526f746c5fc4/keps/sig-instrumentation/1753-logs-sanitization

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 2, 2020
@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Nov 2, 2020
@k8s-ci-robot k8s-ci-robot added the area/dependency Issues or PRs related to dependency changes label Nov 2, 2020
@rf232
Copy link
Contributor Author

rf232 commented Nov 2, 2020

/assign serathius
/assign 44past4

@serathius
Copy link
Contributor

Please review @PurelyApplied

@k8s-ci-robot k8s-ci-robot added area/kubectl sig/cli Categorizes an issue or PR as relevant to SIG CLI. labels Nov 2, 2020
"net/http"
"reflect"

"golang.org/x/oauth2"
Copy link
Contributor

Choose a reason for hiding this comment

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

Those two imports introduce additional dependecies to all components using component-base. To make review faster I would propose move handling of those types to separate PR.

return []string{"password", "token"}
case reflect.TypeOf(http.Cookie{}):
return []string{"token"}
case reflect.TypeOf(oauth2.Token{}):
Copy link
Contributor

Choose a reason for hiding this comment

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

Checking this way for type means that component-base will take on lot's of dependencies that are not related to it's functionallity. Is there a way that we could avoid this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the type checking to be purely on the strings, the dependencies are test only now, which would hopefully alleviate some of the concerns.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, working on strings feels fragile, since when building in bazel the resulting types are different than when i just did a go test on my local machine


// Verify returns a list of the datatypes embeded in the argument that can be
// considered sensitive w.r.t. to logging
func Verify(value interface{}) []string {
Copy link
Contributor

Choose a reason for hiding this comment

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

The reflect package can be very panicky. Consider adding a recover to this entry-point as a defensive measure against developer error.

Ideally, that would be linked to some metric that would provide enough information for us to correct any possible oversight, but metric / api changes are probably beyond the scope for this PR. Maybe just logging a warning for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack, will do that and leave a todo.

staging/src/k8s.io/component-base/logs/datapol/datapol.go Outdated Show resolved Hide resolved
staging/src/k8s.io/component-base/logs/datapol/datapol.go Outdated Show resolved Hide resolved
staging/src/k8s.io/component-base/logs/datapol/datapol.go Outdated Show resolved Hide resolved
@rf232 rf232 force-pushed the datapol branch 2 times, most recently from e38dcf6 to feed65c Compare November 3, 2020 15:10
@k8s-ci-robot k8s-ci-robot removed the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Nov 3, 2020
@k8s-ci-robot k8s-ci-robot added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Nov 4, 2020
@serathius
Copy link
Contributor

PTAL @PurelyApplied

@rf232 rf232 force-pushed the datapol branch 2 times, most recently from 099b2af to 073456a Compare November 4, 2020 16:59
@dashpole
Copy link
Contributor

dashpole commented Nov 4, 2020

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Nov 4, 2020
Copy link
Contributor

@PurelyApplied PurelyApplied left a comment

Choose a reason for hiding this comment

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

Other than an inconsistency nit, looks good to me.

@rf232
Copy link
Contributor Author

rf232 commented Nov 4, 2020

/retest

@rf232
Copy link
Contributor Author

rf232 commented Nov 5, 2020

/assign @pwittrock @sttts

The datapolicy fullfills the contracts needed to support the log
sanitization kep
(https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/1753-logs-sanitization)

The external types list is mostly a proof of concept now, and is open to
extension.
@rf232
Copy link
Contributor Author

rf232 commented Nov 5, 2020

/assign @serathius

On @serathius advice split out third party types from the CL to make merging easier, will do a follow up with just the additional types from thirdparty libraries

@serathius
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 5, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: PurelyApplied, rf232, serathius

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 5, 2020
@rf232
Copy link
Contributor Author

rf232 commented Nov 5, 2020

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/dependency Issues or PRs related to dependency changes area/kubectl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants