Hallo, ik wil de app opnieuw bouwen, inclusief enkele wijzigingen in een bestand om de zoekfunctie voor anonieme gebruikers uit te schakelen (meer dan alleen met css).
Kan iemand mij wat documentatie geven voor de syntaxis van deze hooks voor het from: & to: gedeelte?
- replace:
filename: "/var/www/discourse/app/assets/javascripts/discourse/app/components/search-menu.js"
from: /get classNames()/
to: |
if (!this.currentUser) {return false;} get classNames()
Discourse accepteert de syntaxis nu, maar aan het einde van de rebuild mislukt het met
Error: Parse Error at discourse/components/search-menu.gjs:88:7"
replace failed with the params {"filename"=>"/var/www/discourse/app/assets/javascripts/discourse/app/components/search-menu.gjs", "from"=>"/get classNames()/", "to"=>"if (!this.currentUser) {return false;} get classNames()\n"}
Bedankt dat u dat aangeeft. Om het duidelijk te maken, wat is de naam van de verborgen site-instelling? En schakelt het zoeken voor anonieme gebruikers volledig uit, of worden alleen de resultaten verborgen? Ik zoek naar een manier om toegang op controller-niveau te blokkeren, dus ik vraag me af of die instelling alleen voldoende is of dat er nog steeds aangepaste code nodig is.
Now the /search page is unreachable = great
Now the front end search button instantly returns : you’ve performed this action too many times = great
You may hide the search button with :
But the question is : is this thorough? Can anyone just create a simple session cookie to make it look like they are connected so that they can access the content of the site through searches?
More thorough but uncomplete solution :
The file is : /var/www/discourse/app/controllers/search_controller.rb
The modification : add “if current_user.present?” after “def show” and add an “end” at the bottom of the condition.
However I could not make it persistent after restart, so anybody is welcome to tell how to make it persistent after restart with the app.yml hooks after_code replace: feature.
Ik bedoel een niet-ingelogde gebruiker die een sessiecookie zou aanmaken om te doen alsof ze zijn ingelogd, maar misschien ga ik hier wat te ver, aangezien ik vermoed dat de currentUser-functie de sessiesleutel controleert.
" That would be a security issue. If you can achieve that make sure to report to HackerOne"
No, I am new to discourse, I cannot even quote properly , I was just asking, maybe there was some discourse engineer around ; anyway, we got our solution to this thread thanks to you Falco
maar aarzel niet om dit op controller-niveau te proberen:
/var/www/discourse/app/controllers/search_controller.rb
De wijziging: voeg 'if current_user.present?' toe na 'def show' en voeg een 'end' toe onderaan de voorwaarde.