anchela commented on code in PR #571: URL: https://github.com/apache/jackrabbit-oak/pull/571#discussion_r875814622
########## oak-doc/src/site/markdown/security/authorization/bestpractices.md: ########## @@ -0,0 +1,316 @@ +<!-- + 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. +--> + +Best Practices for Authorization +-------------------------------------------------------------------------------- + +<!-- MACRO{toc} --> + +## Before you get started +### Threat Model + +Before you start coding, creating content or setting up access control set aside some time to consider what is needed +when it comes to securing your application (and what could go wrong). In other words: write a threat model and +make sure you keep updating it as you continue developing. + +The following references provide a good overview as well as guidance on how to build a threat model: + +- https://shostack.org/resources/whitepapers/threat-modeling-what-why-how +- https://owasp.org/www-community/Threat_Modeling +- https://owasp.org/www-community/Threat_Modeling_Process + +### Content Modelling + +As suggested in [Jackrabbbit Wiki](https://jackrabbit.apache.org/archive/wiki/JCR/DavidsModel_115513389.html#DavidsModel-Rule#2:Drivethecontenthierarchy,don'tletithappen) +the content hierarchy in your JCR repository should be designed and access control requirements tend to be a good driver. + +Make sure the content design allows for a readable and manageable access control setup later on to secure your data. +Excessive complexity is often a strong indicator for problems with your content model, making its security error prone +and difficult to reason about (and might ultimately might lead to issues with scaling). + +Here is an example of a access control setup (in Sling RepoInit language) illustrating why content with +different access requirements should be kept in separate trees and how complexity may yield undesired +effects (see also section 'Remember inheritance' below): + + # TO BE AVOIDED Review Comment: yep.... -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
