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

Writer permission is incorrectly validated during the merge #424

Open
magnified103 opened this issue Feb 4, 2025 · 0 comments · May be fixed by #439
Open

Writer permission is incorrectly validated during the merge #424

magnified103 opened this issue Feb 4, 2025 · 0 comments · May be fixed by #439
Assignees

Comments

@magnified103
Copy link
Contributor

The permission check should validate against the ACL state for the corresponding vertex hash

for (const vertex of vertices) {
// Check to avoid manually crafted `undefined` operations
if (!vertex.operation || this.hashGraph.vertices.has(vertex.hash)) {
continue;
}
try {
if (!this._checkWriterPermission(vertex.peerId)) {
throw new Error(`${vertex.peerId} does not have write permission.`);
}
const preComputeLca = this.computeLCA(vertex.dependencies);

private _checkWriterPermission(peerId: string): boolean {
return this.acl
? (this.acl as ACL).permissionless || (this.acl as ACL).query_isWriter(peerId)
: true;
}

Previously this was done correctly, however due to several code rebases it became incorrect.

// Check to avoid manually crafted `undefined` operations
if (!vertex.operation || this.hashGraph.vertices.has(vertex.hash)) {
continue;
}
try {
const drp = this._computeDRP(vertex.dependencies);
if (!this._checkWriterPermission(drp, vertex.peerId)) {
throw new Error(`${vertex.peerId} does not have write permission.`);
}

@github-project-automation github-project-automation bot moved this to 🔮 Backlog in Project Management Feb 4, 2025
@magnified103 magnified103 changed the title Writer permission is incorrectly validated during the merge. Writer permission is incorrectly validated during the merge Feb 5, 2025
@winprn winprn self-assigned this Feb 5, 2025
@winprn winprn moved this from 🔮 Backlog to ⚙️ In Progress in Project Management Feb 5, 2025
@winprn winprn linked a pull request Feb 5, 2025 that will close this issue
@winprn winprn moved this from ⚙️ In Progress to 👀 Review in Project Management Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 👀 Review
Development

Successfully merging a pull request may close this issue.

2 participants