Skip to content

Specific code for "The flag X must be used with extreme caution" #59818

@davidje13

Description

@davidje13

What is the problem this feature will solve?

When using (for example) --allow-child-process, NodeJS (correctly) warns that this can allow bypassing the --permission protection:

(node:16778) SecurityWarning: The flag --allow-child-process must be used with extreme caution. It could invalidate the permission model.
(Use node --trace-warnings ... to show where the warning was created)

This warning is good, but if the developer is still confident in their setup, it would be useful to be able to suppress it without suppressing other warnings. Currently the only way to suppress this warning is with --disable-warning=SecurityWarning, which is far too broad.

What is the feature you are proposing to solve the problem?

--disable-warning already accepts codes as well as types, but this particular warning has no code set:

process.emitWarning(
`The flag ${flag} must be used with extreme caution. ` +
'It could invalidate the permission model.', 'SecurityWarning');

I'm suggesting picking a suitable code for this warning and adding it as the third argument to that call, perhaps something like PERM0001 (though I don't know the naming convention for these codes).

What alternatives have you considered?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.

    Type

    No type

    Projects

    Status

    Awaiting Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions