SKY-L011 · Logic and resilience
Disabled security control
Code that switches off a protection a library gives by default. Examples are certificate checks (verify=False), CSRF protection (@csrf_exempt), login (@login_not_required), and framework settings such as DEBUG = True or cookies that may travel over plain HTTP.
- Languages
- Python
- Quality gate
- counted toward the gate limits (full and diff scans)
- Finding type
- review
Why it matters
With verify=False the client accepts any certificate, so anyone on the network path (a hotel Wi-Fi, a compromised proxy) can read the traffic and change the rates the service returns. Such switches are often added to get past a local error and then shipped.
What Skylos flags
"""Client for the internal exchange-rate service.""" import requests RATES_URL = "https://rates.internal.example.com" def fetch_rates(currency): response = requests.get( f"{RATES_URL}/rates/{currency}", timeout=10, headers={"Accept": "application/json"}, verify=False, ) response.raise_for_status() return response.json()What Skylos leaves alone
"""Client for the internal exchange-rate service.""" import requests RATES_URL = "https://rates.internal.example.com"CA_BUNDLE = "/etc/ssl/certs/internal-ca.pem" def fetch_rates(currency): response = requests.get( f"{RATES_URL}/rates/{currency}", timeout=10, headers={"Accept": "application/json"}, verify=CA_BUNDLE, ) response.raise_for_status() return response.json()Why Skylos leaves it alone
verify is set, but to the path of a CA bundle, so certificates are still checked against the company's own certificate authority. Skylos only reports the literal value False.
How Skylos decides
- Runs with
--qualityon Python files. Skips test files (test_*.py,*_test.pyandconftest.py). - Reports HIGH, on the value, for a keyword argument
verify=Falseorcheck_hostname=Falsein any call, and for a call to_create_unverified_context(). - Reports HIGH for a function decorated with
@csrf_exemptor@login_not_required, and for anALLOWED_HOSTSlist that contains"*". - Reports MEDIUM for a plain assignment of
DEBUG = True, or ofFalsetoSESSION_COOKIE_SECURE,CSRF_COOKIE_SECURE,SESSION_COOKIE_HTTPONLY,CSRF_COOKIE_HTTPONLY,WTF_CSRF_ENABLED,JWT_VERIFYorJWT_VERIFY_EXPIRATION. - Only literal values count:
verify=settings.VERIFY_TLSorDEBUG = os.environ.get("DEBUG") == "1"is not reported.
How to fix it
Keep certificate checks on. When a service uses a private certificate authority, pass its CA bundle to verify (or set REQUESTS_CA_BUNDLE) instead of turning verification off.
"""Client for the internal exchange-rate service.""" import requests RATES_URL = "https://rates.internal.example.com" def fetch_rates(currency): response = requests.get( f"{RATES_URL}/rates/{currency}", timeout=10, headers={"Accept": "application/json"},Removed: verify=False, ) response.raise_for_status() return response.json()When it can be wrong
- Any keyword named
verifyset toFalseis reported, even when it has nothing to do with TLS, such as averify=Falseflag on your own function. DEBUG = Truein a settings file used only for local development is reported.- It misses the same switches when the value comes from a variable or the environment.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
Put the marker on the line that holds
False(for a decorator, the decorator line).Python verify=False, # skylos: ignore[SKY-L011] local test server only[tool.skylos] ignore = ["SKY-L011"]turns the rule off for the project.