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

Overflow is sanitized #236

Open
Butanium opened this issue Oct 13, 2021 · 8 comments
Open

Overflow is sanitized #236

Butanium opened this issue Oct 13, 2021 · 8 comments

Comments

@Butanium
Copy link

Hello, the codingame game engine which allow people to create games for its platform use your sanitizer on the game documentation.
When I tried to implement some overflow on tables, it got sanitized. The game engine principal contributor told me that he allowed everything he could and that he didn't know your sanitizer would delete overflows.

Is this possible to allow them ?

Here is the part of their code where they sanitize the game statement, and here is the part of my html page including the overflow :

             <div style="overflow-x:auto;">

                <table class="tableizer-table" ;>
                    <thead>
                    <tr class="tableizer-firstrow" ;>
                        <th>Bot class</th>
                        <th>Damage per bullet</th>
                        <th>Bullet per shot</th>
                        <th>Aim duration (frame)</th>
                        <th>Shot duration (frame)</th>
                        <th>Precision short range</th>
                        <th>Precision mid range</th>
                        <th>Precision long range</th>
                        <th>Speed</th>
                        <th>Health</th>
                        <th>Shield</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr align="center" ;>
                        <td>Assault</td>
                        <td>300</td>
                        <td>3</td>
                        <td>4</td>
                        <td>2</td>
                        <td>95%</td>
                        <td>55%</td>
                        <td>15%</td>
                        <td>1.2</td>
                        <td>5000</td>
                        <td>3000</td>
                    </tr>
                    </tbody>
                </table>
            </div>
@mikesamuel
Copy link
Contributor

What do you mean by "overflows?" Are you talking about the CSS overflow-x properties?

@mikesamuel
Copy link
Contributor

Or do the semicolons inside your HTML tags relate to your question?

@Butanium
Copy link
Author

Hello, the overflow-x properties

@mikesamuel
Copy link
Contributor

I believe overflow-x is recognized by the CSS property validator.

ImmutableSet<String> overflowLiterals0 = ImmutableSet.of(
"auto", "hidden", "inherit", "scroll", "visible");
ImmutableSet<String> overflowXLiterals0 = ImmutableSet.of(
"no-content", "no-display");
ImmutableSet<String> overflowXLiterals1 = ImmutableSet.of(
"auto", "hidden", "scroll", "visible");

@Butanium
Copy link
Author

Butanium commented Nov 8, 2021

Thanks for your answer !

How do you add them to the PolicyFactory as it's done for TABLES etc ?

@Butanium
Copy link
Author

Butanium commented Dec 6, 2021

If I import org.owasp.html.CssSchema and add

.and(CssSchema.DEFINITIONS)

at this line of code will it works ?

@CGjupoulton
Copy link

no :/

@csware
Copy link
Contributor

csware commented Jan 31, 2024

Add this to your policy to explicitly allow this property (with values as defined in CssSchema):
.allowStyling(CssSchema.withProperties(List.of("overflow-x")))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants