Is the content API exposing private data? #4617
-
Bug DescriptionI've enabled the content API and in my api.php I've set
I then hit:
And all works, the problem is I'm seeing user data:
I'm new to Statamic so I'm confident I'm just doing something dumb. Help appreciated. EnvironmentStatamic 3.1.11 Pro This seems to be happening in dev and production with debug on or off. Install method (choose one):
|
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
I can see where you're coming from, you may not want user information to be exposed like that. I'm not sure if there's a way to disable |
Beta Was this translation helpful? Give feedback.
-
That's fair! What's happening is that the API will output everything that you'd be able to use in your templates. That's your blueprint fields, etc. You can set the We can work out more in depth control over those fields in the future. Or at least a simpler way to control excluding certain fields. |
Beta Was this translation helpful? Give feedback.
-
I think the problem here is that the docs don't show this or explain how to mitigate it. For example, someone following the docs might not be aware that this information is publicly available (even if they use a filter) Thanks for looking into it :) |
Beta Was this translation helpful? Give feedback.
-
Feel free to PR an update to the docs if you can find a place to add a note for it. 😄 Also, totally unrelated: nice to see a fellow 🏴 Scot on here. |
Beta Was this translation helpful? Give feedback.
-
Hey Folks, Isn't this a security flaw though? Shouldn't the api be unable to expose this data unless something is specifically set to do so? I'm worried that folk don't know their email address can be found this way. |
Beta Was this translation helpful? Give feedback.
-
mb its possible to add array in collection, like excluded keys/fields from content api? i want hide keys that doesnt refer to content |
Beta Was this translation helpful? Give feedback.
-
In #5041 you'll be able to add You could put |
Beta Was this translation helpful? Give feedback.
In #5041 you'll be able to add
excluded_keys
to yourconfig/statamic/api.php
config file, which will remove those fields from API responses.You could put
updated_by
in there.