Page MenuHomePhabricator

HTTP 500 error on page when attempting to use Visual Editor
Closed, InvalidPublic


For some reason, on this one specific page, I cannot use Visual Editor at all.

Clicking the pages "Edit", it generates a request to:

This request returns a HTTP 500 error code (pretty much instantly), and the following response:

    "type": "",
    "method": "get","
    "uri": "/"

The source code for the page is as follows:

[ Article source]

== Database ==
* Use encryption for data identifying users and any sensitive data like access tokens, email addresses or billing details.
* If your database supports low cost encryption at rest (like AWS Aurora), then enable that to secure data on disk. Make sure all backups are stored encrypted as well.
* Use minimal privilege for the database access user account. Don’t use the database root account.
* Store and distribute secrets using a key store designed for the purpose. Don’t hard code in your applications.
* Fully prevent SQL injection by only using SQL prepared statements. For example: if using NPM, don’t use npm-mysql, use npm-mysql2 which supports prepared statements.

== Development ==
* Ensure that all components of your software are scanned for vulnerabilities for every version pushed to production. This means O/S, libraries and packages. This should be automated into the CI-CD process.
* Secure development systems with equal vigilance to what you use for production systems. Build the software from secured, isolated development systems.

== Authentication ==
* Ensure all passwords are hashed using appropriate crypto such as bcrypt. Never write your own crypto and correctly initialize crypto with good random data.
* Implement simple but adequate password rules that encourage users to have long, random passwords.
* Use multi-factor authentication for your logins to all your service providers.

== Denial of Service Protection ==
* Make sure that DOS attacks on your APIs won’t cripple your site. At a minimum, have rate limiters on your slower API paths like login and token generation routines.
* Enforce sanity limits on the size and structure of user submitted data and requests.
* Use Distributed Denial of Service (DDOS) mitigation via a global caching proxy service like CloudFlare. This can be turned on if you suffer a DDOS attack and otherwise function as your DNS lookup.

== Web Traffic ==
* Use TLS for the entire site, not just login forms and responses. Never use TLS for just the login form.
* Cookies must be httpOnly and secure and be scoped by path and domain.
* Use CSP without allowing unsafe-* backdoors. It is a pain to configure, but worthwhile.
* Use X-Frame-Option, X-XSS-Protection headers in client responses
* Use HSTS responses to force TLS only access. Redirect all HTTP request to HTTPS on the server as backup.
* Use CSRF tokens in all forms and use the new SameSite Cookie response header which fixes CSRF once and for all newer browsers.

== APIs ==
* Ensure that no resources are enumerable in your public APIs.
* Ensure that users are fully authenticated and authorized appropriately when using your APIs.

== Validation ==
* Do client-side input validation for quick user feedback, but never trust it.
* Validate every last bit of user input using white lists on the server. Never directly inject user content into responses. Never use user input in SQL statements.

== Cloud Configuration ==
* Ensure all services have minimum ports open. While security through obscurity is no protection, using non-standard ports will make it a little bit harder for attackers.
* Host backend database and services on private VPCs that are not visible on any public network. Be very careful when configuring AWS security groups and peering VPCs which can inadvertently make services visible to the public.
* Isolate logical services in separate VPCs and peer VPCs to provide inter-service communication.
* Ensure all services only accept data from a minimal set of IP addresses.
* Restrict outgoing IP and port traffic to minimize APTs and “botification”.
* Always use AWS IAM roles and not root credentials.
* Use minimal access privilege for all ops and developer staff
* Regularly rotate passwords and access keys according to a schedule.

== Infrastructure ==
* Ensure you can do upgrades without downtime. Ensure you can quickly update software in a fully automated manner.
* Create all infrastructure using a tool such as Terraform, and not via the cloud console. Infrastructure should be defined as “code” and be able to be recreated at the push of a button. Have zero tolerance for any resource created in the cloud by hand — Terraform can then audit your configuration.
* Use centralized logging for all services. You should never need SSH to access or retrieve logs.
* Don’t SSH into services except for one-off diagnosis. Using SSH regularly, typically means you have not automated an important task.
* Don’t keep port 22 open on any AWS service groups on a permanent basis.
* Create immutable hosts instead of long-lived servers that you patch and upgrade. (See Immutable Infrastructure Can Be More Secure).
* Use an Intrusion Detection System like SenseDeep or service to minimize APTs.

== Operation ==
* Power off unused services and servers. The most secure server is one that is powered down.

== Test ==
* Audit your design and implementation.
* Do penetration testing — hack yourself, but also have someone other than you pen testing as well.

==  Have a Plan ==
* Have a threat model that describes what you are defending against. It should list and prioritize the possible threats and actors.
* Have a practiced security incident plan. One day, you will need it.

[[Category:Example Category]] and Example Category are placeholders for the real URL and category name.

Event Timeline

RESTbase logs from the event:

