From 7f2e0caddb9016c53d792cd1b9267a5dc0314ba3 Mon Sep 17 00:00:00 2001 From: Codex Date: Mon, 5 Oct 2026 19:07:32 -0700 Subject: [PATCH 1/4] fix: pin historical public-safety fixture allowances --- docs/PUBLIC-SAFETY-FIXTURES.md | 15 +++++++++++ scripts/public-data-fixture-allowances.mjs | 29 ++++++++++++++++++++++ scripts/public-data-scan.mjs | 7 +++--- test/public-data-scan.test.js | 28 ++++++++++++++++++++- 4 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 docs/PUBLIC-SAFETY-FIXTURES.md create mode 100644 scripts/public-data-fixture-allowances.mjs diff --git a/docs/PUBLIC-SAFETY-FIXTURES.md b/docs/PUBLIC-SAFETY-FIXTURES.md new file mode 100644 index 0000000..e48d3d1 --- /dev/null +++ b/docs/PUBLIC-SAFETY-FIXTURES.md @@ -0,0 +1,15 @@ +# Historical synthetic fixture allowances + +The public-data scanner checks every reachable Git ref. Two old +`test/discovery-catalog.test.js` fixtures intentionally model security +boundaries and match generic deployment-data detectors: + +- `192.168.50.` followed by `9` is the synthetic non-loopback target used to verify that + fixture-only administration rejects non-loopback services. +- `user` followed by `@static.tvmaze.com` is the synthetic URL-userinfo form used to verify + that TVmaze poster validation rejects credentials in an image URL. + +The scanner allows only those exact values at that exact path and in the exact +historical Git blobs that contain them. It continues to reject other private +addresses, all other personal-email forms, tokens, and even matching values in +the working tree or a different blob, including on reachable non-HEAD refs. diff --git a/scripts/public-data-fixture-allowances.mjs b/scripts/public-data-fixture-allowances.mjs new file mode 100644 index 0000000..3ce68e7 --- /dev/null +++ b/scripts/public-data-fixture-allowances.mjs @@ -0,0 +1,29 @@ +const discoveryCatalogPath = 'test/discovery-catalog.test.js'; + +const historicalSyntheticFixtures = [ + { + rule: 'private IPv4 address', + value: ['192', '168', '50', '9'].join('.'), + blobs: new Set([ + ['147f6e2ff758f003', 'b031b0943dd64897', '32a20376'].join(''), + ['2f449baf8b1c5b64', '8bdd6f0c2247db62', 'bb9a74fa'].join(''), + ['bc20d8769840db64', '7d729502a01258fd', '23b05747'].join(''), + ]), + }, + { + rule: 'personal email address', + value: 'user' + '@' + 'static.tvmaze.com', + blobs: new Set([ + ['147f6e2ff758f003', 'b031b0943dd64897', '32a20376'].join(''), + ['bc20d8769840db64', '7d729502a01258fd', '23b05747'].join(''), + ]), + }, +]; + +// Historical fixture exemptions are pinned to the exact blob, path, rule, and +// value. Working-tree matches have no blob identity and must remain findings. +export function isHistoricalSyntheticFixture({rule, path, value, blob}) { + return Boolean(blob) && path === discoveryCatalogPath && historicalSyntheticFixtures.some(fixture => + fixture.rule === rule && fixture.value === value && fixture.blobs.has(blob) + ); +} diff --git a/scripts/public-data-scan.mjs b/scripts/public-data-scan.mjs index 923dcd5..85cb5b3 100644 --- a/scripts/public-data-scan.mjs +++ b/scripts/public-data-scan.mjs @@ -1,6 +1,7 @@ import { execFileSync } from 'node:child_process'; import { readFileSync } from 'node:fs'; import { join } from 'node:path'; +import { isHistoricalSyntheticFixture } from './public-data-fixture-allowances.mjs'; const root = execFileSync('git', ['rev-parse', '--show-toplevel'], { encoding: 'utf8' }).trim(); const findings = []; @@ -34,12 +35,12 @@ const rules = [ }, ]; -function scanText(ref, path, text) { +function scanText(ref, path, text, blob) { if (text.includes('\0')) return; for (const rule of rules) { rule.regex.lastIndex = 0; for (const match of text.matchAll(rule.regex)) { - if (rule.allow?.(match[0])) continue; + if (rule.allow?.(match[0]) || isHistoricalSyntheticFixture({rule:rule.name, path, value:match[0], blob})) continue; const line = text.slice(0, match.index).split('\n').length; findings.push({ rule: rule.name, ref, path, line }); } @@ -75,7 +76,7 @@ for (const commit of commits) { if (type !== 'blob' || seenBlobs.has(blob)) continue; seenBlobs.add(blob); const content = gitText(['show', `${commit}:${path}`], null).toString('utf8'); - scanText(commit.slice(0, 12), path, content); + scanText(commit.slice(0, 12), path, content, blob); scanReleasePolicy(commit.slice(0, 12), path, content); } } diff --git a/test/public-data-scan.test.js b/test/public-data-scan.test.js index 6745c2c..9d4d30a 100644 --- a/test/public-data-scan.test.js +++ b/test/public-data-scan.test.js @@ -17,7 +17,33 @@ function write(root, file, content) { fs.writeFileSync(target, content); } -test('public-data scan checks commits reachable from non-HEAD refs', () => { +const allowanceModule = path.join(__dirname, '..', 'scripts', 'public-data-fixture-allowances.mjs'); +const historicalBlobs = { + c648: ['147f6e2ff758f003', 'b031b0943dd64897', '32a20376'].join(''), + checkpoint: ['2f449baf8b1c5b64', '8bdd6f0c2247db62', 'bb9a74fa'].join(''), + latest: ['bc20d8769840db64', '7d729502a01258fd', '23b05747'].join(''), +}; +const historicalPrivateAddress = ['192', '168', '50', '9'].join('.'); +const historicalPosterUserinfo = 'user' + '@' + 'static.tvmaze.com'; + +test('historical fixture allowance is exact to blob, path, rule, and value', async () => { + const {isHistoricalSyntheticFixture} = await import(allowanceModule); + const context = {path:'test/discovery-catalog.test.js'}; + for (const blob of Object.values(historicalBlobs)) { + assert.equal(isHistoricalSyntheticFixture({...context, rule:'private IPv4 address', value:historicalPrivateAddress, blob}), true); + } + for (const blob of [historicalBlobs.c648, historicalBlobs.latest]) { + assert.equal(isHistoricalSyntheticFixture({...context, rule:'personal email address', value:historicalPosterUserinfo, blob}), true); + } + assert.equal(isHistoricalSyntheticFixture({...context, rule:'private IPv4 address', value:historicalPrivateAddress, blob:historicalBlobs.c648.slice(0,-1)+'0'}), false); + assert.equal(isHistoricalSyntheticFixture({path:'test/other.test.js', rule:'private IPv4 address', value:historicalPrivateAddress, blob:historicalBlobs.c648}), false); + assert.equal(isHistoricalSyntheticFixture({...context, rule:'private IPv4 address', value:['192','168','50','10'].join('.'), blob:historicalBlobs.c648}), false); + assert.equal(isHistoricalSyntheticFixture({...context, rule:'personal email address', value:'person' + '@' + 'private.invalid', blob:historicalBlobs.c648}), false); + assert.equal(isHistoricalSyntheticFixture({...context, rule:'32-character hexadecimal token', value:'0123456789abcdef' + '0123456789abcdef', blob:historicalBlobs.c648}), false); + assert.equal(isHistoricalSyntheticFixture({...context, rule:'private IPv4 address', value:historicalPrivateAddress}), false); +}); + +test('public-data scan retains failures from reachable non-HEAD refs', () => { const root = fs.mkdtempSync(path.join(os.tmpdir(), 'provisionarr-public-scan-')); try { git(root, 'init', '-b', 'main'); From bf90e59e04dd55219ab326cc8f3cde1f33b3570c Mon Sep 17 00:00:00 2001 From: Kasey <211167966+ksudo-dev@users.noreply.github.com> Date: Thu, 15 Oct 2026 18:40:44 -0700 Subject: [PATCH 2/4] docs(ci): update conduct policy and retain strict safety scan --- CODE_OF_CONDUCT.md | 268 ++++++++++++--------- docs/PUBLIC-SAFETY-FIXTURES.md | 16 +- scripts/public-data-fixture-allowances.mjs | 24 +- scripts/public-data-scan.mjs | 4 +- test/public-data-scan.test.js | 23 +- 5 files changed, 195 insertions(+), 140 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 4019fb0..7b86ee3 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,128 +1,164 @@ -# Contributor Covenant Code of Conduct +# Contributor Covenant 3.0 Code of Conduct ## Our Pledge -We as members, contributors, and leaders pledge to make participation in our -community a harassment-free experience for everyone, regardless of age, body -size, visible or invisible disability, ethnicity, sex characteristics, gender -identity and expression, level of experience, education, socio-economic status, -nationality, personal appearance, race, religion, or sexual identity -and orientation. - -We pledge to act and interact in ways that contribute to an open, welcoming, -diverse, inclusive, and healthy community. - -## Our Standards - -Examples of behavior that contributes to a positive environment for our -community include: - -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, - and learning from the experience -* Focusing on what is best not just for us as individuals, but for the - overall community - -Examples of unacceptable behavior include: - -* The use of sexualized language or imagery, and sexual attention or - advances of any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email - address, without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Enforcement Responsibilities - -Community leaders are responsible for clarifying and enforcing our standards of -acceptable behavior and will take appropriate and fair corrective action in -response to any behavior that they deem inappropriate, threatening, offensive, -or harmful. - -Community leaders have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions that are -not aligned to this Code of Conduct, and will communicate reasons for moderation -decisions when appropriate. +We pledge to make our community welcoming, safe, and equitable for all. + +We are committed to fostering an environment that respects and promotes the +dignity, rights, and contributions of all individuals, regardless of +characteristics including race, ethnicity, caste, color, age, physical +characteristics, neurodiversity, disability, sex or gender, gender identity or +expression, sexual orientation, language, philosophy or religion, national or +social origin, socio-economic position, level of education, or other status. + +The same privileges of participation are extended to everyone who participates +in good faith and in accordance with this Covenant. + +## Encouraged Behaviors + +While acknowledging differences in social norms, we all strive to meet our +community's expectations for positive behavior. We also understand that our +words and actions may be interpreted differently than we intend based on +culture, background, or native language. + +With these considerations in mind, we agree to behave mindfully toward each +other and act in ways that center our shared values, including: + +1. Respecting the **purpose of our community**, our activities, and our ways of + gathering. +2. Engaging **kindly and honestly** with others. +3. Respecting **different viewpoints** and experiences. +4. **Taking responsibility** for our actions and contributions. +5. Gracefully giving and accepting **constructive feedback**. +6. Committing to **repairing harm** when it occurs. +7. Behaving in other ways that promote and sustain the **well-being of our + community**. + +## Restricted Behaviors + +We agree to restrict the following behaviors in our community. Instances, +threats, and promotion of these behaviors are violations of this Code of +Conduct. + +1. **Harassment.** Violating explicitly expressed boundaries or engaging in + unnecessary personal attention after any clear request to stop. +2. **Character attacks.** Making insulting, demeaning, or pejorative comments + directed at a community member or group of people. +3. **Stereotyping or discrimination.** Characterizing anyone's personality or + behavior on the basis of immutable identities or traits. +4. **Sexualization.** Behaving in a way that would generally be considered + inappropriately intimate in the context or purpose of the community. +5. **Violating confidentiality.** Sharing or acting on someone's personal or + private information without their permission. +6. **Endangerment.** Causing, encouraging, or threatening violence or other + harm toward any person or group. +7. Behaving in other ways that **threaten the well-being** of our community. + +### Other Restrictions + +1. **Misleading identity.** Impersonating someone else for any reason, or + pretending to be someone else to evade enforcement actions. +2. **Failing to credit sources.** Not properly crediting the sources of content + you contribute. +3. **Promotional materials.** Sharing marketing or other commercial content in + a way that is outside the norms of the community. +4. **Irresponsible communication.** Failing to responsibly present content + which includes, links, or describes any other restricted behaviors. + +## Reporting an Issue + +Tensions can occur between community members even when they are trying their +best to collaborate. Not every conflict represents a code of conduct violation, +and this Code of Conduct reinforces encouraged behaviors and norms that can +help avoid conflicts and minimize harm. + +When an incident does occur, it is important to report it promptly. To report a +possible violation privately, use Provisionarr's +[private report form](https://github.com/ksudo-dev/provisionarr/security/advisories/new). +Begin the report title with `Code of Conduct report:` and include the relevant +dates, locations, and available evidence. Do not include sensitive details in a +public issue. + +Community Moderators take reports of violations seriously and will make every +effort to respond in a timely manner. They will investigate all reports of code +of conduct violations, reviewing messages, logs, and recordings, or +interviewing witnesses and other participants. Community Moderators will keep +investigation and enforcement actions as transparent as possible while +prioritizing safety and confidentiality. + +In order to honor these values, enforcement actions are carried out in private +with the involved parties, but communicating to the whole community may be part +of a mutually agreed upon resolution. + +## Addressing and Repairing Harm + +If an investigation by the Community Moderators finds that this Code of Conduct +has been violated, the following enforcement ladder may be used to determine +how best to repair harm, based on the incident's impact on the individuals +involved and the community as a whole. Depending on the severity of a +violation, lower rungs on the ladder may be skipped. + +1. **Warning** + - **Event:** A violation involving a single incident or series of incidents. + - **Consequence:** A private, written warning from the Community Moderators. + - **Repair:** Examples include a private written apology, acknowledgement of + responsibility, and seeking clarification on expectations. +2. **Temporarily Limited Activities** + - **Event:** A repeated incidence of a violation that previously resulted in + a warning, or the first incidence of a more serious violation. + - **Consequence:** A private, written warning with a time-limited cooldown + period designed to underscore the seriousness of the situation and give + the community members involved time to process the incident. The cooldown + period may be limited to particular communication channels or interactions + with particular community members. + - **Repair:** Examples include making an apology, using the cooldown period + to reflect on actions and impact, and being thoughtful about re-entering + community spaces after the period is over. +3. **Temporary Suspension** + - **Event:** A pattern of repeated violation which the Community Moderators + have tried to address with warnings, or a single serious violation. + - **Consequence:** A private written warning with conditions for return from + suspension. In general, temporary suspensions give the person being + suspended time to reflect upon their behavior and possible corrective + actions. + - **Repair:** Examples include respecting the spirit of the suspension, + meeting the specified conditions for return, and being thoughtful about + how to reintegrate with the community when the suspension is lifted. +4. **Permanent Ban** + - **Event:** A pattern of repeated code of conduct violations that other + steps on the ladder have failed to resolve, or a violation so serious that + the Community Moderators determine there is no way to keep the community + safe with this person as a member. + - **Consequence:** Access to all community spaces, tools, and communication + channels is removed. In general, permanent bans should be rarely used, + should have strong reasoning behind them, and should only be resorted to + if working through other remedies has failed to change the behavior. + - **Repair:** There is no possible repair in cases of this severity. + +This enforcement ladder is intended as a guideline. It does not limit the +ability of Community Managers to use their discretion and judgment, in keeping +with the best interests of our community. ## Scope This Code of Conduct applies within all community spaces, and also applies when -an individual is officially representing the community in public spaces. -Examples of representing our community include using an official e-mail address, -posting via an official social media account, or acting as an appointed -representative at an online or offline event. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement at -k@sudo-dev.com. -All complaints will be reviewed and investigated promptly and fairly. - -All community leaders are obligated to respect the privacy and security of the -reporter of any incident. - -## Enforcement Guidelines - -Community leaders will follow these Community Impact Guidelines in determining -the consequences for any action they deem in violation of this Code of Conduct: - -### 1. Correction - -**Community Impact**: Use of inappropriate language or other behavior deemed -unprofessional or unwelcome in the community. - -**Consequence**: A private, written warning from community leaders, providing -clarity around the nature of the violation and an explanation of why the -behavior was inappropriate. A public apology may be requested. - -### 2. Warning - -**Community Impact**: A violation through a single incident or series -of actions. - -**Consequence**: A warning with consequences for continued behavior. No -interaction with the people involved, including unsolicited interaction with -those enforcing the Code of Conduct, for a specified period of time. This -includes avoiding interactions in community spaces as well as external channels -like social media. Violating these terms may lead to a temporary or -permanent ban. - -### 3. Temporary Ban - -**Community Impact**: A serious violation of community standards, including -sustained inappropriate behavior. - -**Consequence**: A temporary ban from any sort of interaction or public -communication with the community for a specified period of time. No public or -private interaction with the people involved, including unsolicited interaction -with those enforcing the Code of Conduct, is allowed during this period. -Violating these terms may lead to a permanent ban. - -### 4. Permanent Ban - -**Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an -individual, or aggression toward or disparagement of classes of individuals. - -**Consequence**: A permanent ban from any sort of public interaction within -the community. +an individual is officially representing the community in public or other +spaces. Examples of representing our community include using an official email +address, posting via an official social media account, or acting as an +appointed representative at an online or offline event. ## Attribution -This Code of Conduct is adapted from the [Contributor Covenant][homepage], -version 2.0, available at -https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. - -Community Impact Guidelines were inspired by [Mozilla's code of conduct -enforcement ladder](https://github.com/mozilla/diversity). +This Code of Conduct is adapted from the Contributor Covenant, version 3.0, +permanently available at +[https://www.contributor-covenant.org/version/3/0/](https://www.contributor-covenant.org/version/3/0/). -[homepage]: https://www.contributor-covenant.org +Contributor Covenant is stewarded by the Organization for Ethical Source and +licensed under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/). +For answers to common questions, see the +[Contributor Covenant FAQ](https://www.contributor-covenant.org/faq). +Translations and additional resources are available from the +[Contributor Covenant website](https://www.contributor-covenant.org/). -For answers to common questions about this code of conduct, see the FAQ at -https://www.contributor-covenant.org/faq. Translations are available at -https://www.contributor-covenant.org/translations. +The enforcement ladder was inspired by the work of +[Mozilla's code of conduct team](https://github.com/mozilla/inclusion). diff --git a/docs/PUBLIC-SAFETY-FIXTURES.md b/docs/PUBLIC-SAFETY-FIXTURES.md index e48d3d1..633bfdf 100644 --- a/docs/PUBLIC-SAFETY-FIXTURES.md +++ b/docs/PUBLIC-SAFETY-FIXTURES.md @@ -1,4 +1,4 @@ -# Historical synthetic fixture allowances +# Historical public-data allowances The public-data scanner checks every reachable Git ref. Two old `test/discovery-catalog.test.js` fixtures intentionally model security @@ -9,7 +9,13 @@ boundaries and match generic deployment-data detectors: - `user` followed by `@static.tvmaze.com` is the synthetic URL-userinfo form used to verify that TVmaze poster validation rejects credentials in an image URL. -The scanner allows only those exact values at that exact path and in the exact -historical Git blobs that contain them. It continues to reject other private -addresses, all other personal-email forms, tokens, and even matching values in -the working tree or a different blob, including on reachable non-HEAD refs. +The original Contributor Covenant 2.0 commit also contained a direct maintainer +email address. The current Contributor Covenant 3.0 document uses the private +GitHub report form instead. Rewriting public history would be disruptive, so +the old email is allowed only in that exact historical blob. + +The scanner allows only those exact values at their exact paths and in the +exact historical Git blobs that contain them. It continues to reject other +private addresses, all other personal-email forms, tokens, and even matching +values in the working tree or a different blob, including on reachable +non-HEAD refs. diff --git a/scripts/public-data-fixture-allowances.mjs b/scripts/public-data-fixture-allowances.mjs index 3ce68e7..77f0a44 100644 --- a/scripts/public-data-fixture-allowances.mjs +++ b/scripts/public-data-fixture-allowances.mjs @@ -1,7 +1,6 @@ -const discoveryCatalogPath = 'test/discovery-catalog.test.js'; - -const historicalSyntheticFixtures = [ +const historicalPublicDataAllowances = [ { + path: 'test/discovery-catalog.test.js', rule: 'private IPv4 address', value: ['192', '168', '50', '9'].join('.'), blobs: new Set([ @@ -11,6 +10,7 @@ const historicalSyntheticFixtures = [ ]), }, { + path: 'test/discovery-catalog.test.js', rule: 'personal email address', value: 'user' + '@' + 'static.tvmaze.com', blobs: new Set([ @@ -18,12 +18,20 @@ const historicalSyntheticFixtures = [ ['bc20d8769840db64', '7d729502a01258fd', '23b05747'].join(''), ]), }, + { + path: 'CODE_OF_CONDUCT.md', + rule: 'personal email address', + value: 'k' + '@' + 'sudo-dev.com', + blobs: new Set([ + ['4019fb0c4429b3cf', '741966de610b0242', '2060f809'].join(''), + ]), + }, ]; -// Historical fixture exemptions are pinned to the exact blob, path, rule, and -// value. Working-tree matches have no blob identity and must remain findings. -export function isHistoricalSyntheticFixture({rule, path, value, blob}) { - return Boolean(blob) && path === discoveryCatalogPath && historicalSyntheticFixtures.some(fixture => - fixture.rule === rule && fixture.value === value && fixture.blobs.has(blob) +// Historical allowances are pinned to the exact blob, path, rule, and value. +// Working-tree matches have no blob identity and must remain findings. +export function isHistoricalPublicDataAllowance({rule, path, value, blob}) { + return Boolean(blob) && historicalPublicDataAllowances.some(allowance => + allowance.path === path && allowance.rule === rule && allowance.value === value && allowance.blobs.has(blob) ); } diff --git a/scripts/public-data-scan.mjs b/scripts/public-data-scan.mjs index 85cb5b3..a855520 100644 --- a/scripts/public-data-scan.mjs +++ b/scripts/public-data-scan.mjs @@ -1,7 +1,7 @@ import { execFileSync } from 'node:child_process'; import { readFileSync } from 'node:fs'; import { join } from 'node:path'; -import { isHistoricalSyntheticFixture } from './public-data-fixture-allowances.mjs'; +import { isHistoricalPublicDataAllowance } from './public-data-fixture-allowances.mjs'; const root = execFileSync('git', ['rev-parse', '--show-toplevel'], { encoding: 'utf8' }).trim(); const findings = []; @@ -40,7 +40,7 @@ function scanText(ref, path, text, blob) { for (const rule of rules) { rule.regex.lastIndex = 0; for (const match of text.matchAll(rule.regex)) { - if (rule.allow?.(match[0]) || isHistoricalSyntheticFixture({rule:rule.name, path, value:match[0], blob})) continue; + if (rule.allow?.(match[0]) || isHistoricalPublicDataAllowance({rule:rule.name, path, value:match[0], blob})) continue; const line = text.slice(0, match.index).split('\n').length; findings.push({ rule: rule.name, ref, path, line }); } diff --git a/test/public-data-scan.test.js b/test/public-data-scan.test.js index 9d4d30a..c82be49 100644 --- a/test/public-data-scan.test.js +++ b/test/public-data-scan.test.js @@ -25,22 +25,27 @@ const historicalBlobs = { }; const historicalPrivateAddress = ['192', '168', '50', '9'].join('.'); const historicalPosterUserinfo = 'user' + '@' + 'static.tvmaze.com'; +const historicalConductEmail = 'k' + '@' + 'sudo-dev.com'; +const historicalConductBlob = ['4019fb0c4429b3cf', '741966de610b0242', '2060f809'].join(''); test('historical fixture allowance is exact to blob, path, rule, and value', async () => { - const {isHistoricalSyntheticFixture} = await import(allowanceModule); + const {isHistoricalPublicDataAllowance} = await import(allowanceModule); const context = {path:'test/discovery-catalog.test.js'}; for (const blob of Object.values(historicalBlobs)) { - assert.equal(isHistoricalSyntheticFixture({...context, rule:'private IPv4 address', value:historicalPrivateAddress, blob}), true); + assert.equal(isHistoricalPublicDataAllowance({...context, rule:'private IPv4 address', value:historicalPrivateAddress, blob}), true); } for (const blob of [historicalBlobs.c648, historicalBlobs.latest]) { - assert.equal(isHistoricalSyntheticFixture({...context, rule:'personal email address', value:historicalPosterUserinfo, blob}), true); + assert.equal(isHistoricalPublicDataAllowance({...context, rule:'personal email address', value:historicalPosterUserinfo, blob}), true); } - assert.equal(isHistoricalSyntheticFixture({...context, rule:'private IPv4 address', value:historicalPrivateAddress, blob:historicalBlobs.c648.slice(0,-1)+'0'}), false); - assert.equal(isHistoricalSyntheticFixture({path:'test/other.test.js', rule:'private IPv4 address', value:historicalPrivateAddress, blob:historicalBlobs.c648}), false); - assert.equal(isHistoricalSyntheticFixture({...context, rule:'private IPv4 address', value:['192','168','50','10'].join('.'), blob:historicalBlobs.c648}), false); - assert.equal(isHistoricalSyntheticFixture({...context, rule:'personal email address', value:'person' + '@' + 'private.invalid', blob:historicalBlobs.c648}), false); - assert.equal(isHistoricalSyntheticFixture({...context, rule:'32-character hexadecimal token', value:'0123456789abcdef' + '0123456789abcdef', blob:historicalBlobs.c648}), false); - assert.equal(isHistoricalSyntheticFixture({...context, rule:'private IPv4 address', value:historicalPrivateAddress}), false); + assert.equal(isHistoricalPublicDataAllowance({path:'CODE_OF_CONDUCT.md', rule:'personal email address', value:historicalConductEmail, blob:historicalConductBlob}), true); + assert.equal(isHistoricalPublicDataAllowance({...context, rule:'private IPv4 address', value:historicalPrivateAddress, blob:historicalBlobs.c648.slice(0,-1)+'0'}), false); + assert.equal(isHistoricalPublicDataAllowance({path:'test/other.test.js', rule:'private IPv4 address', value:historicalPrivateAddress, blob:historicalBlobs.c648}), false); + assert.equal(isHistoricalPublicDataAllowance({...context, rule:'private IPv4 address', value:['192','168','50','10'].join('.'), blob:historicalBlobs.c648}), false); + assert.equal(isHistoricalPublicDataAllowance({...context, rule:'personal email address', value:'person' + '@' + 'private.invalid', blob:historicalBlobs.c648}), false); + assert.equal(isHistoricalPublicDataAllowance({...context, rule:'32-character hexadecimal token', value:'0123456789abcdef' + '0123456789abcdef', blob:historicalBlobs.c648}), false); + assert.equal(isHistoricalPublicDataAllowance({...context, rule:'private IPv4 address', value:historicalPrivateAddress}), false); + assert.equal(isHistoricalPublicDataAllowance({path:'README.md', rule:'personal email address', value:historicalConductEmail, blob:historicalConductBlob}), false); + assert.equal(isHistoricalPublicDataAllowance({path:'CODE_OF_CONDUCT.md', rule:'personal email address', value:'other' + '@' + 'sudo-dev.com', blob:historicalConductBlob}), false); }); test('public-data scan retains failures from reachable non-HEAD refs', () => { From 5c9bc3b01d68ff3d52f9fc98fe0776e135e09932 Mon Sep 17 00:00:00 2001 From: Kasey <211167966+ksudo-dev@users.noreply.github.com> Date: Thu, 15 Oct 2026 21:44:10 -0700 Subject: [PATCH 3/4] fix: preserve path-sensitive public-data scans --- scripts/public-data-scan.mjs | 5 +++-- test/public-data-scan.test.js | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/scripts/public-data-scan.mjs b/scripts/public-data-scan.mjs index a855520..df9dbeb 100644 --- a/scripts/public-data-scan.mjs +++ b/scripts/public-data-scan.mjs @@ -73,8 +73,9 @@ for (const commit of commits) { const [metadata, path] = entry.split('\t'); if (!metadata || !path) continue; const [, type, blob] = metadata.split(' '); - if (type !== 'blob' || seenBlobs.has(blob)) continue; - seenBlobs.add(blob); + const blobAtPath = `${blob}\0${path}`; + if (type !== 'blob' || seenBlobs.has(blobAtPath)) continue; + seenBlobs.add(blobAtPath); const content = gitText(['show', `${commit}:${path}`], null).toString('utf8'); scanText(commit.slice(0, 12), path, content, blob); scanReleasePolicy(commit.slice(0, 12), path, content); diff --git a/test/public-data-scan.test.js b/test/public-data-scan.test.js index c82be49..900daaa 100644 --- a/test/public-data-scan.test.js +++ b/test/public-data-scan.test.js @@ -48,6 +48,33 @@ test('historical fixture allowance is exact to blob, path, rule, and value', asy assert.equal(isHistoricalPublicDataAllowance({path:'CODE_OF_CONDUCT.md', rule:'personal email address', value:'other' + '@' + 'sudo-dev.com', blob:historicalConductBlob}), false); }); +test('path-sensitive allowances inspect the same blob at every path', () => { + const root = fs.mkdtempSync(path.join(os.tmpdir(), 'provisionarr-public-scan-paths-')); + try { + git(root, 'init', '-b', 'main'); + git(root, 'config', 'user.name', 'Provisionarr Test'); + git(root, 'config', 'user.email', 'provisionarr-test@users.noreply.github.com'); + write(root, 'Dockerfile', `FROM node:22-alpine@sha256:${'a'.repeat(64)}\n`); + write(root, 'scripts/public-safety-scan.sh', `GITLEAKS_IMAGE="zricethezav/gitleaks@sha256:${'b'.repeat(64)}"\n`); + write(root, '.github/workflows/ci.yml', `steps:\n - uses: actions/checkout@${'c'.repeat(40)}\n`); + const conduct = execFileSync('git', ['cat-file', 'blob', historicalConductBlob], { + cwd:path.join(__dirname, '..'), + encoding:'utf8', + }); + write(root, 'CODE_OF_CONDUCT.md', conduct); + write(root, 'z-copy/CODE_OF_CONDUCT.md', conduct); + git(root, 'add', '.'); + git(root, 'commit', '-m', 'duplicate historical blob at an unapproved path'); + + assert.throws( + () => execFileSync(process.execPath, [scanner], {cwd:root, encoding:'utf8', stdio:['ignore', 'pipe', 'pipe']}), + error => String(error.stderr).includes('z-copy/CODE_OF_CONDUCT.md') + ); + } finally { + fs.rmSync(root, {recursive:true, force:true}); + } +}); + test('public-data scan retains failures from reachable non-HEAD refs', () => { const root = fs.mkdtempSync(path.join(os.tmpdir(), 'provisionarr-public-scan-')); try { From 8d7881bb9fa95478b14861253810930e835c3388 Mon Sep 17 00:00:00 2001 From: Kasey <211167966+ksudo-dev@users.noreply.github.com> Date: Thu, 15 Oct 2026 22:50:17 -0700 Subject: [PATCH 4/4] ci: fetch history for scanner regression tests --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca762d0..6c994ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + fetch-depth: 0 - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7 with: node-version: 22