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

Local XML file names cannot contain percent sign #276

Open
dnmvisser opened this issue Oct 10, 2024 · 0 comments · May be fixed by #277
Open

Local XML file names cannot contain percent sign #276

dnmvisser opened this issue Oct 10, 2024 · 0 comments · May be fixed by #277

Comments

@dnmvisser
Copy link
Contributor

dnmvisser commented Oct 10, 2024

Code Version

pyff version 2.1.2

Expected Behavior

Local file name should not matter

Current Behavior

Minimal config:

---
- load:
  - /tmp/local/ as LOCAL
- select
- publish: /tmp/out.xml
- stats

When I drop a valid foobar.xml metadata file into /tmp/local, then pyFF works OK:

(venv) dnmvisser@GA0501-DVISSER pyFF$ pyff --local_copy_dir $TMPDIR batch.yaml 
---
total size:     1
selected:       1
          idps: 0
           sps: 1
---

When I rename that same file to foo%bar.xml:

(venv) dnmvisser@GA0501-DVISSER pyFF$ pyff --local_copy_dir $TMPDIR batch.yaml 
WARNING:pyff.resource:Got status=404 while getting file:///tmp/local/foo%bar.xml. Attempting fallback to local copy.
ERROR:pyff.resource:Failed handling resource: failed to fetch file:///tmp/local/foo%bar.xml (status: 404)
ERROR:pyff.builtins:<string>:0:0:ERROR:SCHEMASV:SCHEMAV_ELEMENT_CONTENT: Element '{urn:oasis:names:tc:SAML:2.0:metadata}EntitiesDescriptor': Missing child element(s). Expected is one of ( {http://www.w3.org/2000/09/xmldsig#}Signature, {urn:oasis:names:tc:SAML:2.0:metadata}Extensions, {urn:oasis:names:tc:SAML:2.0:metadata}EntityDescriptor, {urn:oasis:names:tc:SAML:2.0:metadata}EntitiesDescriptor ).
ERROR:pyff.pipes:Got exception when loading/executing pipe: XML schema validation failed
Traceback (most recent call last):
  File "/Users/dnmvisser/git/github.com/IdentityPython/pyFF/src/pyff/builtins.py", line 534, in publish
    validate_document(req.t)
  File "/Users/dnmvisser/git/github.com/IdentityPython/pyFF/src/pyff/utils.py", line 279, in validate_document
    schema().assertValid(t)
  File "src/lxml/etree.pyx", line 3691, in lxml.etree._Validator.assertValid
lxml.etree.DocumentInvalid: Element '{urn:oasis:names:tc:SAML:2.0:metadata}EntitiesDescriptor': Missing child element(s). Expected is one of ( {http://www.w3.org/2000/09/xmldsig#}Signature, {urn:oasis:names:tc:SAML:2.0:metadata}Extensions, {urn:oasis:names:tc:SAML:2.0:metadata}EntityDescriptor, {urn:oasis:names:tc:SAML:2.0:metadata}EntitiesDescriptor ).

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/dnmvisser/git/github.com/IdentityPython/pyFF/venv/bin/pyff", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/dnmvisser/git/github.com/IdentityPython/pyFF/src/pyff/md.py", line 33, in main
    plumbing(p).process(md, state={'batch': True, 'stats': {}})
  File "/Users/dnmvisser/git/github.com/IdentityPython/pyFF/src/pyff/pipes.py", line 365, in process
    ).process(self)
      ^^^^^^^^^^^^^
  File "/Users/dnmvisser/git/github.com/IdentityPython/pyFF/src/pyff/pipes.py", line 301, in process
    return pl.iprocess(self)
           ^^^^^^^^^^^^^^^^^
  File "/Users/dnmvisser/git/github.com/IdentityPython/pyFF/src/pyff/pipes.py", line 333, in iprocess
    raise ex
  File "/Users/dnmvisser/git/github.com/IdentityPython/pyFF/src/pyff/pipes.py", line 323, in iprocess
    ot = pipefn(req, *opts)
         ^^^^^^^^^^^^^^^^^^
  File "/Users/dnmvisser/git/github.com/IdentityPython/pyFF/src/pyff/builtins.py", line 537, in publish
    raise PipeException("XML schema validation failed")
pyff.pipes.PipeException: XML schema validation failed

I wanted to have the convention of storing local metadata using their URL encoded entityID as file name (much like MDQ), but that doesn't work because of this issue

@dnmvisser dnmvisser linked a pull request Oct 11, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant