Skip to content

Commit

Permalink
Merge pull request #37330 from Al2Klimov/http-enough
Browse files Browse the repository at this point in the history
Omit "Accessing site insecurely via HTTP." warning if HTTP is secure enough
  • Loading branch information
szaimen authored Apr 18, 2023
2 parents 96e7eaf + ff02b07 commit e10e509
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
2 changes: 1 addition & 1 deletion core/js/setupchecks.js
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
});
}
} else {
} else if (!/(?:^(?:localhost|127\.0\.0\.1|::1)|\.onion)$/.exec(window.location.hostname)) {
messages.push({
msg: t('core', 'Accessing site insecurely via HTTP. You are strongly advised to set up your server to require HTTPS instead, as described in the {linkstart}security tips ↗{linkend}.')
.replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + tipsUrl + '">')
Expand Down
24 changes: 0 additions & 24 deletions core/js/tests/specs/setupchecksSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1954,30 +1954,6 @@ describe('OC.SetupChecks tests', function() {
});
});

it('should return a SSL warning if HTTPS is not used', function(done) {
protocolStub.returns('http');
var async = OC.SetupChecks.checkGeneric();

suite.server.requests[0].respond(200,
{
'X-XSS-Protection': '1; mode=block',
'X-Content-Type-Options': 'nosniff',
'X-Robots-Tag': 'noindex, nofollow',
'X-Frame-Options': 'SAMEORIGIN',
'X-Permitted-Cross-Domain-Policies': 'none',
'Referrer-Policy': 'no-referrer',
}
);

async.done(function( data, s, x ){
expect(data).toEqual([{
msg: 'Accessing site insecurely via HTTP. You are strongly advised to set up your server to require HTTPS instead, as described in the <a target="_blank" rel="noreferrer noopener" class="external" href="https://docs.example.org/admin-security">security tips ↗</a>.',
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
}]);
done();
});
});

it('should return an error if the response has no statuscode 200', function(done) {
var async = OC.SetupChecks.checkGeneric();

Expand Down

0 comments on commit e10e509

Please sign in to comment.