Nakiami / mellivora

Mellivora is a CTF engine written in PHP
GNU General Public License v3.0
441 stars 171 forks source link

Fix for highlightSelectedMenuItem() to avoid sub/domain issues #94

Closed xassiz closed 6 years ago

xassiz commented 7 years ago

If the ctf URL contains any "menu word" (home, challenges, hints, scores, profile..), it will cause a wrong behaviour highlighting the menu.

e.g. "home.myctf.com" or "www.leet-challenges.net"

Using the [attribute$=value] JQuery selector fixes the issue.

jpnelson commented 6 years ago

@xassiz thanks for the PR! To help me understand, when would the domain contain the window.location.pathname? It'd need to contain /home, /challenges, etc which contain a / at the start. I can imagine the problem happening if the URL contained a different base path (like /challenges, for example) – is this what you mean?

xassiz commented 6 years ago

@jpnelson nope, I meant what I said: the domain could contain the window.location.pathname, since the whole URL (protocol as well ending with /) is included within href attributes (every link will match then).

e.g. https://challenges.yoursite.com/challenges

jpnelson commented 6 years ago

Makes sense!