Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: add cli option to preserve env vars on dr #55697

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RafaelGSS
Copy link
Member

This PR introduces a new cli flag --report-preserve-env to avoid writing env vars on diagnostic reports.

Some context: https://x.com/arthurfiorette/status/1848372069198614664

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Nov 2, 2024
@@ -105,6 +105,9 @@ const report = {

nr.setReportOnUncaughtException(trigger);
},
get preserveEnv() {
return !nr.shouldPreserveEnvironmentVariables();
Copy link
Member

Choose a reason for hiding this comment

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

Can this just be a constant exposed from C++ rather than a function?

Copy link
Member

Choose a reason for hiding this comment

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

Also I think this should be cached, if we are keeping it as it is.

Copy link
Member Author

Choose a reason for hiding this comment

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

We can cache it, yes, but at the moment this is only used inside our tests. That's why I just didn't care about it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll change it to a regular const. Possibly tomorrow.

@@ -170,6 +170,12 @@ static void ShouldReportOnUncaughtException(
env->isolate_data()->options()->report_uncaught_exception);
}

static void ShouldPreserveEnvironmentVariables(
Copy link
Member

Choose a reason for hiding this comment

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

Nit: a todo with a note of adding v8 fast api for this.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think there's a need for that now. See: #55697 (comment)

@RafaelGSS RafaelGSS added the semver-minor PRs that contain new features and should be released in the next minor version. label Nov 2, 2024
@richardlau
Copy link
Member

For consistency with --report-exclude-network I'd prefer if this was --report-exclude-env.

@RedYetiDev RedYetiDev added the report Issues and PRs related to process.report. label Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. report Issues and PRs related to process.report. semver-minor PRs that contain new features and should be released in the next minor version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants