---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
snapshot_kind: text
---
S103.py:6:25: S103 `os.chmod` setting a permissive mask `0o227` on file or directory
  |
4 | keyfile = "foo"
5 | 
6 | os.chmod("/etc/passwd", 0o227)  # Error
  |                         ^^^^^ S103
7 | os.chmod("/etc/passwd", 0o7)  # Error
8 | os.chmod("/etc/passwd", 0o664)  # OK
  |

S103.py:7:25: S103 `os.chmod` setting a permissive mask `0o7` on file or directory
  |
6 | os.chmod("/etc/passwd", 0o227)  # Error
7 | os.chmod("/etc/passwd", 0o7)  # Error
  |                         ^^^ S103
8 | os.chmod("/etc/passwd", 0o664)  # OK
9 | os.chmod("/etc/passwd", 0o777)  # Error
  |

S103.py:9:25: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
   |
 7 | os.chmod("/etc/passwd", 0o7)  # Error
 8 | os.chmod("/etc/passwd", 0o664)  # OK
 9 | os.chmod("/etc/passwd", 0o777)  # Error
   |                         ^^^^^ S103
10 | os.chmod("/etc/passwd", 0o770)  # Error
11 | os.chmod("/etc/passwd", 0o776)  # Error
   |

S103.py:10:25: S103 `os.chmod` setting a permissive mask `0o770` on file or directory
   |
 8 | os.chmod("/etc/passwd", 0o664)  # OK
 9 | os.chmod("/etc/passwd", 0o777)  # Error
10 | os.chmod("/etc/passwd", 0o770)  # Error
   |                         ^^^^^ S103
11 | os.chmod("/etc/passwd", 0o776)  # Error
12 | os.chmod("/etc/passwd", 0o760)  # OK
   |

S103.py:11:25: S103 `os.chmod` setting a permissive mask `0o776` on file or directory
   |
 9 | os.chmod("/etc/passwd", 0o777)  # Error
10 | os.chmod("/etc/passwd", 0o770)  # Error
11 | os.chmod("/etc/passwd", 0o776)  # Error
   |                         ^^^^^ S103
12 | os.chmod("/etc/passwd", 0o760)  # OK
13 | os.chmod("~/.bashrc", 511)  # Error
   |

S103.py:13:23: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
   |
11 | os.chmod("/etc/passwd", 0o776)  # Error
12 | os.chmod("/etc/passwd", 0o760)  # OK
13 | os.chmod("~/.bashrc", 511)  # Error
   |                       ^^^ S103
14 | os.chmod("/etc/hosts", 0o777)  # Error
15 | os.chmod("/tmp/oh_hai", 0x1FF)  # Error
   |

S103.py:14:24: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
   |
12 | os.chmod("/etc/passwd", 0o760)  # OK
13 | os.chmod("~/.bashrc", 511)  # Error
14 | os.chmod("/etc/hosts", 0o777)  # Error
   |                        ^^^^^ S103
15 | os.chmod("/tmp/oh_hai", 0x1FF)  # Error
16 | os.chmod("/etc/passwd", stat.S_IRWXU)  # OK
   |

S103.py:15:25: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
   |
13 | os.chmod("~/.bashrc", 511)  # Error
14 | os.chmod("/etc/hosts", 0o777)  # Error
15 | os.chmod("/tmp/oh_hai", 0x1FF)  # Error
   |                         ^^^^^ S103
16 | os.chmod("/etc/passwd", stat.S_IRWXU)  # OK
17 | os.chmod(keyfile, 0o777)  # Error
   |

S103.py:17:19: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
   |
15 | os.chmod("/tmp/oh_hai", 0x1FF)  # Error
16 | os.chmod("/etc/passwd", stat.S_IRWXU)  # OK
17 | os.chmod(keyfile, 0o777)  # Error
   |                   ^^^^^ S103
18 | os.chmod(keyfile, 0o7 | 0o70 | 0o700)  # Error
19 | os.chmod(keyfile, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU)  # Error
   |

S103.py:18:19: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
   |
16 | os.chmod("/etc/passwd", stat.S_IRWXU)  # OK
17 | os.chmod(keyfile, 0o777)  # Error
18 | os.chmod(keyfile, 0o7 | 0o70 | 0o700)  # Error
   |                   ^^^^^^^^^^^^^^^^^^ S103
19 | os.chmod(keyfile, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU)  # Error
20 | os.chmod("~/hidden_exec", stat.S_IXGRP)  # Error
   |

S103.py:19:19: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
   |
17 | os.chmod(keyfile, 0o777)  # Error
18 | os.chmod(keyfile, 0o7 | 0o70 | 0o700)  # Error
19 | os.chmod(keyfile, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU)  # Error
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S103
20 | os.chmod("~/hidden_exec", stat.S_IXGRP)  # Error
21 | os.chmod("~/hidden_exec", stat.S_IXOTH)  # OK
   |

S103.py:20:27: S103 `os.chmod` setting a permissive mask `0o10` on file or directory
   |
18 | os.chmod(keyfile, 0o7 | 0o70 | 0o700)  # Error
19 | os.chmod(keyfile, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU)  # Error
20 | os.chmod("~/hidden_exec", stat.S_IXGRP)  # Error
   |                           ^^^^^^^^^^^^ S103
21 | os.chmod("~/hidden_exec", stat.S_IXOTH)  # OK
22 | os.chmod("/etc/passwd", stat.S_IWOTH)  # Error
   |

S103.py:22:25: S103 `os.chmod` setting a permissive mask `0o2` on file or directory
   |
20 | os.chmod("~/hidden_exec", stat.S_IXGRP)  # Error
21 | os.chmod("~/hidden_exec", stat.S_IXOTH)  # OK
22 | os.chmod("/etc/passwd", stat.S_IWOTH)  # Error
   |                         ^^^^^^^^^^^^ S103
23 | os.chmod("/etc/passwd", 0o100000000)  # Error
   |

S103.py:23:25: S103 `os.chmod` setting an invalid mask on file or directory
   |
21 | os.chmod("~/hidden_exec", stat.S_IXOTH)  # OK
22 | os.chmod("/etc/passwd", stat.S_IWOTH)  # Error
23 | os.chmod("/etc/passwd", 0o100000000)  # Error
   |                         ^^^^^^^^^^^ S103
   |
