Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure before actions run on root route #1482

Merged

Conversation

ebiven
Copy link
Contributor

@ebiven ebiven commented Sep 9, 2024

When using the recommended method for injecting a before filter into GoodJob the initial root route ignores that filter. In cases where someone is using that before filter to apply security they may want to return a non-301 response code for users who don't pass the authentication check.

For example someone may want to obfuscate that they're using GoodJob by returning a 404 from all GoodJob routes if the user is not logged in. Before this change users would receive the redirect from the root route, then get the 404, essentially "leaking" that the site is running GoodJob.

ebiven and others added 3 commits September 9, 2024 17:31
When using the recommended method for injecting a before filter into GoodJob the initial root route ignores that filter. In cases where someone is using that before filter to apply security they may want to return a non-301 response code for users who don't pass the authentication check.

For example someone may want to obfuscate that they're using GoodJob by returning a 404 from all GoodJob routes if the user is not logged in. Before this change users would receive the redirect from the root route, then get the 404, essentially "leaking" that the site is running GoodJob.
Live polling relies on a query string param with hits the root route. Ensure this param survives the redirect.
@bensheldon
Copy link
Owner

That's a fantastic observation about leaking info, and a great simple fix. Thank you!

I made one tweak: adding an index action to the ApplicationController would mean that every controller subclass would have an implicit index action, which would be less good. I moved the action to the JobsController; I'm not proud of the name, but it achieves the outcome 👍🏻

@bensheldon bensheldon added the bug Something isn't working label Sep 14, 2024
@bensheldon bensheldon merged commit 9783e3c into bensheldon:main Sep 14, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

Successfully merging this pull request may close these issues.

2 participants