May 19 14:23:51 server node[30150]: {"name":"restbase","hostname":"server","pid":30170,"level":50,"message":"500","res":{"name":"HTTPError","message":"500","status":500,"headers":{"x-powered-by":"Express","access-control-allow-origin":"*","content-type":"application/json; charset=utf-8","etag":"W/\"62f-OESOT/35qxOAwhpiMdD7cw\"","vary":"Accept-Encoding","date":"Fri, 19 May 2017 14:23:51 GMT","cache-control":"private, max-age=0, s-maxage=0, must-revalidate","x-request-id":"c7d65029-3c9e-11e7-b07c-a2a0122fe1a9"},"body":{"error":"API response Error for TemplateRequest: request=; error={\"code\":\"rvaccessdenied\",\"info\":\"The current user is not allowed to read Security Checklist\",\"*\":\"See for API usage\"}\nError: API response Error for TemplateRequest: request=; error={\"code\":\"rvaccessdenied\",\"info\":\"The current user is not allowed to read Security Checklist\",\"*\":\"See for API usage\"}\n    at TemplateRequest.ApiRequest._errorObj (/usr/lib/parsoid/src/lib/mw/ApiRequest.js:346:9)\n    at TemplateRequest._handleJSON (/usr/lib/parsoid/src/lib/mw/ApiRequest.js:551:16)\n    at TemplateRequest.ApiRequest._handleBody (/usr/lib/parsoid/src/lib/mw/ApiRequest.js:473:7)\n    at TemplateRequest.ApiRequest._requestCB (/usr/lib/parsoid/src/lib/mw/ApiRequest.js:420:8)\n    at Request.self.callback (/usr/lib/parsoid/node_modules/request/request.js:186:22)\n    at emitTwo (events.js:106:13)\n    at Request.emit (events.js:191:7)\n    at Request.<anonymous> (/usr/lib/parsoid/node_modules/request/request.js:1081:10)\n    at emitOne (events.js:96:13)\n    at Request.emit (events.js:188:7)\n    at IncomingMessage.<anonymous> (/usr/lib/parsoid/node_modules/request/request.js:1001:12)\n    at IncomingMessage.g (events.js:291:16)\n    at emitNone (events.js:91:20)\n    at IncomingMessage.emit (events.js:185:7)\n    at endReadableNT (_stream_readable.js:974:12)\n    at _combinedTickCallback (internal/process/next_tick.js:80:11)\n    at process._tickCallback (internal/process/ne
May 19 14:23:51 server node[30150]: xt_tick.js:104:9)"},"requestName":"get_from_backend"},"stack":"HTTPError: 500\n    at Request.P.try.bind.then.err.retry.HTTPError.status (/home/wiki/restbase/node_modules/preq/index.js:254:23)\n    at Request.tryCatcher (/home/wiki/restbase/node_modules/bluebird/js/release/util.js:16:23)\n    at Promise._settlePromiseFromHandler (/home/wiki/restbase/node_modules/bluebird/js/release/promise.js:512:31)\n    at Promise._settlePromise (/home/wiki/restbase/node_modules/bluebird/js/release/promise.js:569:18)\n    at Promise._settlePromise0 (/home/wiki/restbase/node_modules/bluebird/js/release/promise.js:614:10)\n    at Promise._settlePromises (/home/wiki/restbase/node_modules/bluebird/js/release/promise.js:693:18)\n    at Promise._fulfill (/home/wiki/restbase/node_modules/bluebird/js/release/promise.js:638:18)\n    at Request._callback (/home/wiki/restbase/node_modules/bluebird/js/release/nodeback.js:45:21)\n    at Request.self.callback (/home/wiki/restbase/node_modules/request/request.js:186:22)\n    at emitTwo (events.js:106:13)\n    at Request.emit (events.js:191:7)\n    at Request.<anonymous> (/home/wiki/restbase/node_modules/request/request.js:1081:10)\n    at emitOne (events.js:96:13)\n    at Request.emit (events.js:188:7)\n    at Gunzip.<anonymous> (/home/wiki/restbase/node_modules/request/request.js:1001:12)\n    at Gunzip.g (events.js:291:16)","latency":111,"levelPath":"error/request","root_req":{"method":"get","uri":"/","headers":{"user-agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.47 Safari/537.36","x-client-ip":"::ffff:XXX.XXX.XXX.XXX","x-forwarded-for":"::ffff:XXX.XXX.XXX.XXX","x-request-id":"c7d65029-3c9e-11e7-b07c-a2a0122fe1a9","x-request-class":"external"}},"request_id":"c7d65029-3c9e-11e7-b07c-a2a0122fe1a9","msg":"500","time":"2017-05-19T14:23:51.443Z","v":0}

Appears that I am not allowed to read that page, even though I can and can modify it at will?

Note, I am using the IntraACL extension. Could that be causing this? Even though every other page is fine? (I created this page, and every other one too)

Pchelolo added a subscriber: Pchelolo.

Ok, we've figured it out. It's happening because it's a private Wiki that's not supported in RESTBase currently. Support is tracked in T88016