| | @@ -96,12 +96,14 @@ |
| 96 | 96 | */ |
| 97 | 97 | void secaudit0_page(void){ |
| 98 | 98 | const char *zAnonCap; /* Capabilities of user "anonymous" and "nobody" */ |
| 99 | 99 | const char *zPubPages; /* GLOB pattern for public pages */ |
| 100 | 100 | const char *zSelfCap; /* Capabilities of self-registered users */ |
| 101 | + int hasSelfReg = 0; /* True if able to self-register */ |
| 101 | 102 | char *z; |
| 102 | 103 | int n; |
| 104 | + CapabilityString *pCap; |
| 103 | 105 | char **azCSP; /* Parsed content security policy */ |
| 104 | 106 | |
| 105 | 107 | login_check_credentials(); |
| 106 | 108 | if( !g.perm.Admin ){ |
| 107 | 109 | login_needed(0); |
| | @@ -115,27 +117,23 @@ |
| 115 | 117 | ** "Private" repos require (non-anonymous) login to access all content, |
| 116 | 118 | ** though some content may be accessible anonymously. |
| 117 | 119 | */ |
| 118 | 120 | zAnonCap = db_text("", "SELECT fullcap(NULL)"); |
| 119 | 121 | zPubPages = db_get("public-pages",0); |
| 120 | | - if( db_get_boolean("self-register",0) ){ |
| 121 | | - CapabilityString *pCap; |
| 122 | | - pCap = capability_add(0, db_get("default-perms",0)); |
| 123 | | - capability_expand(pCap); |
| 124 | | - zSelfCap = capability_string(pCap); |
| 125 | | - capability_free(pCap); |
| 126 | | - }else{ |
| 127 | | - zSelfCap = fossil_strdup(""); |
| 128 | | - } |
| 122 | + hasSelfReg = db_get_boolean("self-register",0); |
| 123 | + pCap = capability_add(0, db_get("default-perms",0)); |
| 124 | + capability_expand(pCap); |
| 125 | + zSelfCap = capability_string(pCap); |
| 126 | + capability_free(pCap); |
| 129 | 127 | if( hasAnyCap(zAnonCap,"as") ){ |
| 130 | 128 | @ <li><p>This repository is <big><b>Wildly INSECURE</b></big> because |
| 131 | 129 | @ it grants administrator privileges to anonymous users. You |
| 132 | 130 | @ should <a href="takeitprivate">take this repository private</a> |
| 133 | 131 | @ immediately! Or, at least remove the Setup and Admin privileges |
| 134 | 132 | @ for users "anonymous" and "login" on the |
| 135 | 133 | @ <a href="setup_ulist">User Configuration</a> page. |
| 136 | | - }else if( hasAnyCap(zSelfCap,"as") ){ |
| 134 | + }else if( hasAnyCap(zSelfCap,"as") && hasSelfReg ){ |
| 137 | 135 | @ <li><p>This repository is <big><b>Wildly INSECURE</b></big> because |
| 138 | 136 | @ it grants administrator privileges to self-registered users. You |
| 139 | 137 | @ should <a href="takeitprivate">take this repository private</a> |
| 140 | 138 | @ and/or disable self-registration |
| 141 | 139 | @ immediately! Or, at least remove the Setup and Admin privileges |
| | @@ -154,43 +152,48 @@ |
| 154 | 152 | @ by disabling self-registration. |
| 155 | 153 | }else if( hasAnyCap(zAnonCap,"goz") ){ |
| 156 | 154 | @ <li><p>This repository is <big><b>PUBLIC</b></big>. All |
| 157 | 155 | @ checked-in content can be accessed by anonymous users. |
| 158 | 156 | @ <a href="takeitprivate">Take it private</a>.<p> |
| 159 | | - }else if( hasAnyCap(zSelfCap,"goz") ){ |
| 157 | + }else if( hasAnyCap(zSelfCap,"goz") && hasSelfReg ){ |
| 160 | 158 | @ <li><p>This repository is <big><b>PUBLIC</b></big> because all |
| 161 | 159 | @ checked-in content can be accessed by self-registered users. |
| 162 | 160 | @ This repostory would be private if you disabled self-registration.</p> |
| 163 | 161 | }else if( !hasAnyCap(zAnonCap, "jrwy234567") |
| 164 | | - && !hasAnyCap(zSelfCap, "jrwy234567") |
| 162 | + && (!hasSelfReg || !hasAnyCap(zSelfCap, "jrwy234567")) |
| 165 | 163 | && (zPubPages==0 || zPubPages[0]==0) ){ |
| 166 | 164 | @ <li><p>This repository is <big><b>Completely PRIVATE</b></big>. |
| 167 | 165 | @ A valid login and password is required to access any content. |
| 168 | 166 | }else{ |
| 169 | 167 | @ <li><p>This repository is <big><b>Mostly PRIVATE</b></big>. |
| 170 | 168 | @ A valid login and password is usually required, however some |
| 171 | 169 | @ content can be accessed either anonymously or by self-registered |
| 172 | 170 | @ users: |
| 173 | 171 | @ <ul> |
| 174 | | - if( hasAnyCap(zAnonCap,"j") || hasAnyCap(zSelfCap,"j") ){ |
| 175 | | - @ <li> Wiki pages |
| 176 | | - } |
| 177 | | - if( hasAnyCap(zAnonCap,"r") || hasAnyCap(zSelfCap,"r") ){ |
| 178 | | - @ <li> Tickets |
| 179 | | - } |
| 180 | | - if( hasAnyCap(zAnonCap,"234567") || hasAnyCap(zSelfCap,"234567") ){ |
| 181 | | - @ <li> Forum posts |
| 172 | + if( hasSelfReg ){ |
| 173 | + if( hasAnyCap(zAnonCap,"j") || hasAnyCap(zSelfCap,"j") ){ |
| 174 | + @ <li> Wiki pages |
| 175 | + } |
| 176 | + if( hasAnyCap(zAnonCap,"r") || hasAnyCap(zSelfCap,"r") ){ |
| 177 | + @ <li> Tickets |
| 178 | + } |
| 179 | + if( hasAnyCap(zAnonCap,"234567") || hasAnyCap(zSelfCap,"234567") ){ |
| 180 | + @ <li> Forum posts |
| 181 | + } |
| 182 | 182 | } |
| 183 | 183 | if( zPubPages && zPubPages[0] ){ |
| 184 | 184 | Glob *pGlob = glob_create(zPubPages); |
| 185 | 185 | int i; |
| 186 | | - @ <li> URLs that match any of these GLOB patterns: |
| 187 | | - @ <ul> |
| 186 | + @ <li> "Public Pages" are URLs that match any of these GLOB patterns: |
| 187 | + @ <p><ul> |
| 188 | 188 | for(i=0; i<pGlob->nPattern; i++){ |
| 189 | 189 | @ <li> %h(pGlob->azPattern[i]) |
| 190 | 190 | } |
| 191 | 191 | @ </ul> |
| 192 | + @ <p>Anoymous users are vested with capabilities "%h(zSelfCap)" on |
| 193 | + @ public pages. See the "Public Pages" entry in the |
| 194 | + @ "User capability summary" below. |
| 192 | 195 | } |
| 193 | 196 | @ </ul> |
| 194 | 197 | if( zPubPages && zPubPages[0] ){ |
| 195 | 198 | @ <p>Change GLOB patterns exceptions using the "Public pages" setting |
| 196 | 199 | @ on the <a href="setup_access">Access Settings</a> page.</p> |
| 197 | 200 | |