As long as that environment has access to SonarCloud, it should work fine. We announced support for Codespaces about a year ago.
The only known limitation is the following (and I believe only relevant for SonarQube).
When running in Connected Mode with SonarQube 8.6 and above, and browsing a security hotspot, a button will be available offering to open the hotspot in SonarLint (with SonarLint already running in VSCode). Limitation: this feature relies on local communication between your web browser and SonarLint, and consequently is not available in some remote environments such as GitPod, or GitHub CodeSpaces.