T09 · Insecure Skill Coding Practices
- Location
lib/token_manager.py:125- Finding
Token cache opt-out does not prevent access-token persistence
- Content
View full analysis
8 else app_key } if save_token_cache(all_cache): print(f"[INFO] Token saved to global cache") ``` ### Technical Analysis The `use_cache` setting controls only whether ...[truncated 1997 chars]- Remediation
View remediation
8 else app_key, } save_token_cache(all_cache) ``` 3. When caching is disabled, avoid calling `load_token_cache()`, creating the cache directory, or writing any token-related file. 4. Add automated tests asserting that `EZVIZ_TOKEN_CACHE=0` causes no cache file or directory to be created or modified. 5. Add a regression test covering all documented false values: `0`, `false`, `no`, and `disable`. 6. Harden enabled caching by creating the cache directory with mode `0700`, validating ownership, rejecting symbolic links, and creating temporary files securely with `tempfile.mkstemp()` before atomic replacement. 7. Correct the documentation only after implementation and tests confirm that disabling caching truly prevents persistence. ]]>
