Skip to content

Commit

Permalink
codeql
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas ONeil <[email protected]>
  • Loading branch information
loneil committed Sep 11, 2024
1 parent a49d7e9 commit 979daf7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions oidc-controller/api/routers/oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,16 @@ async def get_authorize(request: Request, db: Database = Depends(get_db)):

# Create presentation_request to show on screen
try:
# Create presentation_request to show on screen
response = client.create_presentation_request(
ver_config.generate_proof_request()
)
except VariableSubstitutionError as e:
return JSONResponse(
status_code=http_status.HTTP_400_BAD_REQUEST,
content={"detail": str(e)},
content={
"detail": f"Variable substitution error: \
'{e.variable_name}' not found in substitution map."
},
)

pres_exch_dict = response.dict()
Expand Down
8 changes: 4 additions & 4 deletions oidc-controller/api/verificationConfigs/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
class VariableSubstitutionError(Exception):
"""Custom exception for if a variable is used that does not exist."""

pass
def __init__(self, variable_name: str):
self.variable_name = variable_name
super().__init__(f"Variable '{variable_name}' not found in substitution map.")


def replace_proof_variables(proof_req_dict: dict) -> dict:
Expand Down Expand Up @@ -35,9 +37,7 @@ def replace_proof_variables(proof_req_dict: dict) -> dict:
if v in variable_substitution_map:
proof_req_dict[k] = variable_substitution_map[v]()
else:
raise VariableSubstitutionError(
f"Variable '{v}' not found in substitution map."
)
raise VariableSubstitutionError(v)

# Base case: If the value is not a dict, list, or matching string, do nothing
return proof_req_dict

0 comments on commit 979daf7

Please sign in to comment.