Skip to content

Commit aaab53c

Browse files
semgrep config and mitigation
1 parent 2b735c6 commit aaab53c

File tree

6 files changed

+10
-6
lines changed

6 files changed

+10
-6
lines changed

noxfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def pytest(session):
2323
@nox.session(python=_DEFAULT_PYTHON)
2424
def semgrep_src(session):
2525
session.install("-e", ".[tests]")
26-
# session.run("semgrep", "scan", "--strict", "--verbose", "--junit-xml", "--junit-xml-output=semgrep-src.xml", "src")
27-
session.run("semgrep", "scan", "--strict", "--verbose", "src")
26+
# session.run("semgrep", "scan", "--strict", "--verbose", "--error", "--junit-xml", "--junit-xml-output=semgrep-src.xml", "src")
27+
session.run("semgrep", "scan", "--strict", "--verbose", "--error", "src")
2828

2929

3030
@nox.session(name="black-lint", python=_DEFAULT_PYTHON)

src/planet_auth/oidc/api_clients/authorization_api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import getpass
1616
import http.server
17-
import importlib.resources as pkg_resources
17+
import importlib.resources as pkg_resources # nosemgrep
1818

1919
from http import HTTPStatus
2020
from urllib.parse import urlparse, parse_qs, urlencode

src/planet_auth/oidc/multi_validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def _check_access_token(
225225
def _select_validator(self, token) -> Auth:
226226
# WARNING: Treat unverified token claims like toxic waste.
227227
# Nothing can be trusted until the token is verified.
228-
unverified_decoded_token = jwt.decode(token, options={"verify_signature": False})
228+
unverified_decoded_token = jwt.decode(token, options={"verify_signature": False}) # nosemgrep
229229
issuer = unverified_decoded_token.get("iss")
230230
if not issuer:
231231
# PyJWT does not seem to raise if the issuer is explicitly None, even when

src/planet_auth/oidc/request_authenticator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def _load(self):
6464
self._credential.load()
6565

6666
access_token_str = self._credential.access_token()
67-
unverified_decoded_atoken = jwt.decode(access_token_str, options={"verify_signature": False})
67+
unverified_decoded_atoken = jwt.decode(access_token_str, options={"verify_signature": False}) # nosemgrep
6868
iat = unverified_decoded_atoken.get("iat") or 0
6969
exp = unverified_decoded_atoken.get("exp") or 0
7070
# refresh at the 3/4 life

src/planet_auth/planet_legacy/auth_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def _parse_json_response(response, json_response):
149149

150150
# The token is signed with a symmetric key. The client does not
151151
# possess this key, and cannot verify the JWT.
152-
decoded_jwt = jwt.decode(token_jwt, options={"verify_signature": False})
152+
decoded_jwt = jwt.decode(token_jwt, options={"verify_signature": False}) # nosemgrep
153153
api_key = decoded_jwt.get("api_key")
154154
if not api_key:
155155
raise PlanetLegacyAuthClientException(

src/planet_auth_utils/builtins.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ def _load_builtins_worker(builtin_provider_fq_class_name, log_warning=False):
6363

6464
def _load_builtins() -> BuiltinConfigurationProviderInterface:
6565
# Highest priority : injected
66+
# WARNING: This environment variable is highly sensitive.
67+
# Undermining it can undermine client or service security.
68+
# It is a convenience for seamless developer experience, but maybe
69+
# we should not be so eager to please.
6670
builtin_provider = _load_builtins_worker(os.getenv(EnvironmentVariables.AUTH_BUILTIN_PROVIDER))
6771
if builtin_provider:
6872
return builtin_provider

0 commit comments

Comments
 (0)