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

feat: upgrading security policy #337

Merged
merged 2 commits into from
Feb 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
# Security Policy

## Supported Versions

This project is updated on a monthly basis unless there are security issues that need addressed that day.

| Version | Supported |
| ------- | ------------------ |
| >3.0.0 | :white_check_mark: |
| 2.0.0 | not supported |
| 1.0.0 | not supported |


## Reporting a Vulnerability

To report a vulnerability please create an issue and assign the owner 'Jared Wray' to it as it will notify him and he is actively maintaining this project.
We attempt to keep this project up to date with the latest modules on a regular basis. Please make sure to upgrade to the latest to avoid major issues. To report a vulnerability please create an issue and assign the owner 'Jared Wray' to it as it will notify him and he is actively maintaining this project.
48 changes: 32 additions & 16 deletions src/writr.ts
Original file line number Diff line number Diff line change
@@ -412,14 +412,22 @@ export class Writr extends Hookified {
* @returns {Promise<void>}
*/
public async loadFromFile(filePath: string): Promise<void> {
const {readFile} = fs.promises;
const data = {
content: '',
};
data.content = await readFile(filePath, 'utf8');

await this.hook(WritrHooks.loadFromFile, data);
this._content = data.content;
try {
const {readFile} = fs.promises;
const data = {
content: '',
};
data.content = await readFile(filePath, 'utf8');

await this.hook(WritrHooks.loadFromFile, data);
this._content = data.content;
/* c8 ignore next 6 */
} catch (error) {
this.emit('error', error);
if (this._options.throwErrors) {
throw error;
}
}
}

/**
@@ -428,14 +436,22 @@ export class Writr extends Hookified {
* @returns {void}
*/
public loadFromFileSync(filePath: string): void {
const data = {
content: '',
};
data.content = fs.readFileSync(filePath, 'utf8');

// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.hook(WritrHooks.loadFromFile, data);
this._content = data.content;
try {
const data = {
content: '',
};
data.content = fs.readFileSync(filePath, 'utf8');

// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.hook(WritrHooks.loadFromFile, data);
this._content = data.content;
/* c8 ignore next 6 */
} catch (error) {
this.emit('error', error);
if (this._options.throwErrors) {
throw error;
}
}
}

/**