Skip to content

Commit

Permalink
No longer show the version number in the public
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepDiver1975 committed Mar 27, 2017
1 parent 0fa9553 commit 0b02b10
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
6 changes: 6 additions & 0 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@
*/
'version' => '',

/**
* While hardening an ownCloud instance hiding the version information in status.php
* can be a legitim step. Please condult the documentation before enabling this.
*/
'version.hide' => false,

/**
* Identifies the database used with this installation. See also config option
* ``supportedDatabases``
Expand Down
5 changes: 5 additions & 0 deletions core/js/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
*
*/

if (OC_User::getUser() === null) {
header('HTTP/1.0 401 Unauthorized');
return;
}

// Set the content type to Javascript
header("Content-type: text/javascript");

Expand Down
2 changes: 2 additions & 0 deletions lib/private/OCS/CoreCapabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

use OCP\Capabilities\ICapability;
use OCP\IConfig;
use OCP\Util;

/**
* Class Capabilities
Expand Down Expand Up @@ -52,6 +53,7 @@ public function getCapabilities() {
'core' => [
'pollinterval' => $this->config->getSystemValue('pollinterval', 60),
'webdav-root' => $this->config->getSystemValue('webdav-root', 'remote.php/webdav'),
'status' => Util::getStatusInfo(),
]
];
}
Expand Down
16 changes: 12 additions & 4 deletions lib/public/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -722,10 +722,18 @@ public static function getStatusInfo() {
'installed'=> $installed ? 'true' : 'false',
'maintenance' => $maintenance ? 'true' : 'false',
'needsDbUpgrade' => self::needUpgrade() ? 'true' : 'false',
'version' => implode('.', self::getVersion()),
'versionstring' => \OC_Util::getVersionString(),
'edition' => \OC_Util::getEditionString(),
'productname' => $defaults->getName()];
'version' => '',
'versionstring' => '',
'edition' => '',
'productname' => ''];

if ((bool) $systemConfig->getValue('version.hide', false) === false) {
$values['version'] = implode('.', self::getVersion());
$values['versionstring'] = \OC_Util::getVersionString();
$values['edition'] = \OC_Util::getEditionString();
$values['productname'] = $defaults->getName();
}

return $values;
}
}

0 comments on commit 0b02b10

Please sign in to comment.