• lukasza's avatar
    Malformed PortRange or ThirdPartyAuthConfig should trigger OnPolicyError. · 0d40d8ac
    lukasza authored
    Before this change a malformed value of RemoteAccessHostUdpPortRange policy
    (i.e. "123456-blah") was ignored and a default value was used.  Similarily for
    the 3 third-party-auth-config policies (RemoteAccessHostTokenUrl,
    ...TokenValidationUrl and ...TokenValidationCertificateIssuer) we were falling
    back to a secure default, but not reporting a policy error.  After this change
    such malformed values will trigger an OnPolicyError callback.
    
    Notes:
    - Guaranteeing that PolicyWatcher always returns valid policy values, removes
      the need for a "rejecting" Me2MeHostAuthenticatorFactory.
    - Moving PortRange and ThirdPartyAuthConfig to separate compilation units
      helps readability elsewhere + encourages better unit tests coverage.
    - Initially I tried to wrap all policies in a new ChromotingPolicies class,
      but eventually went back to prevalidating and passing base::DictionaryValue.
      - Arguments for using ChromotingPolicies:
        - Helps avoid overtesting in policy_watcher_unittests.cc (i.e. helps focus
          the tests on a single policy value).
      - Arguments for using base::DictionaryValue:
        - Minimizes changes.
        - Keeps things simple (as opposed to having to introduce a custom
          equivalent of optional<T> [nothing similar present in Chromium AFAICT]).
      - Neutral:
        - Strong-typing of ChromotingPolicies didn't help readability as much as I
          expected and hoped for.
    
    BUG=427513
    TEST=remoting_unittests
    
    Review URL: https://codereview.chromium.org/966433002
    
    Cr-Commit-Position: refs/heads/master@{#318910}
    0d40d8ac
port_range_unittest.cc 2.17 KB