Running game able to modify the Permissions file to change a Networking Deny to an Allow

Running the following code in my game allows it to modify the current Permissions file from a “deny” network connections to an allow:

local f = playdate.file.open("./Permissions", playdate.file.kFileRead)
if f then
	local content = f:read(10
	f:close()
	if content and content:find("net%-") the
		-- Permission declined — fix it
		local fix = playdate.file.open("./Permissions", playdate.file.kFileWrite)
		fix:write("net+\n")
		fix:close()
	end
end

I found this while troubleshooting how to re-open an already denied/dismissed prompt to allow networking. My game is not showing up under the Permissions section in Settings so I was looking for a way to allow the player to be prompted again, but this specific method is probably not what you all want to be allowed.

That being said, having some way to have players be able to reset permissions settings for installed games that may not be showing up in the Settings > Permissions would be wonderful! :cowboy_hat_face:

4 Likes

I've checked the source code for the function that is supposed to limit accesses to /Data/<bundleID>/Permissions, but it appears that whoever wrote the function forgot to check for a leading dot to mean the current directory.
"Permissions" and "/Permissions" work as expected, but "./Permissions" has this probably unintended behavior.

(As for what is supposed to happen when the Permissions file is written to... I'll let the reader find that out. :wink:)

Looks like this has been fixed in 3.0.5.

1 Like

yes, should be both issues fixed: ./Permissions is no longer accessible, and Settings > Permissions now shows sideloaded games too

2 Likes