Skip to content

Guides: Add note on ActiveStorage URL security#40675

Merged
composerinteralia merged 1 commit intorails:masterfrom
NobodysNightmare:patch-2
Nov 25, 2020
Merged

Guides: Add note on ActiveStorage URL security#40675
composerinteralia merged 1 commit intorails:masterfrom
NobodysNightmare:patch-2

Conversation

@NobodysNightmare
Copy link
Contributor

This Pull Request is based on the response I received in #40462.

It might be non-obvious to users who are new to ActiveStorage, how access control to files is handled. While the "Avatar" example is innocent enough, other people might use ActiveStorage for invoices or other kinds of sensitive material. I think they should at least be made aware of the security model of these links so that they can decide whether they need to take further steps.

Further documentation?

I came to this problem from the opposite side: We are uploading files from an authenticated area, but they need to be publicly accessible. However, our authentication is enabled through a rack middleware based on the request path. So we actually had to allow access to a specific path, otherwise the files would not have been accessible.

Do you think it might make sense to add details on the URL's from which blobs would be served to the guides? Or would this be something that developers are supposed to find out on their own by inspecting the routes? (I can see arguments in both directions)

Copy link
Member

@composerinteralia composerinteralia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for following up with this addition to the documentation. Since this PR doesn't include other code changes, please add [ci skip] to the commit message to avoid running CI (otherwise it looks like the build is failing for unrelated reasons).

@NobodysNightmare NobodysNightmare force-pushed the patch-2 branch 2 times, most recently from d24507f to f2b6ed8 Compare November 25, 2020 06:47
It might be non-obvious to a user that's new to ActiveStorage, how access control
to files is handled.
@NobodysNightmare
Copy link
Contributor Author

Integrated your proposed change. CI is now passing (though I wasn't able to make it not run 🙄)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants