Skip to content

Commit

Permalink
Release v1.2.1 (#72)
Browse files Browse the repository at this point in the history
- guard against prototype pollution
  • Loading branch information
msimerson authored Apr 24, 2024
1 parent aad4576 commit 35e1325
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 24 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test/config/bad.yaml
2 changes: 1 addition & 1 deletion .release
Submodule .release updated 4 files
+4 −3 README.md
+9 −4 contributors.js
+1 −1 finish.sh
+26 −15 submit.sh
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

The format is based on [Keep a Changelog](https://keepachangelog.com/).

### Unreleased

### [1.2.1] - 2024-04-24

- config: guard against prototype pollution

### [1.2.0] - 2024-04-14

- feat: getDir can parse different types of files in a dir
Expand Down Expand Up @@ -121,3 +129,4 @@

[1.1.0]: https://github.com/haraka/haraka-config/releases/tag/1.1.0
[1.2.0]: https://github.com/haraka/haraka-config/releases/tag/v1.2.0
[1.2.1]: https://github.com/haraka/haraka-config/releases/tag/v1.2.1
2 changes: 1 addition & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This handcrafted artisinal software is brought to you by:

| <img height="80" src="https://avatars.githubusercontent.com/u/261635?v=4"><br><a href="https://github.com/msimerson">msimerson</a> (<a href="https://github.com/haraka/haraka-config/commits?author=msimerson">52</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/42121756?v=4"><br><a href="https://github.com/PSSGCSim">PSSGCSim</a> (<a href="https://github.com/haraka/haraka-config/commits?author=PSSGCSim">7</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/662371?v=4"><br><a href="https://github.com/baudehlo">baudehlo</a> (<a href="https://github.com/haraka/haraka-config/commits?author=baudehlo">1</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/651048?v=4"><br><a href="https://github.com/Wesitos">Wesitos</a> (<a href="https://github.com/haraka/haraka-config/commits?author=Wesitos">1</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/2270015?v=4"><br><a href="https://github.com/oreoluwa">oreoluwa</a> (<a href="https://github.com/haraka/haraka-config/commits?author=oreoluwa">1</a>) |
| <img height="80" src="https://avatars.githubusercontent.com/u/261635?v=4"><br><a href="https://github.com/msimerson">msimerson</a> (<a href="https://github.com/haraka/haraka-config/commits?author=msimerson">53</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/42121756?v=4"><br><a href="https://github.com/PSSGCSim">PSSGCSim</a> (<a href="https://github.com/haraka/haraka-config/commits?author=PSSGCSim">7</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/662371?v=4"><br><a href="https://github.com/baudehlo">baudehlo</a> (<a href="https://github.com/haraka/haraka-config/commits?author=baudehlo">1</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/651048?v=4"><br><a href="https://github.com/Wesitos">Wesitos</a> (<a href="https://github.com/haraka/haraka-config/commits?author=Wesitos">1</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/2270015?v=4"><br><a href="https://github.com/oreoluwa">oreoluwa</a> (<a href="https://github.com/haraka/haraka-config/commits?author=oreoluwa">1</a>) |
| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |

<sub>this file is maintained by [.release](https://github.com/msimerson/.release)</sub>
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ hosts[] = third_host

which produces this javascript array:

<!-- prettier-ignore -->
```js
['first_host', 'second_host', 'third_host']
```
Expand Down
1 change: 1 addition & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ function merge_config(defaults, overrides, type) {

function merge_struct(defaults, overrides) {
for (const k in overrides) {
if (['__proto__', 'constructor'].includes(k)) continue
if (k in defaults) {
if (typeof overrides[k] === 'object' && typeof defaults[k] === 'object') {
defaults[k] = merge_struct(defaults[k], overrides[k])
Expand Down
38 changes: 17 additions & 21 deletions lib/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,22 @@ module.exports.dir = (reader) => {
if (watchers[cp]) return

try {
watchers[cp] = fs.watch(
cp,
{ persistent: false },
(fse, filename) => {
if (!filename) return
const full_path = path.join(cp, filename)
const args = reader._read_args[full_path]
if (!args) return
if (args.options?.no_watch) return
if (sedation_timers[filename]) {
clearTimeout(sedation_timers[filename])
}
sedation_timers[filename] = setTimeout(() => {
console.log(`Reloading file: ${full_path}`)
reader.load_config(full_path, args.type, args.options)
delete sedation_timers[filename]
if (typeof args.cb === 'function') args.cb()
}, 5 * 1000)
},
)
watchers[cp] = fs.watch(cp, { persistent: false }, (fse, filename) => {
if (!filename) return
const full_path = path.join(cp, filename)
const args = reader._read_args[full_path]
if (!args) return
if (args.options?.no_watch) return
if (sedation_timers[filename]) {
clearTimeout(sedation_timers[filename])
}
sedation_timers[filename] = setTimeout(() => {
console.log(`Reloading file: ${full_path}`)
reader.load_config(full_path, args.type, args.options)
delete sedation_timers[filename]
if (typeof args.cb === 'function') args.cb()
}, 5 * 1000)
})
} catch (e) {
console.error(`Error watching directory ${cp}(${e})`)
}
Expand Down Expand Up @@ -141,4 +137,4 @@ module.exports.onEvent = (reader, name, args) => {
}
}
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "haraka-config",
"license": "MIT",
"description": "Haraka's config file loader",
"version": "1.2.0",
"version": "1.2.1",
"homepage": "http://haraka.github.io",
"repository": {
"type": "git",
Expand Down

0 comments on commit 35e1325

Please sign in to comment.