Skip to content

Commit

Permalink
sandbox: allow some ZipPlugin primitives
Browse files Browse the repository at this point in the history
  • Loading branch information
LinqLover committed Jan 2, 2025
1 parent 4064652 commit 7d0e27a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,19 @@ context: aContext doNamedPrimitiveIn: aCompiledMethod for: rcvr withArgs: argume
writableObject]].
[#CroquetPlugin] -> ["allowed"].
[#FilePlugin] -> [^ self context: aContext activateOperationForbidden: 'FilePlugin not available in simulation'].
"[((aContext object: (self writableObjectFor: rcvr) eqeq: rcvr) ""hasOwnObject"" and:
[(#(primitiveFileGetPosition primitiveFileSetPosition primitiveFileRead) includes: primitiveName) or: [(rcvr isKindOf: StandardFileStream) and: [[rcvr isReadOnly] ifError: [false]] and: [#(primitiveFileFlush) includes: primitiveName]]])
ifFalse: [^ self context: aContext activateOperationForbidden: ('FilePlugin not available in simulation except for read-only accesses to own objects ({1})' format: {primitiveName})]]."
[#FloatArrayPlugin] -> [^ self context: aContext primitiveFailTokenFor: nil "use image implementation"].
[#Float64ArrayPlugin] -> [^ self context: aContext primitiveFailTokenFor: nil "use image implementation"].
[#LargeIntegers] -> ["allowed"].
[#MiscPrimitivePlugin] -> [^ self context: aContext primitiveFailTokenFor: nil "use image implementation"].
[#SimulationStudio] -> ["allowed"].
[#UUIDPlugin] -> ["allowed"].
[#ZipPlugin] -> [
(#('primitiveUpdateGZipCrc32' 'primitiveUpdateAdler32') includes: primitiveName)
ifTrue: ["allowed"]
ifFalse: ["use image implementation" self context: aContext primitiveFailTokenFor: nil] ].
[nil] -> [
(#('primitiveHighResClock' 'primitiveUtcWithOffset' 'primitiveUtcWithOffset') includes: primitiveName)
ifTrue: ["allowed"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"basicEvaluate:" : "ct 11/13/2021 16:12",
"context:activateOperationForbidden:" : "ct 11/13/2021 01:04",
"context:canBeImmutable:" : "ct 11/12/2021 23:54",
"context:doNamedPrimitiveIn:for:withArgs:" : "ct 5/2/2022 21:43",
"context:doNamedPrimitiveIn:for:withArgs:" : "ct 1/2/2025 22:59",
"context:doPrimitive:method:receiver:args:do:" : "ct 9/20/2022 13:10",
"context:doPrimitiveHash:receiver:args:" : "ct 11/12/2021 23:56",
"context:doPrimitiveNew:receiver:args:" : "ct 9/20/2022 13:07",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,19 @@ doNamedPrimitiveIn: aCompiledMethod for: rcvr withArgs: arguments
writableObject]].
[#CroquetPlugin] -> ["allowed"].
[#FilePlugin] -> [^ self activateOperationForbidden: 'FilePlugin not available in simulation'].
"[((self object: (self sandbox writableObjectFor: rcvr) eqeq: rcvr) ""hasOwnObject"" and:
[(#(primitiveFileGetPosition primitiveFileSetPosition primitiveFileRead) includes: primitiveName) or: [(rcvr isKindOf: StandardFileStream) and: [[rcvr isReadOnly] ifError: [false]] and: [#(primitiveFileFlush) includes: primitiveName]]])
ifFalse: [^ self activateOperationForbidden: ('FilePlugin not available in simulation except for read-only accesses to own objects ({1})' format: {primitiveName})]]."
[#FloatArrayPlugin] -> ["allowed"].
[#Float64ArrayPlugin] -> ["allowed"].
[#LargeIntegers] -> ["allowed"].
[#MiscPrimitivePlugin] -> [^ self class primitiveFailTokenFor: nil "use image implementation"].
[#SimulationStudio] -> ["allowed"].
[#UUIDPlugin] -> ["allowed"].
[#ZipPlugin] -> [
(#('primitiveUpdateGZipCrc32' 'primitiveUpdateAdler32') includes: primitiveName)
ifTrue: ["allowed"]
ifFalse: [^ self activateOperationForbidden: ('Unknown primitive {1} not available in simulation' format: {primitiveName})] ].
[nil] -> [
(#('primitiveHighResClock' 'primitiveUtcWithOffset' 'primitiveUtcWithOffset') includes: primitiveName)
ifTrue: ["allowed"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"access:indirectors:" : "ct 3/20/2021 23:35",
"activateOperationForbidden:" : "ct 3/3/2021 17:55",
"canBeImmutable:" : "ct 3/22/2021 23:47",
"doNamedPrimitiveIn:for:withArgs:" : "ct 5/10/2022 16:24",
"doNamedPrimitiveIn:for:withArgs:" : "ct 1/2/2025 23:17",
"doPrimitive:method:receiver:args:" : "ct 9/20/2022 13:00",
"doPrimitiveHash:receiver:args:" : "ct 3/22/2021 18:51",
"doPrimitiveNew:receiver:args:" : "ct 9/20/2022 13:06",
Expand Down

0 comments on commit 7d0e27a

Please sign in to comment.