Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

## [Unreleased]

### Added

#### [Permission system](https://quarkdown.com/wiki/cli-compiler#permissions)

Quarkdown's permission system controls what a document can access during compilation, for increased safety.
If the compiler attempts an action that requires a permission it doesn't have, an error is raised.

You can grant or revoke permissions with the `--allow` and `--deny` flags:

```shell
quarkdown c main.qd --allow global-read --deny native-content
```

Available permissions: `project-read` (default), `global-read`, `network`, `native-content` (default), `all`. See the wiki page for more details.

### Changed

#### Parallel rendering
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,24 @@ import com.quarkdown.core.pipeline.stages.ParsingStage
import com.quarkdown.core.util.iterator
import com.quarkdown.core.util.node.conversion.list.MarkdownListToCollectionValue
import com.quarkdown.core.util.node.conversion.list.MarkdownListToDictionaryValue
import kotlin.collections.map

/**
* Prefix that forces a generic expression to be parsed as a lambda block.
* @see ValueFactory.expression
*/
private const val EXPRESSION_FORCE_LAMBDA_PREFIX = "@lambda "

/**
* Pre-compiled regex for stripping comments from expressions.
*/
private val COMMENT_REGEX = PatternHelpers.COMMENT.toRegex()

/**
* Pre-compiled regex for splitting whitespace-separated size values.
*/
private val WHITESPACE_REGEX = "\\s+".toRegex()

/**
* Factory of [Value] wrappers from raw data.
* @see com.quarkdown.core.function.reflect.FromDynamicType
Expand Down Expand Up @@ -213,7 +224,7 @@ object ValueFactory {
fun sizes(raw: Any): ObjectValue<Sizes> {
if (raw is Sizes) return ObjectValue(raw)

val parts = raw.toString().split("\\s+".toRegex())
val parts = raw.toString().split(WHITESPACE_REGEX)
val iterator = parts.iterator()

return ObjectValue(
Expand Down Expand Up @@ -541,7 +552,7 @@ object ValueFactory {
}

// Strip comments.
val rawCode = raw.toString().replace(PatternHelpers.COMMENT.toRegex(), "")
val rawCode = raw.toString().replace(COMMENT_REGEX, "")

if (rawCode.isEmpty()) return DynamicValue("")

Expand Down
Loading