Block auto-indexing of static assets more narrowly #8555
+12
−22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In c870cc3, we added rules to 404 instead of serving a 403 or auto-indexing on static asset directories in automate-ui and dex respectively. The regexes used are overly broad in that they cause any URIs ending in "dex" or "assets" to 4041 including unrelated API endpoints. For example, this is blocking us from publishing policyfiles named "index".
I'm not so familiar with these internals, but I believe it's sufficient to use regexes
^/dex/
and^/assets/
etc instead of.dex
and.assets
etc. I also blocked auto-indexing of two other static asset directories under dex (fonts
andfont-awesome-*
). I made a note that ideally dex itself should be handling this.I'll note that the 404s served at the loadbalancer look different than the 404s of underlying servers, so an attacker can still know they "hit" something. For example:
At least it doesn't auto-index, but I do question the integrity of this approach. As I stated above it should be handled by dex itself. I suspect there's a way to handle the automate-ui assets more elegantly as well.
🔩 Description: What code changed, and why?
Fix nginx 404 rules
⛓️ Related Resources
👍 Definition of Done
For us, the ability to publish policyfiles named "index"
👟 How to Build and Test the Change
curl assets and dex endpoints
✅ Checklist
All PRs must tick these:
With occasional exceptions, all PRs from Progress employees must tick these:
make spell
in any component directory)All PRs from Progress employees should tick these if appropriate:
Please add a note next to any checkbox above if you are NOT ticking it.
📷 Screenshots, if applicable
n/a
Footnotes
https://community.progress.com/s/article/Paths-or-URIs-ending-with-dex-or-assets-Lead-to-a-404-in-Chef-Automate ↩