Repository navigation
Conversation
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
this is really good, I really need it. 👍 |
481122d to
30f6c15
Compare
78fe4a2 to
b634f0d
Compare
b634f0d to
97f740b
Compare
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
|
@rekram1-node Please can you re-open this PR, the build fails were due to not updating the tests following a clean rebase. |
|
@rekram1-node Please can this get your attention? Just to note, the current published documentation states "Managed settings override everything." and "Organizations can enforce configuration that users cannot override. Managed settings are loaded at the highest priority tier." Which as it currently stands is entirely inaccurate. Please can you consider merging this PR. Thanks |
Significant refactor to adapt to dev branch structure (top-level exports, ConfigParse module, ConfigManaged module). The original PR targeted the old Config namespace structure which has since been refactored away. Two bypass vectors allowed users to override enterprise managed config: 1. OPENCODE_PERMISSION env var was merged after managed config, so it won. A managed deny rule could be overwritten to allow. 2. Object fields like mcp, agent, provider etc. were additively merged. Users could inject extra entries alongside managed ones. Adds managed-settings.json (and managed-settings.d/ drop-in directory) in the system config location. It is loaded last, after all user config, project config, and OPENCODE_PERMISSION, so it cannot be overridden. Object fields in that file replace rather than merge, closing the injection vector.
The upstream Zod-to-Effect-Schema migration renamed ConfigParse.effectSchema to ConfigParse.schema. The managed-settings parseManagedFile helper still called the old name, so managed-settings.json was never successfully parsed and all authoritative override tests failed.
3377938 to
01b8d54
Compare
|
Yes ill take a look |
|
Glad to see that I am not the only one to notice. Fully agree with below: This fix is highly needed.. |
|
@rekram1-node Any update please? Thanks |
|
@rekram1-node any update? |
|
I would like to add that for agents as an example I think it makes sense to allow them to be made in a project folder. Not every agent needs to be created through that managed json. It's absolutely not ok for them to overwrite the permissions tho. Not quite sure if the replace of settings rather than merge with this PR would allow that scenario. |
|
@rekram1-node Any update please? Thanks |
|
@Daviey - I would love to also see this get into the codebase. Looks like you may need to rebase and fix conflicts to have it ready again since much time has passed. |
|
@rekram1-node 🙏🙏🙏🙏🙏 |
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
Issue for this PR
Closes #22292
Type of change
What does this PR do?
Two bypass vectors allowed users to override enterprise managed config:
OPENCODE_PERMISSIONenv var was merged after managed config, so it won. A managed deny rule could be overwritten to allow.mcp,agent,provideretc. were additively merged. Users could inject extra entries alongside managed ones (e.g. adding anevilMCP server or an extra provider).The fix introduces
managed-settings.json(and amanaged-settings.d/drop-in directory) in the system config location. It is loaded last, after all user config, project config, andOPENCODE_PERMISSION, so it cannot be overridden. Object fields in that file replace rather than merge, closing the injection vector.The existing
opencode.jsonmanaged config is unchanged and still loads earlier in the chain (for non-authoritative defaults).managed-settings.jsonis the opt-in high enforcement layer.How did you verify your code works?
Three commits in this PR, each with a specific purpose:
Commit 1:
5c25db2(tests only, no fix)11 tests fail against unpatched code. Run with:
Output:
Commit 2:
c5ca9d1(the fix)Same tests, now all pass:
Output:
The 3 tests that already passed at commit 1 (permission deny via OPENCODE_PERMISSION, drop-in fragment ordering, dotfile ignore) continue to pass.
Commit 3:
3a3c2f2(docs)Adds documentation for
managed-settings.jsonandmanaged-settings.d/drop-in fragments topackages/web/src/content/docs/config.mdx. No code changes.Screenshots / recordings
N/A, no UI changes.
Checklist