Skip to content

Additional checks for security concerns during Import YAML and Template process #1321

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 1 commit into from
Mar 8, 2017

Conversation

jwforres
Copy link
Member

@jwforres jwforres commented Mar 6, 2017

Also enables the ability to create cluster scoped resources from Import YAML

Implements https://trello.com/c/RCU304BD

@jwforres jwforres requested a review from spadgett March 6, 2017 21:54
@jwforres
Copy link
Member Author

jwforres commented Mar 6, 2017

@spadgett think this is ready for a first pass

@liggitt FYI

@@ -47,7 +47,7 @@
"angular-utf8-base64": "0.0.5",
"file-saver": "1.3.3",
"bootstrap-switch": "3.3.3",
"origin-web-common": "0.0.3"
"origin-web-common": "0.0.5"
Copy link
Member

Choose a reason for hiding this comment

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

Did you mean to bump this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, won't be able to create cluster resources without this.

Copy link
Member

Choose a reason for hiding this comment

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

Right of course :)

var clusterStrs = [];
_.each(clusterScopedResources, function(resource){
clusterStrs.push(humanizeKind(resource.kind));
});
Copy link
Member

Choose a reason for hiding this comment

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

Probably want to make sure there are no duplicates in case the same kind appears in the list twice. Also suggest _.map here.

var clusterStrs = _.uniq(_.map(clusterScopedResources, function(resource) {
  return humanizeKind(resource.kind);
}));

var roleBindingStrs = [];
_.each(roleBindingResources, function(resource){
_.each(resource.subjects, function(subject) {
var str = resource.roleRef.name + " to " + humanizeKind(subject.kind) + " ";
Copy link
Member

@spadgett spadgett Mar 6, 2017

Choose a reason for hiding this comment

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

The role name in this message I'm more worried about than the other. It might be a role created in the same YAML/template and sound harmless, but isn't. I'd just say it will add roles to subject-names.

@jwforres jwforres changed the title [WIP] Additional checks for security concerns during Import YAML and Template process Additional checks for security concerns during Import YAML and Template process Mar 7, 2017
@jwforres
Copy link
Member Author

jwforres commented Mar 7, 2017

@spadgett ok think this is ready for final review, added a uniq call for roleBindingStrs as well since its only showing the subjects now

@smarterclayton
Copy link
Contributor

smarterclayton commented Mar 7, 2017

Here's what I think the whitelist should be:

    * buildconfigs (aka 'bc')
    * builds
    * configmaps (aka 'cm')
    * daemonsets (aka 'ds')
    * deployments (aka 'deploy')
    * deploymentconfigs (aka 'dc')
    * endpoints (aka 'ep')
    * events (aka 'ev')
    * horizontalpodautoscalers (aka 'hpa')
    * imagestreamimages (aka 'isimage')
    * imagestreams (aka 'is')
    * imagestreamtags (aka 'istag')
    * ingresses (aka 'ing')
    * jobs
    * persistentvolumeclaims (aka 'pvc')
    * pods (aka 'po')
    * podtemplates
    * replicasets (aka 'rs')
    * replicationcontrollers (aka 'rc')
    * routes
    * secrets
    * serviceaccounts (aka 'sa')
    * services (aka 'svc')
    * statefulsets

If you're not in this list, you get warned

@jwforres
Copy link
Member Author

jwforres commented Mar 7, 2017

@spadgett added a second commit with the feedback from @smarterclayton

can you review those changes, and then i'll squash and rebuild the dist

@jwforres
Copy link
Member Author

jwforres commented Mar 7, 2017

I put the whitelist in Constants just in case someone yells, but I don't think I want to document it exists

@spadgett
Copy link
Member

spadgett commented Mar 7, 2017

Second commit looks good to me

@smarterclayton
Copy link
Contributor

Thank you for your tolerance of my opinions :)

…te process

Also enables the ability to create cluster scoped resources from Import YAML
@jwforres
Copy link
Member Author

jwforres commented Mar 8, 2017

[merge]

@openshift-bot
Copy link

Evaluated for origin web console merge up to fb82c39

@openshift-bot
Copy link

openshift-bot commented Mar 8, 2017

Origin Web Console Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_web_console/1145/) (Base Commit: d733d79)

@openshift-bot openshift-bot merged commit 295a6c8 into openshift:master Mar 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants