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

log file generated has permission issue in ^6.4.0 #1213

Closed
lakshmikanthadn opened this issue Mar 15, 2022 · 2 comments · Fixed by #1141
Closed

log file generated has permission issue in ^6.4.0 #1213

lakshmikanthadn opened this issue Mar 15, 2022 · 2 comments · Fixed by #1141
Labels
invalid This doesn't seem right

Comments

@lakshmikanthadn
Copy link

lakshmikanthadn commented Mar 15, 2022

The log file generated does NOT have permmsions to read by any other users/applications.
This is happening in v6.4.x but works in v6.3.0

Breaking In v6.4.x
image

Works In v6.3.x
image

Our log shipper is broken. For now we have reverted back to v6.3.0.

@lamweili
Copy link
Contributor

lamweili commented Mar 15, 2022

Security Advisory GHSA-82v2-mx6x-wq7q | CVE-2022-21704 | CWE-708

For security, the default file permission from v6.4.0 onwards has changed from 0o644 to 0o600.
It is to prevent unauthorised users from reading logs that may contain sensitive information.


In your case, the log is created by root (implies your running node is under root) and thus, only accessible by root.
Only applications using root can access it. Applications using other accounts will not be able to access it.

  1. Either run the other applications, that needs to read the log, using the root account, or
  2. Manually specify the permission (such as 0o644) to be used through the mode options as listed in the fileAppender docs:
    const log4js = require('log4js');
    log4js.configure({
      appenders: {
        everything: { type: 'file', filename: 'all-the-logs.log', mode: 0o644 }
      },
      categories: {
        default: { appenders: [ 'everything' ], level: 'debug' }
      }
    });
    
    const logger = log4js.getLogger();
    logger.debug('I will be logged in all-the-logs.log');

@lamweili lamweili added the invalid This doesn't seem right label Mar 15, 2022
@lamweili
Copy link
Contributor

lamweili commented Mar 23, 2022

This is related to #1141.

In hindsight, probably should have used 7.x.x instead to not break things for existing users who uses the default file permissions.

I have updated the changelog (7010a7d) to have a more indicative warning now we are unable to go back in time.

My mistake.


For whoever might be reading this, to workaround the breaking change:

  1. Either run the other applications, that needs to read the log, using the same user account (due to 0o600), or
  2. Manually specify the permission (such as 0o644) to be used through the mode options as listed in the fileAppender docs.

@lamweili lamweili changed the title log file generated has permssion issue in 6.4.1 log file generated has permission issue in ^6.4.0 Apr 26, 2022
@lamweili lamweili closed this as not planned Won't fix, can't repro, duplicate, stale Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants