Skip to content

Potential fix for code scanning alert no. 48: Information exposure through an exception - #14364

Open
frode-aarstad wants to merge 1 commit into
mainfrom
alert-autofix-48
Open

Potential fix for code scanning alert no. 48: Information exposure through an exception#14364
frode-aarstad wants to merge 1 commit into
mainfrom
alert-autofix-48

Conversation

@frode-aarstad

Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/equinor/ert/security/code-scanning/48

Use a generic, non-sensitive error message for both:

  1. experiment_state.status.message
  2. API response {"error": ...}

Keep detailed diagnostics in server logs using logger.exception(...) inside the except block. This preserves functionality (request still fails and is reported as failed) without exposing internal exception details to clients.

In src/ert/dark_storage/endpoints/experiment_server.py, update only the except Exception as e: block in start_experiment:

  • Introduce a constant/local string like "Could not start experiment due to an internal error."
  • Set experiment_state.status.message to that string (instead of interpolating e)
  • Return JSONResponse({"error": generic_message}, status_code=501) (instead of interpolating e)
  • Keep server-side logging with .exception(...) so developers still get stack traces.

No new imports or dependencies are required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…rough an exception

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@frode-aarstad frode-aarstad self-assigned this Sep 3, 2026
@frode-aarstad frode-aarstad moved this to Fast Track in SCOUT Sep 3, 2026
@frode-aarstad
frode-aarstad marked this pull request as ready for review September 3, 2026 11:25

@tbwiik tbwiik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm:) (after check is fixed)

@github-project-automation github-project-automation Bot moved this from Fast Track to Reviewed in SCOUT Sep 4, 2026
@tbwiik

tbwiik commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Flaky gh actions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Reviewed

Development

Successfully merging this pull request may close these issues.

2 participants