brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahgittin <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Add recursive sanitation and move...
Date Tue, 10 Mar 2015 15:51:17 GMT
Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/546#discussion_r26134307
  
    --- Diff: core/src/main/java/brooklyn/entity/basic/Sanitizer.java ---
    @@ -0,0 +1,152 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package brooklyn.entity.basic;
    +
    +import java.util.List;
    +import java.util.Map;
    +import java.util.Set;
    +
    +import brooklyn.util.config.ConfigBag;
    +
    +import com.google.api.client.util.Lists;
    +import com.google.common.base.Predicate;
    +import com.google.common.collect.ImmutableList;
    +import com.google.common.collect.Maps;
    +import com.google.common.collect.Sets;
    +
    +public final class Sanitizer {
    +
    +    /**
    +     * Names that, if they appear anywhere in an attribute/config/field
    +     * indicates that it may be private, so should not be logged etc.
    +     */
    +    public static final List<String> SECRET_NAMES = ImmutableList.of(
    +            "password", 
    +            "passwd", 
    +            "credential", 
    +            "secret", 
    +            "private",
    +            "access.cert", 
    +            "access.key");
    +    
    +    public static final Predicate<Object> IS_SECRET_PREDICATE = new Predicate<Object>()
{
    --- End diff --
    
    note there are `StringPredicates` and `StringFunctions` including `toLowerCase` and `containsLiteral`
which you can combine, but lists are especially tedious so i wouldn't try a pure functional
build-up ... however if this logic is needed elsewhere might be worth moving the body there
as a static method `Predicate<Object> containsAnyLiteralIgnoringCase(Iterable<String>)`
    
    not needed for this PR, just wanted to point you at those classes


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message