We give you the source code, so it's not exactly a secret :) It looks something like this:
WHERE Bug.ixProject IN (1, 2, 4, 5, 9, 11 .. )
You can generate that list of projects using a CProjectQuery like so:
CProjectQuery query = api.Project.NewProjectQuery()
query.ExcludeUnreadableWithin = true;
int[] ids = query.ListIds();
The unfortunately named ExcludeUnreadableWithin property means "don't include any projects within which I cannot read bugs". If what you're really after is writable, then use the ExcludeUnwritableWithin property.
Edit
These are not to be confused with ExcludeUnreadable and ExcludeUnwritable, which refer to the Project object itself, not Bugs within a project. For example,
Modifying the project name (sProject) requires write permission on the Project because you must be an admin.
Creating a bug in the project requires write permission within the project, not admin permissions