@@ -1612,7 +1612,9 @@ function fdatasync(fd, callback) {
16121612 const req = new FSReqCallback ( ) ;
16131613 req . oncomplete = callback ;
16141614
1615- if ( permission . isEnabled ( ) ) {
1615+ // TODO(rafaelgss): publish a diagnostics channel event for fd-based APIs in
1616+ // audit mode.
1617+ if ( permission . isEnabled ( ) && ! permission . isAuditMode ( ) ) {
16161618 callback ( new ERR_ACCESS_DENIED ( 'fdatasync API is disabled when Permission Model is enabled.' ) ) ;
16171619 return ;
16181620 }
@@ -1633,7 +1635,7 @@ function fdatasyncSync(fd) {
16331635 if ( result !== undefined ) return ;
16341636 }
16351637
1636- if ( permission . isEnabled ( ) ) {
1638+ if ( permission . isEnabled ( ) && ! permission . isAuditMode ( ) ) {
16371639 throw new ERR_ACCESS_DENIED ( 'fdatasync API is disabled when Permission Model is enabled.' ) ;
16381640 }
16391641 binding . fdatasync ( fd ) ;
@@ -1654,7 +1656,7 @@ function fsync(fd, callback) {
16541656
16551657 const req = new FSReqCallback ( ) ;
16561658 req . oncomplete = callback ;
1657- if ( permission . isEnabled ( ) ) {
1659+ if ( permission . isEnabled ( ) && ! permission . isAuditMode ( ) ) {
16581660 callback ( new ERR_ACCESS_DENIED ( 'fsync API is disabled when Permission Model is enabled.' ) ) ;
16591661 return ;
16601662 }
@@ -1674,7 +1676,7 @@ function fsyncSync(fd) {
16741676 if ( result !== undefined ) return ;
16751677 }
16761678
1677- if ( permission . isEnabled ( ) ) {
1679+ if ( permission . isEnabled ( ) && ! permission . isAuditMode ( ) ) {
16781680 throw new ERR_ACCESS_DENIED ( 'fsync API is disabled when Permission Model is enabled.' ) ;
16791681 }
16801682 binding . fsync ( fd ) ;
@@ -2455,7 +2457,7 @@ function fchmod(fd, mode, callback) {
24552457 const h = vfsState . handlers ;
24562458 if ( h !== null && vfsVoid ( h . fchmod ( fd , mode ) , callback ) ) return ;
24572459
2458- if ( permission . isEnabled ( ) ) {
2460+ if ( permission . isEnabled ( ) && ! permission . isAuditMode ( ) ) {
24592461 callback ( new ERR_ACCESS_DENIED ( 'fchmod API is disabled when Permission Model is enabled.' ) ) ;
24602462 return ;
24612463 }
@@ -2480,7 +2482,7 @@ function fchmodSync(fd, mode) {
24802482 if ( result !== undefined ) return ;
24812483 }
24822484
2483- if ( permission . isEnabled ( ) ) {
2485+ if ( permission . isEnabled ( ) && ! permission . isAuditMode ( ) ) {
24842486 throw new ERR_ACCESS_DENIED ( 'fchmod API is disabled when Permission Model is enabled.' ) ;
24852487 }
24862488 binding . fchmod ( fd , mode ) ;
@@ -2631,7 +2633,7 @@ function fchown(fd, uid, gid, callback) {
26312633 const h = vfsState . handlers ;
26322634 if ( h !== null && vfsVoid ( h . fchown ( fd ) , callback ) ) return ;
26332635
2634- if ( permission . isEnabled ( ) ) {
2636+ if ( permission . isEnabled ( ) && ! permission . isAuditMode ( ) ) {
26352637 callback ( new ERR_ACCESS_DENIED ( 'fchown API is disabled when Permission Model is enabled.' ) ) ;
26362638 return ;
26372639 }
@@ -2658,7 +2660,7 @@ function fchownSync(fd, uid, gid) {
26582660 if ( result !== undefined ) return ;
26592661 }
26602662
2661- if ( permission . isEnabled ( ) ) {
2663+ if ( permission . isEnabled ( ) && ! permission . isAuditMode ( ) ) {
26622664 throw new ERR_ACCESS_DENIED ( 'fchown API is disabled when Permission Model is enabled.' ) ;
26632665 }
26642666
@@ -2772,7 +2774,7 @@ function futimes(fd, atime, mtime, callback) {
27722774 const h = vfsState . handlers ;
27732775 if ( h !== null && vfsVoid ( h . futimes ( fd , atime , mtime ) , callback ) ) return ;
27742776
2775- if ( permission . isEnabled ( ) ) {
2777+ if ( permission . isEnabled ( ) && ! permission . isAuditMode ( ) ) {
27762778 callback ( new ERR_ACCESS_DENIED ( 'futimes API is disabled when Permission Model is enabled.' ) ) ;
27772779 return ;
27782780 }
@@ -2801,7 +2803,7 @@ function futimesSync(fd, atime, mtime) {
28012803 if ( result !== undefined ) return ;
28022804 }
28032805
2804- if ( permission . isEnabled ( ) ) {
2806+ if ( permission . isEnabled ( ) && ! permission . isAuditMode ( ) ) {
28052807 throw new ERR_ACCESS_DENIED ( 'futimes API is disabled when Permission Model is enabled.' ) ;
28062808 }
28072809
0 commit comments