Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(endomoat): create policy for the default attenuator
...instead of just allowing everything.
- Loading branch information
Showing
8 changed files
with
95 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* This script generates a policy for endomoat itself. This is needed to allow | ||
* the default attenuator to execute. | ||
* | ||
* The result of this is merged into the user-provided policy (or policies) | ||
* during conversion to an Endo policy. Because the Endo policy is not | ||
* persisted, making changes in endomoat won't break existing policies. | ||
* | ||
* By persisting the policy to disk, we tradeoff initial execution time for | ||
* needing to update the policy before release. Is this a good idea? I don't | ||
* know. | ||
* | ||
* @packageDocumentation | ||
*/ | ||
|
||
import { fileURLToPath } from 'node:url' | ||
import { generateAndWritePolicy } from '../src/index.js' | ||
|
||
const PHONY_ENTRYPOINT = new URL('./use-self/index.js', import.meta.url) | ||
|
||
const POLICY_OVERRIDE_PATH = fileURLToPath( | ||
new URL('../src/policy-override.json', import.meta.url) | ||
) | ||
|
||
generateAndWritePolicy(PHONY_ENTRYPOINT, { | ||
policyPath: POLICY_OVERRIDE_PATH, | ||
}).then(() => { | ||
console.error('Wrote %s', POLICY_OVERRIDE_PATH) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import '@lavamoat/endomoat/attenuator' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "use-self", | ||
"version": "0.0.0", | ||
"type": "module", | ||
"main": "index.js", | ||
"dependencies": { | ||
"@lavamoat/endomoat": "file:../.." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"resources": { | ||
"lavamoat-core": { | ||
"globals": { | ||
"console.warn": true | ||
} | ||
}, | ||
"@lavamoat/endomoat": { | ||
"packages": { | ||
"lavamoat-core": true | ||
}, | ||
"builtin": { | ||
"node:console": true, | ||
"node:path": true | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters